Class: Verizon::V3AccountDevice

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

Overview

Device information.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(device_id = nil, mdn = nil, model = nil, make = nil, firmware = nil, fota_eligible = nil, status = nil, license_assigned = nil, protocol = nil, software_list = nil, file_list = SKIP, create_time = SKIP, upgrade_time = SKIP, update_time = SKIP, refresh_time = SKIP) ⇒ V3AccountDevice

Returns a new instance of V3AccountDevice.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/verizon/models/v3_account_device.rb', line 110

def initialize(device_id = nil, mdn = nil, model = nil, make = nil,
               firmware = nil, fota_eligible = nil, status = nil,
               license_assigned = nil, protocol = nil, software_list = nil,
               file_list = SKIP, create_time = SKIP, upgrade_time = SKIP,
               update_time = SKIP, refresh_time = SKIP)
  @device_id = device_id
  @mdn = mdn
  @model = model
  @make = make
  @firmware = firmware
  @fota_eligible = fota_eligible
  @status = status
  @license_assigned = license_assigned
  @protocol = protocol
  @software_list = software_list
  @file_list = file_list unless file_list == SKIP
  @create_time = create_time unless create_time == SKIP
  @upgrade_time = upgrade_time unless upgrade_time == SKIP
  @update_time = update_time unless update_time == SKIP
  @refresh_time = refresh_time unless refresh_time == SKIP
end

Instance Attribute Details

#create_timeString

The date and time of when the device is created.

Returns:

  • (String)


59
60
61
# File 'lib/verizon/models/v3_account_device.rb', line 59

def create_time
  @create_time
end

#device_idString

Device identifier.

Returns:

  • (String)


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

def device_id
  @device_id
end

#file_listArray[V3SoftwareInfo]

List of files.

Returns:



55
56
57
# File 'lib/verizon/models/v3_account_device.rb', line 55

def file_list
  @file_list
end

#firmwareString

Device firmware version.

Returns:

  • (String)


30
31
32
# File 'lib/verizon/models/v3_account_device.rb', line 30

def firmware
  @firmware
end

#fota_eligibleTrueClass | FalseClass

Value=true if the device software can be upgraded over the air using the Software Management Services API.

Returns:

  • (TrueClass | FalseClass)


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

def fota_eligible
  @fota_eligible
end

#license_assignedTrueClass | FalseClass

License assigned device.

Returns:

  • (TrueClass | FalseClass)


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

def license_assigned
  @license_assigned
end

#makeString

Device make.

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/v3_account_device.rb', line 26

def make
  @make
end

#mdnString

MDN.

Returns:

  • (String)


18
19
20
# File 'lib/verizon/models/v3_account_device.rb', line 18

def mdn
  @mdn
end

#modelString

Device model.

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/v3_account_device.rb', line 22

def model
  @model
end

#protocolString

Firmware protocol. Valid values include: LWM2M, OMADM, HTTP or NONE.

Returns:

  • (String)


47
48
49
# File 'lib/verizon/models/v3_account_device.rb', line 47

def protocol
  @protocol
end

#refresh_timeString

The date and time of when the device is refreshed.

Returns:

  • (String)


71
72
73
# File 'lib/verizon/models/v3_account_device.rb', line 71

def refresh_time
  @refresh_time
end

#software_listArray[V3SoftwareInfo]

List of sofware.

Returns:



51
52
53
# File 'lib/verizon/models/v3_account_device.rb', line 51

def software_list
  @software_list
end

#statusString

Device status.

Returns:

  • (String)


39
40
41
# File 'lib/verizon/models/v3_account_device.rb', line 39

def status
  @status
end

#update_timeString

The date and time of when the device is updated.

Returns:

  • (String)


67
68
69
# File 'lib/verizon/models/v3_account_device.rb', line 67

def update_time
  @update_time
end

#upgrade_timeString

The date and time of when the device firmware or software is updated.

Returns:

  • (String)


63
64
65
# File 'lib/verizon/models/v3_account_device.rb', line 63

def upgrade_time
  @upgrade_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/verizon/models/v3_account_device.rb', line 133

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('deviceId') ? hash['deviceId'] : nil
  mdn = hash.key?('mdn') ? hash['mdn'] : nil
  model = hash.key?('model') ? hash['model'] : nil
  make = hash.key?('make') ? hash['make'] : nil
  firmware = hash.key?('firmware') ? hash['firmware'] : nil
  fota_eligible = hash.key?('fotaEligible') ? hash['fotaEligible'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  license_assigned =
    hash.key?('licenseAssigned') ? hash['licenseAssigned'] : nil
  protocol = hash.key?('protocol') ? hash['protocol'] : nil
  # Parameter is an array, so we need to iterate through it
  software_list = nil
  unless hash['softwareList'].nil?
    software_list = []
    hash['softwareList'].each do |structure|
      software_list << (V3SoftwareInfo.from_hash(structure) if structure)
    end
  end

  software_list = nil unless hash.key?('softwareList')
  # Parameter is an array, so we need to iterate through it
  file_list = nil
  unless hash['fileList'].nil?
    file_list = []
    hash['fileList'].each do |structure|
      file_list << (V3SoftwareInfo.from_hash(structure) if structure)
    end
  end

  file_list = SKIP unless hash.key?('fileList')
  create_time = hash.key?('createTime') ? hash['createTime'] : SKIP
  upgrade_time = hash.key?('upgradeTime') ? hash['upgradeTime'] : SKIP
  update_time = hash.key?('updateTime') ? hash['updateTime'] : SKIP
  refresh_time = hash.key?('refreshTime') ? hash['refreshTime'] : SKIP

  # Create object from extracted values.
  V3AccountDevice.new(device_id,
                      mdn,
                      model,
                      make,
                      firmware,
                      fota_eligible,
                      status,
                      license_assigned,
                      protocol,
                      software_list,
                      file_list,
                      create_time,
                      upgrade_time,
                      update_time,
                      refresh_time)
end

.namesObject

A mapping from model property names to API property names.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/verizon/models/v3_account_device.rb', line 74

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'deviceId'
  @_hash['mdn'] = 'mdn'
  @_hash['model'] = 'model'
  @_hash['make'] = 'make'
  @_hash['firmware'] = 'firmware'
  @_hash['fota_eligible'] = 'fotaEligible'
  @_hash['status'] = 'status'
  @_hash['license_assigned'] = 'licenseAssigned'
  @_hash['protocol'] = 'protocol'
  @_hash['software_list'] = 'softwareList'
  @_hash['file_list'] = 'fileList'
  @_hash['create_time'] = 'createTime'
  @_hash['upgrade_time'] = 'upgradeTime'
  @_hash['update_time'] = 'updateTime'
  @_hash['refresh_time'] = 'refreshTime'
  @_hash
end

.nullablesObject

An array for nullable fields



106
107
108
# File 'lib/verizon/models/v3_account_device.rb', line 106

def self.nullables
  []
end

.optionalsObject

An array for optional fields



95
96
97
98
99
100
101
102
103
# File 'lib/verizon/models/v3_account_device.rb', line 95

def self.optionals
  %w[
    file_list
    create_time
    upgrade_time
    update_time
    refresh_time
  ]
end