Class: Verizon::CarrierDeactivateRequest

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

Overview

Request to deactivate a carrier.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_name = nil, devices = nil, reason_code = nil, custom_fields = SKIP, etf_waiver = SKIP, group_name = SKIP, service_plan = SKIP, delete_after_deactivation = SKIP) ⇒ CarrierDeactivateRequest

Returns a new instance of CarrierDeactivateRequest.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/verizon/models/carrier_deactivate_request.rb', line 82

def initialize( = nil, devices = nil, reason_code = nil,
               custom_fields = SKIP, etf_waiver = SKIP, group_name = SKIP,
               service_plan = SKIP, delete_after_deactivation = SKIP)
  @account_name = 
  @devices = devices
  @reason_code = reason_code
  @custom_fields = custom_fields unless custom_fields == SKIP
  @etf_waiver = etf_waiver unless etf_waiver == SKIP
  @group_name = group_name unless group_name == SKIP
  @service_plan = service_plan unless service_plan == SKIP
  unless delete_after_deactivation == SKIP
    @delete_after_deactivation =
      delete_after_deactivation
  end
end

Instance Attribute Details

#account_nameString

The name of a billing account.

Returns:

  • (String)


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

def 
  @account_name
end

#custom_fieldsArray[CustomFields]

Custom field names and values, if you want to only include devices that have matching values.

Returns:



29
30
31
# File 'lib/verizon/models/carrier_deactivate_request.rb', line 29

def custom_fields
  @custom_fields
end

#delete_after_deactivationTrueClass | FalseClass

The name of a service plan, if you want to only include devices that have that service plan.

Returns:

  • (TrueClass | FalseClass)


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

def delete_after_deactivation
  @delete_after_deactivation
end

#devicesArray[AccountDeviceList]

The devices for which you want to deactivate service, specified by device identifier.

Returns:



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

def devices
  @devices
end

#etf_waiverTrueClass | FalseClass

Fees may be assessed for deactivating Verizon Wireless devices, depending on the account contract. The etfWaiver parameter waives the Early Termination Fee (ETF), if applicable.

Returns:

  • (TrueClass | FalseClass)


35
36
37
# File 'lib/verizon/models/carrier_deactivate_request.rb', line 35

def etf_waiver
  @etf_waiver
end

#group_nameString

The name of a device group, if you want to deactivate all devices in that group.

Returns:

  • (String)


40
41
42
# File 'lib/verizon/models/carrier_deactivate_request.rb', line 40

def group_name
  @group_name
end

#reason_codeString

Code identifying the reason for the deactivation. Currently the only valid reason code is “FF”, which corresponds to General Admin/Maintenance.

Returns:

  • (String)


24
25
26
# File 'lib/verizon/models/carrier_deactivate_request.rb', line 24

def reason_code
  @reason_code
end

#service_planString

The name of a service plan, if you want to only include devices that have that service plan.

Returns:

  • (String)


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

def service_plan
  @service_plan
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/verizon/models/carrier_deactivate_request.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : nil
  # Parameter is an array, so we need to iterate through it
  devices = nil
  unless hash['devices'].nil?
    devices = []
    hash['devices'].each do |structure|
      devices << (AccountDeviceList.from_hash(structure) if structure)
    end
  end

  devices = nil unless hash.key?('devices')
  reason_code = hash.key?('reasonCode') ? hash['reasonCode'] : nil
  # Parameter is an array, so we need to iterate through it
  custom_fields = nil
  unless hash['customFields'].nil?
    custom_fields = []
    hash['customFields'].each do |structure|
      custom_fields << (CustomFields.from_hash(structure) if structure)
    end
  end

  custom_fields = SKIP unless hash.key?('customFields')
  etf_waiver = hash.key?('etfWaiver') ? hash['etfWaiver'] : SKIP
  group_name = hash.key?('groupName') ? hash['groupName'] : SKIP
  service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP
  delete_after_deactivation =
    hash.key?('deleteAfterDeactivation') ? hash['deleteAfterDeactivation'] : SKIP

  # Create object from extracted values.
  CarrierDeactivateRequest.new(,
                               devices,
                               reason_code,
                               custom_fields,
                               etf_waiver,
                               group_name,
                               service_plan,
                               delete_after_deactivation)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['devices'] = 'devices'
  @_hash['reason_code'] = 'reasonCode'
  @_hash['custom_fields'] = 'customFields'
  @_hash['etf_waiver'] = 'etfWaiver'
  @_hash['group_name'] = 'groupName'
  @_hash['service_plan'] = 'servicePlan'
  @_hash['delete_after_deactivation'] = 'deleteAfterDeactivation'
  @_hash
end

.nullablesObject

An array for nullable fields



78
79
80
# File 'lib/verizon/models/carrier_deactivate_request.rb', line 78

def self.nullables
  []
end

.optionalsObject

An array for optional fields



67
68
69
70
71
72
73
74
75
# File 'lib/verizon/models/carrier_deactivate_request.rb', line 67

def self.optionals
  %w[
    custom_fields
    etf_waiver
    group_name
    service_plan
    delete_after_deactivation
  ]
end