Class: Twilio::REST::Autopilot::V1::AssistantContext::StyleSheetInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, assistant_sid: nil) ⇒ StyleSheetInstance

Initialize the StyleSheetInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this StyleSheet resource.

  • sid (String)

    The SID of the Call resource to fetch.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 148

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  || @properties['assistant_sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the StyleSheet resource.

Returns:



177
178
179
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 177

def 
    @properties['account_sid']
end

#assistant_sidString

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

Returns:



183
184
185
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 183

def assistant_sid
    @properties['assistant_sid']
end

#contextStyleSheetContext

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

Returns:



168
169
170
171
172
173
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 168

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

#dataHash

Returns The JSON string that describes the style sheet object.

Returns:

  • (Hash)

    The JSON string that describes the style sheet object.



195
196
197
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 195

def data
    @properties['data']
end

#fetchStyleSheetInstance

Fetch the StyleSheetInstance

Returns:



202
203
204
205
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 202

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



229
230
231
232
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 229

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

#to_sObject

Provide a user friendly representation



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

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

#update(style_sheet: :unset) ⇒ StyleSheetInstance

Update the StyleSheetInstance

Parameters:

  • style_sheet (Object) (defaults to: :unset)

    The JSON string that describes the style sheet object.

Returns:



211
212
213
214
215
216
217
218
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 211

def update(
    style_sheet: :unset
)

    context.update(
        style_sheet: style_sheet, 
    )
end

#urlString

Returns The absolute URL of the StyleSheet resource.

Returns:

  • (String)

    The absolute URL of the StyleSheet resource.



189
190
191
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb', line 189

def url
    @properties['url']
end