Class: Verizon::AddDevicesRequest
- Defined in:
- lib/verizon/models/add_devices_request.rb
Overview
Request to add the devices.
Instance Attribute Summary collapse
-
#account_name ⇒ String
The billing account to which the devices are added.
-
#custom_fields ⇒ Array[CustomFields]
The names and values for any custom fields that you want set for the devices as they are added to the account.
-
#devices_to_add ⇒ Array[AccountDeviceList]
The devices that you want to add.
-
#group_name ⇒ String
The name of a device group to add the devices to.
-
#sku_number ⇒ String
The Stock Keeping Unit (SKU) number of a 4G device type with an embedded SIM.
-
#smsr_oid ⇒ String
The Stock Keeping Unit (SKU) number of a 4G device type with an embedded SIM.
-
#state ⇒ String
The initial service state for the devices.
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(state = nil, devices_to_add = nil, account_name = SKIP, custom_fields = SKIP, group_name = SKIP, sku_number = SKIP, smsr_oid = SKIP) ⇒ AddDevicesRequest
constructor
A new instance of AddDevicesRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(state = nil, devices_to_add = nil, account_name = SKIP, custom_fields = SKIP, group_name = SKIP, sku_number = SKIP, smsr_oid = SKIP) ⇒ AddDevicesRequest
Returns a new instance of AddDevicesRequest.
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/verizon/models/add_devices_request.rb', line 74 def initialize(state = nil, devices_to_add = nil, account_name = SKIP, custom_fields = SKIP, group_name = SKIP, sku_number = SKIP, smsr_oid = SKIP) @state = state @devices_to_add = devices_to_add @account_name = account_name unless account_name == SKIP @custom_fields = custom_fields unless custom_fields == SKIP @group_name = group_name unless group_name == SKIP @sku_number = sku_number unless sku_number == SKIP @smsr_oid = smsr_oid unless smsr_oid == SKIP end |
Instance Attribute Details
#account_name ⇒ String
The billing account to which the devices are added.
23 24 25 |
# File 'lib/verizon/models/add_devices_request.rb', line 23 def account_name @account_name end |
#custom_fields ⇒ Array[CustomFields]
The names and values for any custom fields that you want set for the devices as they are added to the account.
28 29 30 |
# File 'lib/verizon/models/add_devices_request.rb', line 28 def custom_fields @custom_fields end |
#devices_to_add ⇒ Array[AccountDeviceList]
The devices that you want to add.
19 20 21 |
# File 'lib/verizon/models/add_devices_request.rb', line 19 def devices_to_add @devices_to_add end |
#group_name ⇒ String
The name of a device group to add the devices to. They are added to the default device group if you don’t include this parameter.
33 34 35 |
# File 'lib/verizon/models/add_devices_request.rb', line 33 def group_name @group_name end |
#sku_number ⇒ String
The Stock Keeping Unit (SKU) number of a 4G device type with an embedded SIM.
38 39 40 |
# File 'lib/verizon/models/add_devices_request.rb', line 38 def sku_number @sku_number end |
#smsr_oid ⇒ String
The Stock Keeping Unit (SKU) number of a 4G device type with an embedded SIM.
43 44 45 |
# File 'lib/verizon/models/add_devices_request.rb', line 43 def smsr_oid @smsr_oid end |
#state ⇒ String
The initial service state for the devices. The only valid state is “Preactive.”
15 16 17 |
# File 'lib/verizon/models/add_devices_request.rb', line 15 def state @state end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 118 119 120 121 122 123 124 125 |
# File 'lib/verizon/models/add_devices_request.rb', line 87 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. state = hash.key?('state') ? hash['state'] : nil # Parameter is an array, so we need to iterate through it devices_to_add = nil unless hash['devicesToAdd'].nil? devices_to_add = [] hash['devicesToAdd'].each do |structure| devices_to_add << (AccountDeviceList.from_hash(structure) if structure) end end devices_to_add = nil unless hash.key?('devicesToAdd') 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') group_name = hash.key?('groupName') ? hash['groupName'] : SKIP sku_number = hash.key?('skuNumber') ? hash['skuNumber'] : SKIP smsr_oid = hash.key?('smsrOid') ? hash['smsrOid'] : SKIP # Create object from extracted values. AddDevicesRequest.new(state, devices_to_add, account_name, custom_fields, group_name, sku_number, smsr_oid) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/verizon/models/add_devices_request.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['state'] = 'state' @_hash['devices_to_add'] = 'devicesToAdd' @_hash['account_name'] = 'accountName' @_hash['custom_fields'] = 'customFields' @_hash['group_name'] = 'groupName' @_hash['sku_number'] = 'skuNumber' @_hash['smsr_oid'] = 'smsrOid' @_hash end |
.nullables ⇒ Object
An array for nullable fields
70 71 72 |
# File 'lib/verizon/models/add_devices_request.rb', line 70 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 65 66 67 |
# File 'lib/verizon/models/add_devices_request.rb', line 59 def self.optionals %w[ account_name custom_fields group_name sku_number smsr_oid ] end |