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

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/preview/wireless/rate_plan.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, sid: nil) ⇒ RatePlanInstance

Initialize the RatePlanInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The sid


247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 247

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'].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 The account_sid.

Returns:

  • (String)

    The account_sid


298
299
300
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 298

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:


277
278
279
280
281
282
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 277

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

#data_enabledBoolean

Returns The data_enabled.

Returns:

  • (Boolean)

    The data_enabled


310
311
312
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 310

def data_enabled
  @properties['data_enabled']
end

#data_limitString

Returns The data_limit.

Returns:

  • (String)

    The data_limit


322
323
324
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 322

def data_limit
  @properties['data_limit']
end

#data_meteringString

Returns The data_metering.

Returns:

  • (String)

    The data_metering


316
317
318
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 316

def data_metering
  @properties['data_metering']
end

#date_createdTime

Returns The date_created.

Returns:

  • (Time)

    The date_created


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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated


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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the RatePlanInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


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

def delete
  context.delete
end

#fetchRatePlanInstance

Fetch the RatePlanInstance

Returns:


371
372
373
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 371

def fetch
  context.fetch
end

#friendly_nameString

Returns The friendly_name.

Returns:

  • (String)

    The friendly_name


304
305
306
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 304

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation


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

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

#international_roamingArray[String]

Returns The international_roaming.

Returns:

  • (Array[String])

    The international_roaming


346
347
348
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 346

def international_roaming
  @properties['international_roaming']
end

#messaging_enabledBoolean

Returns The messaging_enabled.

Returns:

  • (Boolean)

    The messaging_enabled


328
329
330
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 328

def messaging_enabled
  @properties['messaging_enabled']
end

#national_roaming_enabledBoolean

Returns The national_roaming_enabled.

Returns:

  • (Boolean)

    The national_roaming_enabled


340
341
342
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 340

def national_roaming_enabled
  @properties['national_roaming_enabled']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid


286
287
288
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 286

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


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

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

#unique_nameString

Returns The unique_name.

Returns:

  • (String)

    The unique_name


292
293
294
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 292

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)

    The unique_name

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

    The friendly_name

Returns:


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

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

#urlString

Returns The url.

Returns:

  • (String)

    The url


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

def url
  @properties['url']
end

#voice_enabledBoolean

Returns The voice_enabled.

Returns:

  • (Boolean)

    The voice_enabled


334
335
336
# File 'lib/twilio-ruby/rest/preview/wireless/rate_plan.rb', line 334

def voice_enabled
  @properties['voice_enabled']
end