Class: Verizon::V2AccountDevice

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

Overview

Account 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, fota_eligible = nil, app_fota_eligible = nil, license_assigned = nil, distribution_type = nil, software_list = nil, create_time = SKIP, upgrade_time = SKIP, update_time = SKIP, refresh_time = SKIP) ⇒ V2AccountDevice

Returns a new instance of V2AccountDevice.



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
# File 'lib/verizon/models/v2_account_device.rb', line 98

def initialize(device_id = nil,
               mdn = nil,
               model = nil,
               make = nil,
               fota_eligible = nil,
               app_fota_eligible = nil,
               license_assigned = nil,
               distribution_type = nil,
               software_list = nil,
               create_time = SKIP,
               upgrade_time = SKIP,
               update_time = SKIP,
               refresh_time = SKIP)
  @device_id = device_id
  @mdn = mdn
  @model = model
  @make = make
  @fota_eligible = fota_eligible
  @app_fota_eligible = app_fota_eligible
  @license_assigned = license_assigned
  @distribution_type = distribution_type
  @software_list = software_list
  @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

#app_fota_eligibleTrueClass | FalseClass

Device application FOTA capable.

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/verizon/models/v2_account_device.rb', line 34

def app_fota_eligible
  @app_fota_eligible
end

#create_timeString

The date and time of when the device is created.

Returns:

  • (String)


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

def create_time
  @create_time
end

#device_idString

Device identifier.

Returns:

  • (String)


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

def device_id
  @device_id
end

#distribution_typeString

LWM2M, OMD-DM or HTTP.

Returns:

  • (String)


42
43
44
# File 'lib/verizon/models/v2_account_device.rb', line 42

def distribution_type
  @distribution_type
end

#fota_eligibleTrueClass | FalseClass

Device FOTA capable.

Returns:

  • (TrueClass | FalseClass)


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

def fota_eligible
  @fota_eligible
end

#license_assignedTrueClass | FalseClass

License assigned device.

Returns:

  • (TrueClass | FalseClass)


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

def license_assigned
  @license_assigned
end

#makeString

Device make.

Returns:

  • (String)


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

def make
  @make
end

#mdnString

MDN.

Returns:

  • (String)


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

def mdn
  @mdn
end

#modelString

Device model.

Returns:

  • (String)


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

def model
  @model
end

#refresh_timeString

The date and time of when the device is refreshed.

Returns:

  • (String)


62
63
64
# File 'lib/verizon/models/v2_account_device.rb', line 62

def refresh_time
  @refresh_time
end

#software_listArray[V2SoftwareInfo]

List of sofware.

Returns:



46
47
48
# File 'lib/verizon/models/v2_account_device.rb', line 46

def software_list
  @software_list
end

#update_timeString

The date and time of when the device is updated.

Returns:

  • (String)


58
59
60
# File 'lib/verizon/models/v2_account_device.rb', line 58

def update_time
  @update_time
end

#upgrade_timeString

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

Returns:

  • (String)


54
55
56
# File 'lib/verizon/models/v2_account_device.rb', line 54

def upgrade_time
  @upgrade_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



127
128
129
130
131
132
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
# File 'lib/verizon/models/v2_account_device.rb', line 127

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
  fota_eligible = hash.key?('fotaEligible') ? hash['fotaEligible'] : nil
  app_fota_eligible =
    hash.key?('appFotaEligible') ? hash['appFotaEligible'] : nil
  license_assigned =
    hash.key?('licenseAssigned') ? hash['licenseAssigned'] : nil
  distribution_type =
    hash.key?('distributionType') ? hash['distributionType'] : 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 << (V2SoftwareInfo.from_hash(structure) if structure)
    end
  end

  software_list = nil unless hash.key?('softwareList')
  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.
  V2AccountDevice.new(device_id,
                      mdn,
                      model,
                      make,
                      fota_eligible,
                      app_fota_eligible,
                      license_assigned,
                      distribution_type,
                      software_list,
                      create_time,
                      upgrade_time,
                      update_time,
                      refresh_time)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/verizon/models/v2_account_device.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'deviceId'
  @_hash['mdn'] = 'mdn'
  @_hash['model'] = 'model'
  @_hash['make'] = 'make'
  @_hash['fota_eligible'] = 'fotaEligible'
  @_hash['app_fota_eligible'] = 'appFotaEligible'
  @_hash['license_assigned'] = 'licenseAssigned'
  @_hash['distribution_type'] = 'distributionType'
  @_hash['software_list'] = 'softwareList'
  @_hash['create_time'] = 'createTime'
  @_hash['upgrade_time'] = 'upgradeTime'
  @_hash['update_time'] = 'updateTime'
  @_hash['refresh_time'] = 'refreshTime'
  @_hash
end

.nullablesObject

An array for nullable fields



94
95
96
# File 'lib/verizon/models/v2_account_device.rb', line 94

def self.nullables
  []
end

.optionalsObject

An array for optional fields



84
85
86
87
88
89
90
91
# File 'lib/verizon/models/v2_account_device.rb', line 84

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