Class: Twilio::REST::Messaging::V1::WebhookInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Messaging::V1::WebhookInstance
- Defined in:
- lib/twilio-ruby/rest/messaging/v1/webhook.rb
Overview
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the Account that created the resource.
-
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#fetch ⇒ WebhookInstance
Fetch a WebhookInstance.
-
#initialize(version, payload) ⇒ WebhookInstance
constructor
Initialize the WebhookInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#post_webhook_retry_count ⇒ String
The number of times to try the post-event webhook request if the first attempt fails.
-
#post_webhook_url ⇒ String
The absolute URL of the post-event webhook.
-
#pre_webhook_retry_count ⇒ String
The number of times to try the pre-event webhook request if the first attempt fails.
-
#pre_webhook_url ⇒ String
The absolute URL of the pre-event webhook.
-
#service_sid ⇒ String
The SID of the Chat Service that the resource is associated with.
-
#target ⇒ webhook.Target
The routing target of the webhook.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(webhook_method: :unset, webhook_filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset, target: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
-
#url ⇒ String
The absolute URL of the webhook.
-
#webhook_filters ⇒ String
The list of webhook event triggers that are enabled for the Service.
-
#webhook_method ⇒ String
The HTTP method to use when sending a webhook request.
Constructor Details
#initialize(version, payload) ⇒ WebhookInstance
Initialize the WebhookInstance
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 154 def initialize(version, payload) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'service_sid' => payload['service_sid'], 'webhook_method' => payload['webhook_method'], 'webhook_filters' => payload['webhook_filters'], 'pre_webhook_url' => payload['pre_webhook_url'], 'post_webhook_url' => payload['post_webhook_url'], 'pre_webhook_retry_count' => payload['pre_webhook_retry_count'].to_i, 'post_webhook_retry_count' => payload['post_webhook_retry_count'].to_i, 'target' => payload['target'], 'url' => payload['url'], } # Context @instance_context = nil @params = {} end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the Account that created the resource.
189 190 191 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 189 def account_sid @properties['account_sid'] end |
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
180 181 182 183 184 185 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 180 def context unless @instance_context @instance_context = WebhookContext.new(@version, ) end @instance_context end |
#fetch ⇒ WebhookInstance
Fetch a WebhookInstance
250 251 252 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 250 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
291 292 293 294 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 291 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Messaging.V1.WebhookInstance #{values}>" end |
#post_webhook_retry_count ⇒ String
Returns The number of times to try the post-event webhook request if the first attempt fails.
231 232 233 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 231 def post_webhook_retry_count @properties['post_webhook_retry_count'] end |
#post_webhook_url ⇒ String
Returns The absolute URL of the post-event webhook.
219 220 221 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 219 def post_webhook_url @properties['post_webhook_url'] end |
#pre_webhook_retry_count ⇒ String
Returns The number of times to try the pre-event webhook request if the first attempt fails.
225 226 227 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 225 def pre_webhook_retry_count @properties['pre_webhook_retry_count'] end |
#pre_webhook_url ⇒ String
Returns The absolute URL of the pre-event webhook.
213 214 215 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 213 def pre_webhook_url @properties['pre_webhook_url'] end |
#service_sid ⇒ String
Returns The SID of the Chat Service that the resource is associated with.
195 196 197 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 195 def service_sid @properties['service_sid'] end |
#target ⇒ webhook.Target
Returns The routing target of the webhook.
237 238 239 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 237 def target @properties['target'] end |
#to_s ⇒ Object
Provide a user friendly representation
284 285 286 287 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 284 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Messaging.V1.WebhookInstance #{values}>" end |
#update(webhook_method: :unset, webhook_filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset, target: :unset) ⇒ WebhookInstance
Update the WebhookInstance
270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 270 def update(webhook_method: :unset, webhook_filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, pre_webhook_retry_count: :unset, post_webhook_retry_count: :unset, target: :unset) context.update( webhook_method: webhook_method, webhook_filters: webhook_filters, pre_webhook_url: pre_webhook_url, post_webhook_url: post_webhook_url, pre_webhook_retry_count: pre_webhook_retry_count, post_webhook_retry_count: post_webhook_retry_count, target: target, ) end |
#url ⇒ String
Returns The absolute URL of the webhook.
243 244 245 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 243 def url @properties['url'] end |
#webhook_filters ⇒ String
Returns The list of webhook event triggers that are enabled for the Service.
207 208 209 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 207 def webhook_filters @properties['webhook_filters'] end |
#webhook_method ⇒ String
Returns The HTTP method to use when sending a webhook request.
201 202 203 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 201 def webhook_method @properties['webhook_method'] end |