Class: Verizon::CarrierActionsRequest
- Defined in:
- lib/verizon/models/carrier_actions_request.rb
Overview
Request for a carrier action.
Instance Attribute Summary collapse
-
#account_name ⇒ String
The name of a billing account.
-
#custom_fields ⇒ Array[CustomFields]
Custom field names and values, if you want to only include devices that have matching values.
-
#devices ⇒ Array[AccountDeviceList]
The devices for which you want to restore service, specified by device identifier.
-
#group_name ⇒ String
The name of a device group, if you want to restore service for all devices in that group.
-
#service_plan ⇒ String
The name of a service plan, if you want to only include devices that have that service plan.
-
#with_billing ⇒ TrueClass | FalseClass
set to “true” to suspend with billing, set to “false” to suspend without billing.
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(account_name = SKIP, custom_fields = SKIP, devices = SKIP, with_billing = SKIP, group_name = SKIP, service_plan = SKIP) ⇒ CarrierActionsRequest
constructor
A new instance of CarrierActionsRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(account_name = SKIP, custom_fields = SKIP, devices = SKIP, with_billing = SKIP, group_name = SKIP, service_plan = SKIP) ⇒ CarrierActionsRequest
Returns a new instance of CarrierActionsRequest.
70 71 72 73 74 75 76 77 78 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 70 def initialize(account_name = SKIP, custom_fields = SKIP, devices = SKIP, with_billing = SKIP, group_name = SKIP, service_plan = SKIP) @account_name = account_name unless account_name == SKIP @custom_fields = custom_fields unless custom_fields == SKIP @devices = devices unless devices == SKIP @with_billing = with_billing unless with_billing == SKIP @group_name = group_name unless group_name == SKIP @service_plan = service_plan unless service_plan == SKIP end |
Instance Attribute Details
#account_name ⇒ String
The name of a billing account.
14 15 16 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 14 def account_name @account_name end |
#custom_fields ⇒ Array[CustomFields]
Custom field names and values, if you want to only include devices that have matching values.
19 20 21 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 19 def custom_fields @custom_fields end |
#devices ⇒ Array[AccountDeviceList]
The devices for which you want to restore service, specified by device identifier.
24 25 26 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 24 def devices @devices end |
#group_name ⇒ String
The name of a device group, if you want to restore service for all devices in that group.
34 35 36 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 34 def group_name @group_name end |
#service_plan ⇒ String
The name of a service plan, if you want to only include devices that have that service plan.
39 40 41 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 39 def service_plan @service_plan end |
#with_billing ⇒ TrueClass | FalseClass
set to “true” to suspend with billing, set to “false” to suspend without billing
29 30 31 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 29 def with_billing @with_billing end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : SKIP # 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') # 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 = SKIP unless hash.key?('devices') with_billing = hash.key?('withBilling') ? hash['withBilling'] : SKIP group_name = hash.key?('groupName') ? hash['groupName'] : SKIP service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP # Create object from extracted values. CarrierActionsRequest.new(account_name, custom_fields, devices, with_billing, group_name, service_plan) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['custom_fields'] = 'customFields' @_hash['devices'] = 'devices' @_hash['with_billing'] = 'withBilling' @_hash['group_name'] = 'groupName' @_hash['service_plan'] = 'servicePlan' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/verizon/models/carrier_actions_request.rb', line 54 def self.optionals %w[ account_name custom_fields devices with_billing group_name service_plan ] end |