Class: Verizon::CarrierInformation

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

Overview

Information about the carrier.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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_nameString

The carrier that will perform the activation. This parameter is only required if you have more than one carrier.

Returns:

  • (String)


15
16
17
# File 'lib/verizon/models/carrier_information.rb', line 15

def carrier_name
  @carrier_name
end

#service_planString

The service plan code that is assigned to the device.

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/carrier_information.rb', line 19

def service_plan
  @service_plan
end

#stateString

The device state. Valid values include: Activate, Suspend, Deactive, Pre-active.

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/verizon/models/carrier_information.rb', line 45

def self.nullables
  []
end

.optionalsObject

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