Class: Verizon::CarrierInformation
- Defined in:
- lib/verizon/models/carrier_information.rb
Overview
Information about the carrier.
Instance Attribute Summary collapse
-
#carrier_name ⇒ String
The carrier that will perform the activation.
-
#service_plan ⇒ String
The service plan code that is assigned to the device.
-
#state ⇒ String
The device state.
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(carrier_name = SKIP, service_plan = SKIP, state = SKIP) ⇒ CarrierInformation
constructor
A new instance of CarrierInformation.
Methods inherited from BaseModel
Constructor Details
#initialize(carrier_name = SKIP, service_plan = SKIP, state = SKIP) ⇒ CarrierInformation
Returns a new instance of CarrierInformation.
49 50 51 52 53 |
# File 'lib/verizon/models/carrier_information.rb', line 49 def initialize(carrier_name = SKIP, service_plan = SKIP, state = SKIP) @carrier_name = carrier_name unless carrier_name == SKIP @service_plan = service_plan unless service_plan == SKIP @state = state unless state == SKIP end |
Instance Attribute Details
#carrier_name ⇒ String
The carrier that will perform the activation. This parameter is only required if you have more than one carrier.
15 16 17 |
# File 'lib/verizon/models/carrier_information.rb', line 15 def carrier_name @carrier_name end |
#service_plan ⇒ String
The service plan code that is assigned to the device.
19 20 21 |
# File 'lib/verizon/models/carrier_information.rb', line 19 def service_plan @service_plan end |
#state ⇒ String
The device state. Valid values include: Activate, Suspend, Deactive, Pre-active.
24 25 26 |
# File 'lib/verizon/models/carrier_information.rb', line 24 def state @state end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/verizon/models/carrier_information.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. carrier_name = hash.key?('carrierName') ? hash['carrierName'] : SKIP service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP state = hash.key?('state') ? hash['state'] : SKIP # Create object from extracted values. CarrierInformation.new(carrier_name, service_plan, state) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/verizon/models/carrier_information.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['carrier_name'] = 'carrierName' @_hash['service_plan'] = 'servicePlan' @_hash['state'] = 'state' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 |
# File 'lib/verizon/models/carrier_information.rb', line 45 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 41 42 |
# File 'lib/verizon/models/carrier_information.rb', line 36 def self.optionals %w[ carrier_name service_plan state ] end |