Class: Verizon::AddDevicesRequest

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

Overview

Request to add the devices.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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,  = SKIP,
               custom_fields = SKIP, group_name = SKIP, sku_number = SKIP,
               smsr_oid = SKIP)
  @state = state
  @devices_to_add = devices_to_add
  @account_name =  unless  == 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_nameString

The billing account to which the devices are added.

Returns:

  • (String)


23
24
25
# File 'lib/verizon/models/add_devices_request.rb', line 23

def 
  @account_name
end

#custom_fieldsArray[CustomFields]

The names and values for any custom fields that you want set for the devices as they are added to the account.

Returns:



28
29
30
# File 'lib/verizon/models/add_devices_request.rb', line 28

def custom_fields
  @custom_fields
end

#devices_to_addArray[AccountDeviceList]

The devices that you want to add.

Returns:



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

def devices_to_add
  @devices_to_add
end

#group_nameString

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.

Returns:

  • (String)


33
34
35
# File 'lib/verizon/models/add_devices_request.rb', line 33

def group_name
  @group_name
end

#sku_numberString

The Stock Keeping Unit (SKU) number of a 4G device type with an embedded SIM.

Returns:

  • (String)


38
39
40
# File 'lib/verizon/models/add_devices_request.rb', line 38

def sku_number
  @sku_number
end

#smsr_oidString

The Stock Keeping Unit (SKU) number of a 4G device type with an embedded SIM.

Returns:

  • (String)


43
44
45
# File 'lib/verizon/models/add_devices_request.rb', line 43

def smsr_oid
  @smsr_oid
end

#stateString

The initial service state for the devices. The only valid state is “Preactive.”

Returns:

  • (String)


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')
   = 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,
                        ,
                        custom_fields,
                        group_name,
                        sku_number,
                        smsr_oid)
end

.namesObject

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

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/verizon/models/add_devices_request.rb', line 70

def self.nullables
  []
end

.optionalsObject

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