Class: Twilio::REST::Autopilot::V1::AssistantContext::DefaultsContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.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, assistant_sid) ⇒ DefaultsContext

Initialize the DefaultsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assistant_sid (String)

    The SID of the Assistant that is the parent of the resource to fetch.


79
80
81
82
83
84
85
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 79

def initialize(version, assistant_sid)
  super(version)

  # Path Solution
  @solution = {assistant_sid: assistant_sid, }
  @uri = "/Assistants/#{@solution[:assistant_sid]}/Defaults"
end

Instance Method Details

#fetchDefaultsInstance

Fetch the DefaultsInstance

Returns:


90
91
92
93
94
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 90

def fetch
  payload = @version.fetch('GET', @uri)

  DefaultsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
end

#inspectObject

Provide a detailed, user friendly representation


118
119
120
121
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 118

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Autopilot.V1.DefaultsContext #{context}>"
end

#to_sObject

Provide a user friendly representation


111
112
113
114
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 111

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Autopilot.V1.DefaultsContext #{context}>"
end

#update(defaults: :unset) ⇒ DefaultsInstance

Update the DefaultsInstance

Parameters:

  • defaults (Hash) (defaults to: :unset)

    A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations.

Returns:


101
102
103
104
105
106
107
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 101

def update(defaults: :unset)
  data = Twilio::Values.of({'Defaults' => Twilio.serialize_object(defaults), })

  payload = @version.update('POST', @uri, data: data)

  DefaultsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], )
end