Class: Verizon::CarrierServicePlan

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/carrier_service_plan.rb

Overview

CarrierServicePlan Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(name = SKIP, code = SKIP, size_kb = SKIP, carrier_service_plan_code = SKIP) ⇒ CarrierServicePlan

Returns a new instance of CarrierServicePlan.



54
55
56
57
58
59
60
61
62
63
# File 'lib/verizon/models/carrier_service_plan.rb', line 54

def initialize(name = SKIP, code = SKIP, size_kb = SKIP,
               carrier_service_plan_code = SKIP)
  @name = name unless name == SKIP
  @code = code unless code == SKIP
  @size_kb = size_kb unless size_kb == SKIP
  unless carrier_service_plan_code == SKIP
    @carrier_service_plan_code =
      carrier_service_plan_code
  end
end

Instance Attribute Details

#carrier_service_plan_codeString

The billing record ID. This can be numeric, alpha or alphanumeric.

Returns:

  • (String)


27
28
29
# File 'lib/verizon/models/carrier_service_plan.rb', line 27

def carrier_service_plan_code
  @carrier_service_plan_code
end

#codeString

The inventory name or system name of the service plan

Returns:

  • (String)


18
19
20
# File 'lib/verizon/models/carrier_service_plan.rb', line 18

def code
  @code
end

#nameString

The name of the service plan

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/carrier_service_plan.rb', line 14

def name
  @name
end

#size_kbString

The ammount of space the service plan will occupy on the Subscriber Information Module (SIM)

Returns:

  • (String)


23
24
25
# File 'lib/verizon/models/carrier_service_plan.rb', line 23

def size_kb
  @size_kb
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/verizon/models/carrier_service_plan.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  code = hash.key?('code') ? hash['code'] : SKIP
  size_kb = hash.key?('sizeKb') ? hash['sizeKb'] : SKIP
  carrier_service_plan_code =
    hash.key?('carrierServicePlanCode') ? hash['carrierServicePlanCode'] : SKIP

  # Create object from extracted values.
  CarrierServicePlan.new(name,
                         code,
                         size_kb,
                         carrier_service_plan_code)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/verizon/models/carrier_service_plan.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['code'] = 'code'
  @_hash['size_kb'] = 'sizeKb'
  @_hash['carrier_service_plan_code'] = 'carrierServicePlanCode'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/verizon/models/carrier_service_plan.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/verizon/models/carrier_service_plan.rb', line 40

def self.optionals
  %w[
    name
    code
    size_kb
    carrier_service_plan_code
  ]
end