Skip to content

Commit df48ef7

Browse files
author
Igor Drobiazko
committed
Merge pull request #1 from elasticio/turn_on_put_requests
Turn on put requests
2 parents bd208fb + aac444f commit df48ef7

File tree

4 files changed

+46
-40
lines changed

4 files changed

+46
-40
lines changed

component.json

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,51 @@
11
{
2-
"title":"Webhook",
3-
"description" : "Webhooks allow you to collect information about events as they happen in near real-time. Provide a URL, select when and where you want that URL to receive data about events on your list, and we'll send it to you as the events take place. It is recommended that you specify a URL using https.",
4-
"triggers":{
5-
"receive":{
6-
"title":"Receive",
7-
"main":"./receive.js",
8-
"fields" : {
9-
"url" : {
10-
"viewClass" : "WebHookURLView",
11-
"label" : "WebHook URL",
12-
"required" : false
2+
"title": "Webhook",
3+
"description": "Webhooks allow you to collect information about events as they happen in near real-time. Provide a URL, select when and where you want that URL to receive data about events on your list, and we'll send it to you as the events take place. It is recommended that you specify a URL using https.",
4+
"triggers": {
5+
"receive": {
6+
"title": "Receive",
7+
"main": "./receive.js",
8+
"fields": {
9+
"url": {
10+
"viewClass": "WebHookURLView",
11+
"label": "WebHook URL",
12+
"required": false
1313
},
14-
"payload" : {
15-
"viewClass":"WebHookPayloadView",
16-
"label":"Sample data",
17-
"required" : true,
18-
"placeholder":"{ \"foo\" : \"bar\" }"
14+
"payload": {
15+
"viewClass": "WebHookPayloadView",
16+
"label": "Sample data",
17+
"required": true,
18+
"placeholder": "{ \"foo\" : \"bar\" }"
1919
}
2020
},
21-
"metadata" : {
22-
"out" : {}
21+
"metadata": {
22+
"out": {}
2323
}
2424
}
2525
},
26-
"actions" : {
27-
"post" : {
28-
"title" : "Post",
29-
"main" : "./post.js",
30-
"fields" : {
31-
"uri" : {
32-
"viewClass":"TextFieldView",
33-
"label":"URI",
34-
"required" : true
26+
"actions": {
27+
"post": {
28+
"title": "Send data",
29+
"main": "./send.js",
30+
"fields": {
31+
"method": {
32+
"viewClass": "SelectView",
33+
"label": "HTTP Verb",
34+
"prompt": "Please select",
35+
"required": true,
36+
"model": {
37+
"POST": "POST",
38+
"PUT": "PUT"
39+
}
40+
},
41+
"uri": {
42+
"viewClass": "TextFieldView",
43+
"label": "URI",
44+
"required": true
3545
},
36-
"secret" : {
37-
"viewClass":"TextFieldView",
38-
"label":"Secret",
46+
"secret": {
47+
"viewClass": "TextFieldView",
48+
"label": "Secret",
3949
"required": false
4050
}
4151
}

post.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

put.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

send.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var request = require('./request.js');
2+
var DEFAULT_METHOD = 'POST';
3+
4+
exports.process = function(msg, conf) {
5+
request.putOrPost.call(this, conf.method || DEFAULT_METHOD, msg, conf);
6+
};

0 commit comments

Comments
 (0)