Class: Files::WebhookTest
- Inherits:
-
Object
- Object
- Files::WebhookTest
- Defined in:
- lib/files.com/models/webhook_test.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.create(params = {}, options = {}) ⇒ Object
Parameters: url (required) - string - URL for testing the webhook.
Instance Method Summary collapse
-
#action ⇒ Object
string - action for test body.
- #action=(value) ⇒ Object
-
#body ⇒ Object
object - Additional body parameters.
- #body=(value) ⇒ Object
-
#code ⇒ Object
int64 - Status HTTP code.
- #code=(value) ⇒ Object
-
#data ⇒ Object
Additional data.
- #data=(value) ⇒ Object
-
#encoding ⇒ Object
string - HTTP encoding method.
- #encoding=(value) ⇒ Object
-
#headers ⇒ Object
object - Additional request headers.
- #headers=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ WebhookTest
constructor
A new instance of WebhookTest.
-
#message ⇒ Object
string - Error message.
- #message=(value) ⇒ Object
-
#method ⇒ Object
string - HTTP method(GET or POST).
- #method=(value) ⇒ Object
- #save ⇒ Object
-
#status ⇒ Object
string - Status message.
- #status=(value) ⇒ Object
-
#success ⇒ Object
boolean - The success status of the webhook test.
- #success=(value) ⇒ Object
-
#url ⇒ Object
string - URL for testing the webhook.
- #url=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ WebhookTest
Returns a new instance of WebhookTest.
7 8 9 10 |
# File 'lib/files.com/models/webhook_test.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/webhook_test.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/webhook_test.rb', line 5 def @options end |
Class Method Details
.create(params = {}, options = {}) ⇒ Object
Parameters:
url (required) - string - URL for testing the webhook.
method - string - HTTP method(GET or POST).
encoding - string - HTTP encoding method. Can be JSON, XML, or RAW (form data).
headers - object - Additional request headers.
body - object - Additional body parameters.
action - string - action for test body
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/files.com/models/webhook_test.rb', line 127 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: url must be an String") if params.dig(:url) and !params.dig(:url).is_a?(String) raise InvalidParameterError.new("Bad parameter: method must be an String") if params.dig(:method) and !params.dig(:method).is_a?(String) raise InvalidParameterError.new("Bad parameter: encoding must be an String") if params.dig(:encoding) and !params.dig(:encoding).is_a?(String) raise InvalidParameterError.new("Bad parameter: headers must be an Hash") if params.dig(:headers) and !params.dig(:headers).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: body must be an Hash") if params.dig(:body) and !params.dig(:body).is_a?(Hash) raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String) raise MissingParameterError.new("Parameter missing: url") unless params.dig(:url) response, = Api.send_request("/webhook_tests", :post, params, ) WebhookTest.new(response.data, ) end |
Instance Method Details
#action ⇒ Object
string - action for test body
103 104 105 |
# File 'lib/files.com/models/webhook_test.rb', line 103 def action @attributes[:action] end |
#action=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/webhook_test.rb', line 107 def action=(value) @attributes[:action] = value end |
#body ⇒ Object
object - Additional body parameters.
94 95 96 |
# File 'lib/files.com/models/webhook_test.rb', line 94 def body @attributes[:body] end |
#body=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/webhook_test.rb', line 98 def body=(value) @attributes[:body] = value end |
#code ⇒ Object
int64 - Status HTTP code
13 14 15 |
# File 'lib/files.com/models/webhook_test.rb', line 13 def code @attributes[:code] end |
#code=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/webhook_test.rb', line 17 def code=(value) @attributes[:code] = value end |
#data ⇒ Object
Additional data
40 41 42 |
# File 'lib/files.com/models/webhook_test.rb', line 40 def data @attributes[:data] end |
#data=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/webhook_test.rb', line 44 def data=(value) @attributes[:data] = value end |
#encoding ⇒ Object
string - HTTP encoding method. Can be JSON, XML, or RAW (form data).
76 77 78 |
# File 'lib/files.com/models/webhook_test.rb', line 76 def encoding @attributes[:encoding] end |
#encoding=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/webhook_test.rb', line 80 def encoding=(value) @attributes[:encoding] = value end |
#headers ⇒ Object
object - Additional request headers.
85 86 87 |
# File 'lib/files.com/models/webhook_test.rb', line 85 def headers @attributes[:headers] end |
#headers=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/webhook_test.rb', line 89 def headers=(value) @attributes[:headers] = value end |
#message ⇒ Object
string - Error message
22 23 24 |
# File 'lib/files.com/models/webhook_test.rb', line 22 def @attributes[:message] end |
#message=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/webhook_test.rb', line 26 def (value) @attributes[:message] = value end |
#method ⇒ Object
string - HTTP method(GET or POST).
67 68 69 |
# File 'lib/files.com/models/webhook_test.rb', line 67 def method @attributes[:method] end |
#method=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/webhook_test.rb', line 71 def method=(value) @attributes[:method] = value end |
#save ⇒ Object
111 112 113 114 115 116 117 118 |
# File 'lib/files.com/models/webhook_test.rb', line 111 def save if @attributes[:id] raise NotImplementedError.new("The WebhookTest object doesn't support updates.") else new_obj = WebhookTest.create(@attributes, @options) @attributes = new_obj.attributes end end |
#status ⇒ Object
string - Status message
31 32 33 |
# File 'lib/files.com/models/webhook_test.rb', line 31 def status @attributes[:status] end |
#status=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/webhook_test.rb', line 35 def status=(value) @attributes[:status] = value end |
#success ⇒ Object
boolean - The success status of the webhook test
49 50 51 |
# File 'lib/files.com/models/webhook_test.rb', line 49 def success @attributes[:success] end |
#success=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/webhook_test.rb', line 53 def success=(value) @attributes[:success] = value end |
#url ⇒ Object
string - URL for testing the webhook.
58 59 60 |
# File 'lib/files.com/models/webhook_test.rb', line 58 def url @attributes[:url] end |
#url=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/webhook_test.rb', line 62 def url=(value) @attributes[:url] = value end |