Class: Twilio::REST::Preview::Wireless::SimInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/preview/wireless/sim.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ SimInstance

Initialize the SimInstance

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 Sim resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 330

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'unique_name' => payload['unique_name'],
        'account_sid' => payload['account_sid'],
        'rate_plan_sid' => payload['rate_plan_sid'],
        'friendly_name' => payload['friendly_name'],
        'iccid' => payload['iccid'],
        'e_id' => payload['e_id'],
        'status' => payload['status'],
        'commands_callback_url' => payload['commands_callback_url'],
        'commands_callback_method' => payload['commands_callback_method'],
        'sms_fallback_method' => payload['sms_fallback_method'],
        'sms_fallback_url' => payload['sms_fallback_url'],
        'sms_method' => payload['sms_method'],
        'sms_url' => payload['sms_url'],
        'voice_fallback_method' => payload['voice_fallback_method'],
        'voice_fallback_url' => payload['voice_fallback_url'],
        'voice_method' => payload['voice_method'],
        'voice_url' => payload['voice_url'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
        'links' => payload['links'],
    }

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

Instance Method Details

#account_sidString

Returns:

  • (String)


389
390
391
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 389

def 
    @properties['account_sid']
end

#commands_callback_methodString

Returns:

  • (String)


431
432
433
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 431

def commands_callback_method
    @properties['commands_callback_method']
end

#commands_callback_urlString

Returns:

  • (String)


425
426
427
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 425

def commands_callback_url
    @properties['commands_callback_url']
end

#contextSimContext

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

Returns:

  • (SimContext)

    CallContext for this CallInstance



368
369
370
371
372
373
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 368

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

#date_createdTime

Returns:

  • (Time)


485
486
487
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 485

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns:

  • (Time)


491
492
493
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 491

def date_updated
    @properties['date_updated']
end

#e_idString

Returns:

  • (String)


413
414
415
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 413

def e_id
    @properties['e_id']
end

#fetchSimInstance

Fetch the SimInstance

Returns:



510
511
512
513
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 510

def fetch

    context.fetch
end

#friendly_nameString

Returns:

  • (String)


401
402
403
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 401

def friendly_name
    @properties['friendly_name']
end

#iccidString

Returns:

  • (String)


407
408
409
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 407

def iccid
    @properties['iccid']
end

#inspectObject

Provide a detailed, user friendly representation



589
590
591
592
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 589

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

Returns:

  • (Hash)


503
504
505
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 503

def links
    @properties['links']
end

#rate_plan_sidString

Returns:

  • (String)


395
396
397
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 395

def rate_plan_sid
    @properties['rate_plan_sid']
end

#sidString

Returns:

  • (String)


377
378
379
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 377

def sid
    @properties['sid']
end

#sms_fallback_methodString

Returns:

  • (String)


437
438
439
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 437

def sms_fallback_method
    @properties['sms_fallback_method']
end

#sms_fallback_urlString

Returns:

  • (String)


443
444
445
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 443

def sms_fallback_url
    @properties['sms_fallback_url']
end

#sms_methodString

Returns:

  • (String)


449
450
451
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 449

def sms_method
    @properties['sms_method']
end

#sms_urlString

Returns:

  • (String)


455
456
457
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 455

def sms_url
    @properties['sms_url']
end

#statusString

Returns:

  • (String)


419
420
421
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 419

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



582
583
584
585
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 582

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

#unique_nameString

Returns:

  • (String)


383
384
385
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 383

def unique_name
    @properties['unique_name']
end

#update(unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset) ⇒ SimInstance

Update the SimInstance

Parameters:

  • unique_name (String) (defaults to: :unset)
  • callback_method (String) (defaults to: :unset)
  • callback_url (String) (defaults to: :unset)
  • friendly_name (String) (defaults to: :unset)
  • rate_plan (String) (defaults to: :unset)
  • status (String) (defaults to: :unset)
  • commands_callback_method (String) (defaults to: :unset)
  • commands_callback_url (String) (defaults to: :unset)
  • sms_fallback_method (String) (defaults to: :unset)
  • sms_fallback_url (String) (defaults to: :unset)
  • sms_method (String) (defaults to: :unset)
  • sms_url (String) (defaults to: :unset)
  • voice_fallback_method (String) (defaults to: :unset)
  • voice_fallback_url (String) (defaults to: :unset)
  • voice_method (String) (defaults to: :unset)
  • voice_url (String) (defaults to: :unset)

Returns:



534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 534

def update(
    unique_name: :unset, 
    callback_method: :unset, 
    callback_url: :unset, 
    friendly_name: :unset, 
    rate_plan: :unset, 
    status: :unset, 
    commands_callback_method: :unset, 
    commands_callback_url: :unset, 
    sms_fallback_method: :unset, 
    sms_fallback_url: :unset, 
    sms_method: :unset, 
    sms_url: :unset, 
    voice_fallback_method: :unset, 
    voice_fallback_url: :unset, 
    voice_method: :unset, 
    voice_url: :unset
)

    context.update(
        unique_name: unique_name, 
        callback_method: callback_method, 
        callback_url: callback_url, 
        friendly_name: friendly_name, 
        rate_plan: rate_plan, 
        status: status, 
        commands_callback_method: commands_callback_method, 
        commands_callback_url: commands_callback_url, 
        sms_fallback_method: sms_fallback_method, 
        sms_fallback_url: sms_fallback_url, 
        sms_method: sms_method, 
        sms_url: sms_url, 
        voice_fallback_method: voice_fallback_method, 
        voice_fallback_url: voice_fallback_url, 
        voice_method: voice_method, 
        voice_url: voice_url, 
    )
end

#urlString

Returns:

  • (String)


497
498
499
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 497

def url
    @properties['url']
end

#usageusage

Access the usage

Returns:



576
577
578
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 576

def usage
    context.usage
end

#voice_fallback_methodString

Returns:

  • (String)


461
462
463
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 461

def voice_fallback_method
    @properties['voice_fallback_method']
end

#voice_fallback_urlString

Returns:

  • (String)


467
468
469
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 467

def voice_fallback_url
    @properties['voice_fallback_url']
end

#voice_methodString

Returns:

  • (String)


473
474
475
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 473

def voice_method
    @properties['voice_method']
end

#voice_urlString

Returns:

  • (String)


479
480
481
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 479

def voice_url
    @properties['voice_url']
end