Class: Twilio::REST::Conversations::V1::ServiceContext::ConfigurationContext::WebhookInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, chat_service_sid: nil) ⇒ WebhookInstance

Initialize the WebhookInstance



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 345

def initialize(version, payload , chat_service_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'chat_service_sid' => payload['chat_service_sid'],
        'pre_webhook_url' => payload['pre_webhook_url'],
        'post_webhook_url' => payload['post_webhook_url'],
        'filters' => payload['filters'],
        'method' => payload['method'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'chat_service_sid' => chat_service_sid  || @properties['chat_service_sid']  , }
end

Instance Method Details

#account_sidString



378
379
380
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 378

def 
    @properties['account_sid']
end

#chat_service_sidString



384
385
386
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 384

def chat_service_sid
    @properties['chat_service_sid']
end

#contextWebhookContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context



369
370
371
372
373
374
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 369

def context
    unless @instance_context
        @instance_context = WebhookContext.new(@version , @params['chat_service_sid'])
    end
    @instance_context
end

#fetchWebhookInstance

Fetch the WebhookInstance



421
422
423
424
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 421

def fetch

    context.fetch
end

#filtersArray<String>



402
403
404
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 402

def filters
    @properties['filters']
end

#inspectObject

Provide a detailed, user friendly representation



457
458
459
460
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 457

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Conversations.V1.WebhookInstance #{values}>"
end

#methodMethod



408
409
410
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 408

def method
    @properties['method']
end

#post_webhook_urlString



396
397
398
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 396

def post_webhook_url
    @properties['post_webhook_url']
end

#pre_webhook_urlString



390
391
392
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 390

def pre_webhook_url
    @properties['pre_webhook_url']
end

#to_sObject

Provide a user friendly representation



450
451
452
453
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 450

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Conversations.V1.WebhookInstance #{values}>"
end

#update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset) ⇒ WebhookInstance

Update the WebhookInstance



433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 433

def update(
    pre_webhook_url: :unset, 
    post_webhook_url: :unset, 
    filters: :unset, 
    method: :unset
)

    context.update(
        pre_webhook_url: pre_webhook_url, 
        post_webhook_url: post_webhook_url, 
        filters: filters, 
        method: method, 
    )
end

#urlString



414
415
416
# File 'lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb', line 414

def url
    @properties['url']
end