Class: Twilio::REST::Autopilot::V1::AssistantContext::DefaultsInstance

Inherits:
InstanceResource
  • 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, payload, assistant_sid: nil) ⇒ DefaultsInstance

Initialize the DefaultsInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • assistant_sid (String) (defaults to: nil)

    The SID of the [Assistant](www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 145

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'assistant_sid' => payload['assistant_sid'],
      'url' => payload['url'],
      'data' => payload['data'],
  }

  # Context
  @instance_context = nil
  @params = {'assistant_sid' => assistant_sid, }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



174
175
176
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 174

def 
  @properties['account_sid']
end

#assistant_sidString

Returns The SID of the Assistant that is the parent of the resource.

Returns:

  • (String)

    The SID of the Assistant that is the parent of the resource



180
181
182
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 180

def assistant_sid
  @properties['assistant_sid']
end

#contextDefaultsContext

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

Returns:



165
166
167
168
169
170
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 165

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

#dataHash

Returns The JSON string that describes the default task links.

Returns:

  • (Hash)

    The JSON string that describes the default task links



192
193
194
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 192

def data
  @properties['data']
end

#fetchDefaultsInstance

Fetch a DefaultsInstance

Returns:



199
200
201
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 199

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



221
222
223
224
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 221

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

#to_sObject

Provide a user friendly representation



214
215
216
217
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 214

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Autopilot.V1.DefaultsInstance #{values}>"
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:



208
209
210
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 208

def update(defaults: :unset)
  context.update(defaults: defaults, )
end

#urlString

Returns The absolute URL of the Defaults resource.

Returns:

  • (String)

    The absolute URL of the Defaults resource



186
187
188
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb', line 186

def url
  @properties['url']
end