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 unique id of the Account responsible for this session.
-
#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 retries in case of post-event webhook request failures.
-
#post_webhook_url ⇒ String
The absolute url the post-event webhook request should be sent to.
-
#pre_webhook_retry_count ⇒ String
The number of retries in case of pre-event webhook request failures.
-
#pre_webhook_url ⇒ String
The absolute url the pre-event webhook request should be sent to.
-
#service_sid ⇒ String
The unique id of the Chat Service this session belongs to.
-
#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
An absolute URL for this webhook.
-
#webhook_filters ⇒ String
The list of webhook event triggers that are enabled for this Service.
-
#webhook_method ⇒ String
The HTTP method to be used when sending a webhook request.
Constructor Details
#initialize(version, payload) ⇒ WebhookInstance
Initialize the WebhookInstance
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 157 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 unique id of the Account responsible for this session.
192 193 194 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 192 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
183 184 185 186 187 188 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 183 def context unless @instance_context @instance_context = WebhookContext.new(@version, ) end @instance_context end |
#fetch ⇒ WebhookInstance
Fetch a WebhookInstance
253 254 255 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 253 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
297 298 299 300 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 297 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 retries in case of post-event webhook request failures.
234 235 236 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 234 def post_webhook_retry_count @properties['post_webhook_retry_count'] end |
#post_webhook_url ⇒ String
Returns The absolute url the post-event webhook request should be sent to.
222 223 224 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 222 def post_webhook_url @properties['post_webhook_url'] end |
#pre_webhook_retry_count ⇒ String
Returns The number of retries in case of pre-event webhook request failures.
228 229 230 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 228 def pre_webhook_retry_count @properties['pre_webhook_retry_count'] end |
#pre_webhook_url ⇒ String
Returns The absolute url the pre-event webhook request should be sent to.
216 217 218 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 216 def pre_webhook_url @properties['pre_webhook_url'] end |
#service_sid ⇒ String
Returns The unique id of the Chat Service this session belongs to.
198 199 200 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 198 def service_sid @properties['service_sid'] end |
#target ⇒ webhook.Target
Returns The routing target of the webhook.
240 241 242 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 240 def target @properties['target'] end |
#to_s ⇒ Object
Provide a user friendly representation
290 291 292 293 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 290 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
276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 276 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 An absolute URL for this webhook.
246 247 248 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 246 def url @properties['url'] end |
#webhook_filters ⇒ String
Returns The list of webhook event triggers that are enabled for this Service.
210 211 212 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 210 def webhook_filters @properties['webhook_filters'] end |
#webhook_method ⇒ String
Returns The HTTP method to be used when sending a webhook request.
204 205 206 |
# File 'lib/twilio-ruby/rest/messaging/v1/webhook.rb', line 204 def webhook_method @properties['webhook_method'] end |