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
Auto - Additional data.
- #data=(value) ⇒ Object
-
#encoding ⇒ Object
string - HTTP encoding method.
- #encoding=(value) ⇒ Object
-
#file_as_body ⇒ Object
boolean - Send the file data as the request body?.
- #file_as_body=(value) ⇒ Object
-
#file_form_field ⇒ Object
string - Send the file data as a named parameter in the request POST body.
- #file_form_field=(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
-
#raw_body ⇒ Object
string - raw body text.
- #raw_body=(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
-
#use_dedicated_ips ⇒ Object
boolean - Use dedicated IPs for sending the webhook?.
- #use_dedicated_ips=(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.
raw_body - string - raw body text
file_as_body - boolean - Send the file data as the request body?
file_form_field - string - Send the file data as a named parameter in the request POST body
action - string - action for test body
use_dedicated_ips - boolean - Use dedicated IPs for sending the webhook?
169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/files.com/models/webhook_test.rb', line 169 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: url must be an String") if params[:url] and !params[:url].is_a?(String) raise InvalidParameterError.new("Bad parameter: method must be an String") if params[:method] and !params[:method].is_a?(String) raise InvalidParameterError.new("Bad parameter: encoding must be an String") if params[:encoding] and !params[:encoding].is_a?(String) raise InvalidParameterError.new("Bad parameter: headers must be an Hash") if params[:headers] and !params[:headers].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: body must be an Hash") if params[:body] and !params[:body].is_a?(Hash) raise InvalidParameterError.new("Bad parameter: raw_body must be an String") if params[:raw_body] and !params[:raw_body].is_a?(String) raise InvalidParameterError.new("Bad parameter: file_form_field must be an String") if params[:file_form_field] and !params[:file_form_field].is_a?(String) raise InvalidParameterError.new("Bad parameter: action must be an String") if params[:action] and !params[:action].is_a?(String) raise MissingParameterError.new("Parameter missing: url") unless params[:url] response, = Api.send_request("/webhook_tests", :post, params, ) WebhookTest.new(response.data, ) end |
Instance Method Details
#action ⇒ Object
string - action for test body
130 131 132 |
# File 'lib/files.com/models/webhook_test.rb', line 130 def action @attributes[:action] end |
#action=(value) ⇒ Object
134 135 136 |
# File 'lib/files.com/models/webhook_test.rb', line 134 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
Auto - 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 |
#file_as_body ⇒ Object
boolean - Send the file data as the request body?
112 113 114 |
# File 'lib/files.com/models/webhook_test.rb', line 112 def file_as_body @attributes[:file_as_body] end |
#file_as_body=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/webhook_test.rb', line 116 def file_as_body=(value) @attributes[:file_as_body] = value end |
#file_form_field ⇒ Object
string - Send the file data as a named parameter in the request POST body
121 122 123 |
# File 'lib/files.com/models/webhook_test.rb', line 121 def file_form_field @attributes[:file_form_field] end |
#file_form_field=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/webhook_test.rb', line 125 def file_form_field=(value) @attributes[:file_form_field] = 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 |
#raw_body ⇒ Object
string - raw body text
103 104 105 |
# File 'lib/files.com/models/webhook_test.rb', line 103 def raw_body @attributes[:raw_body] end |
#raw_body=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/webhook_test.rb', line 107 def raw_body=(value) @attributes[:raw_body] = value end |
#save ⇒ Object
147 148 149 150 151 152 153 154 155 156 |
# File 'lib/files.com/models/webhook_test.rb', line 147 def save if @attributes[:id] raise NotImplementedError.new("The WebhookTest object doesn't support updates.") else new_obj = WebhookTest.create(@attributes, @options) end @attributes = new_obj.attributes true 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 |
#use_dedicated_ips ⇒ Object
boolean - Use dedicated IPs for sending the webhook?
139 140 141 |
# File 'lib/files.com/models/webhook_test.rb', line 139 def use_dedicated_ips @attributes[:use_dedicated_ips] end |
#use_dedicated_ips=(value) ⇒ Object
143 144 145 |
# File 'lib/files.com/models/webhook_test.rb', line 143 def use_dedicated_ips=(value) @attributes[:use_dedicated_ips] = value end |