Class: Twilio::REST::Api::V2010::AccountContext::ShortCodeInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/short_code.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, sid: nil) ⇒ ShortCodeInstance

Initialize the ShortCodeInstance



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 276

def initialize(version, payload , account_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'api_version' => payload['api_version'],
        'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
        'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
        'friendly_name' => payload['friendly_name'],
        'short_code' => payload['short_code'],
        'sid' => payload['sid'],
        'sms_fallback_method' => payload['sms_fallback_method'],
        'sms_fallback_url' => payload['sms_fallback_url'],
        'sms_method' => payload['sms_method'],
        'sms_url' => payload['sms_url'],
        'uri' => payload['uri'],
    }

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

Instance Method Details

#account_sidString



313
314
315
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 313

def 
    @properties['account_sid']
end

#api_versionString



319
320
321
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 319

def api_version
    @properties['api_version']
end

#contextShortCodeContext

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



304
305
306
307
308
309
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 304

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

#date_createdTime



325
326
327
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 325

def date_created
    @properties['date_created']
end

#date_updatedTime



331
332
333
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 331

def date_updated
    @properties['date_updated']
end

#fetchShortCodeInstance

Fetch the ShortCodeInstance



386
387
388
389
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 386

def fetch

    context.fetch
end

#friendly_nameString



337
338
339
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 337

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



428
429
430
431
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 428

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

#short_codeString



343
344
345
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 343

def short_code
    @properties['short_code']
end

#sidString



349
350
351
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 349

def sid
    @properties['sid']
end

#sms_fallback_methodString



355
356
357
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 355

def sms_fallback_method
    @properties['sms_fallback_method']
end

#sms_fallback_urlString



361
362
363
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 361

def sms_fallback_url
    @properties['sms_fallback_url']
end

#sms_methodString



367
368
369
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 367

def sms_method
    @properties['sms_method']
end

#sms_urlString



373
374
375
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 373

def sms_url
    @properties['sms_url']
end

#to_sObject

Provide a user friendly representation



421
422
423
424
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 421

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

#update(friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset) ⇒ ShortCodeInstance

Update the ShortCodeInstance



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 400

def update(
    friendly_name: :unset, 
    api_version: :unset, 
    sms_url: :unset, 
    sms_method: :unset, 
    sms_fallback_url: :unset, 
    sms_fallback_method: :unset
)

    context.update(
        friendly_name: friendly_name, 
        api_version: api_version, 
        sms_url: sms_url, 
        sms_method: sms_method, 
        sms_fallback_url: sms_fallback_url, 
        sms_fallback_method: sms_fallback_method, 
    )
end

#uriString



379
380
381
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 379

def uri
    @properties['uri']
end