Class: Twilio::REST::Autopilot::V1::AssistantContext::WebhookInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/autopilot/v1/assistant/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

Constructor Details

#initialize(version, payload, assistant_sid: nil, sid: nil) ⇒ WebhookInstance

Initialize the WebhookInstance



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 274

def initialize(version, payload, assistant_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'url' => payload['url'],
      'account_sid' => payload['account_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'assistant_sid' => payload['assistant_sid'],
      'sid' => payload['sid'],
      'unique_name' => payload['unique_name'],
      'events' => payload['events'],
      'webhook_url' => payload['webhook_url'],
      'webhook_method' => payload['webhook_method'],
  }

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

Instance Method Details

#account_sidString



315
316
317
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 315

def 
  @properties['account_sid']
end

#assistant_sidString



333
334
335
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 333

def assistant_sid
  @properties['assistant_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



300
301
302
303
304
305
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 300

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

#date_createdTime



321
322
323
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 321

def date_created
  @properties['date_created']
end

#date_updatedTime



327
328
329
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 327

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the WebhookInstance



398
399
400
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 398

def delete
  context.delete
end

#eventsString



351
352
353
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 351

def events
  @properties['events']
end

#fetchWebhookInstance

Fetch the WebhookInstance



370
371
372
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 370

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



411
412
413
414
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 411

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

#sidString



339
340
341
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 339

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



404
405
406
407
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 404

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

#unique_nameString



345
346
347
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 345

def unique_name
  @properties['unique_name']
end

#update(unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset) ⇒ WebhookInstance

Update the WebhookInstance



386
387
388
389
390
391
392
393
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 386

def update(unique_name: :unset, events: :unset, webhook_url: :unset, webhook_method: :unset)
  context.update(
      unique_name: unique_name,
      events: events,
      webhook_url: webhook_url,
      webhook_method: webhook_method,
  )
end

#urlString



309
310
311
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 309

def url
  @properties['url']
end

#webhook_methodString



363
364
365
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 363

def webhook_method
  @properties['webhook_method']
end

#webhook_urlString



357
358
359
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb', line 357

def webhook_url
  @properties['webhook_url']
end