Class: Verizon::CarrierServicePlan
- Defined in:
- lib/verizon/models/carrier_service_plan.rb
Overview
CarrierServicePlan Model.
Instance Attribute Summary collapse
-
#carrier_service_plan_code ⇒ String
The billing record ID.
-
#code ⇒ String
The inventory name or system name of the service plan.
-
#name ⇒ String
The name of the service plan.
-
#size_kb ⇒ String
The ammount of space the service plan will occupy on the Subscriber Information Module (SIM).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(name: SKIP, code: SKIP, size_kb: SKIP, carrier_service_plan_code: SKIP, additional_properties: nil) ⇒ CarrierServicePlan
constructor
A new instance of CarrierServicePlan.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(name: SKIP, code: SKIP, size_kb: SKIP, carrier_service_plan_code: SKIP, additional_properties: nil) ⇒ CarrierServicePlan
Returns a new instance of CarrierServicePlan.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/verizon/models/carrier_service_plan.rb', line 54 def initialize(name: SKIP, code: SKIP, size_kb: SKIP, carrier_service_plan_code: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @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 @additional_properties = additional_properties end |
Instance Attribute Details
#carrier_service_plan_code ⇒ String
The billing record ID. This can be numeric, alpha or alphanumeric.
27 28 29 |
# File 'lib/verizon/models/carrier_service_plan.rb', line 27 def carrier_service_plan_code @carrier_service_plan_code end |
#code ⇒ String
The inventory name or system name of the service plan
18 19 20 |
# File 'lib/verizon/models/carrier_service_plan.rb', line 18 def code @code end |
#name ⇒ String
The name of the service plan
14 15 16 |
# File 'lib/verizon/models/carrier_service_plan.rb', line 14 def name @name end |
#size_kb ⇒ String
The ammount of space the service plan will occupy on the Subscriber Information Module (SIM)
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.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/verizon/models/carrier_service_plan.rb', line 70 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 a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. CarrierServicePlan.new(name: name, code: code, size_kb: size_kb, carrier_service_plan_code: carrier_service_plan_code, additional_properties: additional_properties) end |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/verizon/models/carrier_service_plan.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
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 |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
104 105 106 107 108 109 |
# File 'lib/verizon/models/carrier_service_plan.rb', line 104 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, code: #{@code.inspect}, size_kb:"\ " #{@size_kb.inspect}, carrier_service_plan_code: #{@carrier_service_plan_code.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
96 97 98 99 100 101 |
# File 'lib/verizon/models/carrier_service_plan.rb', line 96 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, code: #{@code}, size_kb: #{@size_kb},"\ " carrier_service_plan_code: #{@carrier_service_plan_code}, additional_properties:"\ " #{@additional_properties}>" end |