Class: Twilio::REST::Preview::Wireless::RatePlanInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the RatePlanInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 311

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'unique_name' => payload['unique_name'],
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'data_enabled' => payload['data_enabled'],
        'data_metering' => payload['data_metering'],
        'data_limit' => payload['data_limit'] == nil ? payload['data_limit'] : payload['data_limit'].to_i,
        'messaging_enabled' => payload['messaging_enabled'],
        'voice_enabled' => payload['voice_enabled'],
        'national_roaming_enabled' => payload['national_roaming_enabled'],
        'international_roaming' => payload['international_roaming'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns:

  • (String)


362
363
364
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 362

def 
    @properties['account_sid']
end

#contextRatePlanContext

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

Returns:



341
342
343
344
345
346
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 341

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

#data_enabledBoolean

Returns:

  • (Boolean)


374
375
376
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 374

def data_enabled
    @properties['data_enabled']
end

#data_limitString

Returns:

  • (String)


386
387
388
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 386

def data_limit
    @properties['data_limit']
end

#data_meteringString

Returns:

  • (String)


380
381
382
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 380

def data_metering
    @properties['data_metering']
end

#date_createdTime

Returns:

  • (Time)


416
417
418
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 416

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns:

  • (Time)


422
423
424
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 422

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the RatePlanInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



435
436
437
438
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 435

def delete

    context.delete
end

#fetchRatePlanInstance

Fetch the RatePlanInstance

Returns:



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

def fetch

    context.fetch
end

#friendly_nameString

Returns:

  • (String)


368
369
370
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 368

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#international_roamingArray<String>

Returns:

  • (Array<String>)


410
411
412
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 410

def international_roaming
    @properties['international_roaming']
end

#messaging_enabledBoolean

Returns:

  • (Boolean)


392
393
394
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 392

def messaging_enabled
    @properties['messaging_enabled']
end

#national_roaming_enabledBoolean

Returns:

  • (Boolean)


404
405
406
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 404

def national_roaming_enabled
    @properties['national_roaming_enabled']
end

#sidString

Returns:

  • (String)


350
351
352
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 350

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#unique_nameString

Returns:

  • (String)


356
357
358
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 356

def unique_name
    @properties['unique_name']
end

#update(unique_name: :unset, friendly_name: :unset) ⇒ RatePlanInstance

Update the RatePlanInstance

Parameters:

  • unique_name (String) (defaults to: :unset)
  • friendly_name (String) (defaults to: :unset)

Returns:



453
454
455
456
457
458
459
460
461
462
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 453

def update(
    unique_name: :unset, 
    friendly_name: :unset
)

    context.update(
        unique_name: unique_name, 
        friendly_name: friendly_name, 
    )
end

#urlString

Returns:

  • (String)


428
429
430
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 428

def url
    @properties['url']
end

#voice_enabledBoolean

Returns:

  • (Boolean)


398
399
400
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 398

def voice_enabled
    @properties['voice_enabled']
end