Class: Twilio::REST::Chat::V2::ServiceContext::ChannelContext::WebhookInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Chat::V2::ServiceContext::ChannelContext::WebhookInstance
- Defined in:
- lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Channel Webhook resource.
-
#channel_sid ⇒ String
The SID of the [Channel](www.twilio.com/docs/chat/channels) the Channel Webhook resource belongs to.
-
#configuration ⇒ Hash
The JSON string that describes how the channel webhook is configured.
-
#context ⇒ WebhookContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#date_updated ⇒ Time
The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#delete ⇒ Boolean
Delete the WebhookInstance.
-
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance.
-
#initialize(version, payload, service_sid: nil, channel_sid: nil, sid: nil) ⇒ WebhookInstance
constructor
Initialize the WebhookInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#service_sid ⇒ String
The SID of the [Service](www.twilio.com/docs/chat/rest/service-resource) the Channel Webhook resource is associated with.
-
#sid ⇒ String
The unique string that we created to identify the Channel Webhook resource.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#type ⇒ String
The type of webhook.
-
#update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset) ⇒ WebhookInstance
Update the WebhookInstance.
-
#url ⇒ String
The absolute URL of the Channel Webhook resource.
Constructor Details
#initialize(version, payload, service_sid: nil, channel_sid: nil, sid: nil) ⇒ WebhookInstance
Initialize the WebhookInstance
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 300 def initialize(version, payload , service_sid: nil, channel_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'account_sid' => payload['account_sid'], 'service_sid' => payload['service_sid'], 'channel_sid' => payload['channel_sid'], 'type' => payload['type'], 'url' => payload['url'], 'configuration' => payload['configuration'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), } # Context @instance_context = nil @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'channel_sid' => channel_sid || @properties['channel_sid'] ,'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Channel Webhook resource.
340 341 342 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 340 def account_sid @properties['account_sid'] end |
#channel_sid ⇒ String
Returns The SID of the [Channel](www.twilio.com/docs/chat/channels) the Channel Webhook resource belongs to.
352 353 354 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 352 def channel_sid @properties['channel_sid'] end |
#configuration ⇒ Hash
Returns The JSON string that describes how the channel webhook is configured. The configuration object contains the ‘url`, `method`, `filters`, and `retry_count` values that are configured by the create and update actions.
370 371 372 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 370 def configuration @properties['configuration'] 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
325 326 327 328 329 330 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 325 def context unless @instance_context @instance_context = WebhookContext.new(@version , @params['service_sid'], @params['channel_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
376 377 378 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 376 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
382 383 384 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 382 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the WebhookInstance
389 390 391 392 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 389 def delete context.delete end |
#fetch ⇒ WebhookInstance
Fetch the WebhookInstance
397 398 399 400 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 397 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
439 440 441 442 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 439 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Chat.V2.WebhookInstance #{values}>" end |
#service_sid ⇒ String
Returns The SID of the [Service](www.twilio.com/docs/chat/rest/service-resource) the Channel Webhook resource is associated with.
346 347 348 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 346 def service_sid @properties['service_sid'] end |
#sid ⇒ String
Returns The unique string that we created to identify the Channel Webhook resource.
334 335 336 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 334 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
432 433 434 435 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 432 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Chat.V2.WebhookInstance #{values}>" end |
#type ⇒ String
Returns The type of webhook. Can be: ‘webhook`, `studio`, or `trigger`.
358 359 360 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 358 def type @properties['type'] end |
#update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset) ⇒ WebhookInstance
Update the WebhookInstance
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 411 def update( configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset, configuration_retry_count: :unset ) context.update( configuration_url: configuration_url, configuration_method: configuration_method, configuration_filters: configuration_filters, configuration_triggers: configuration_triggers, configuration_flow_sid: configuration_flow_sid, configuration_retry_count: configuration_retry_count, ) end |
#url ⇒ String
Returns The absolute URL of the Channel Webhook resource.
364 365 366 |
# File 'lib/twilio-ruby/rest/chat/v2/service/channel/webhook.rb', line 364 def url @properties['url'] end |