Class: Verizon::DeviceListQueryItem

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

Overview

The list of devices in the account.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(device_id: SKIP, mdn: SKIP, model: SKIP, make: SKIP, firmware: SKIP, fota_eligible: SKIP, license_assigned: SKIP, upgrade_time: SKIP, additional_properties: nil) ⇒ DeviceListQueryItem

Returns a new instance of DeviceListQueryItem.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/verizon/models/device_list_query_item.rb', line 79

def initialize(device_id: SKIP, mdn: SKIP, model: SKIP, make: SKIP,
               firmware: SKIP, fota_eligible: SKIP, license_assigned: SKIP,
               upgrade_time: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @device_id = device_id unless device_id == SKIP
  @mdn = mdn unless mdn == SKIP
  @model = model unless model == SKIP
  @make = make unless make == SKIP
  @firmware = firmware unless firmware == SKIP
  @fota_eligible = fota_eligible unless fota_eligible == SKIP
  @license_assigned = license_assigned unless license_assigned == SKIP
  @upgrade_time = upgrade_time unless upgrade_time == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#device_idString

Device IMEI.

Returns:

  • (String)


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

def device_id
  @device_id
end

#firmwareString

The name of the firmware image currently installed on the device.

Returns:

  • (String)


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

def firmware
  @firmware
end

#fota_eligibleTrueClass | FalseClass

True if the device firmware can be upgraded over the air using the Software Management Services API.

Returns:

  • (TrueClass | FalseClass)


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

def fota_eligible
  @fota_eligible
end

#license_assignedTrueClass | FalseClass

True if an MRC license has been assigned to this device.

Returns:

  • (TrueClass | FalseClass)


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

def license_assigned
  @license_assigned
end

#makeString

The device make.

Returns:

  • (String)


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

def make
  @make
end

#mdnString

The MDN (phone number) of the device.

Returns:

  • (String)


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

def mdn
  @mdn
end

#modelString

The device model name.

Returns:

  • (String)


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

def model
  @model
end

#upgrade_timeString

The date and time that the device firmware was last upgraded. If a device has never been upgraded, the upgradeTime will be 01/01/1900 0:0:0.

Returns:

  • (String)


44
45
46
# File 'lib/verizon/models/device_list_query_item.rb', line 44

def upgrade_time
  @upgrade_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
126
127
128
# File 'lib/verizon/models/device_list_query_item.rb', line 97

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('deviceId') ? hash['deviceId'] : SKIP
  mdn = hash.key?('mdn') ? hash['mdn'] : SKIP
  model = hash.key?('model') ? hash['model'] : SKIP
  make = hash.key?('make') ? hash['make'] : SKIP
  firmware = hash.key?('firmware') ? hash['firmware'] : SKIP
  fota_eligible = hash.key?('fotaEligible') ? hash['fotaEligible'] : SKIP
  license_assigned =
    hash.key?('licenseAssigned') ? hash['licenseAssigned'] : SKIP
  upgrade_time = hash.key?('upgradeTime') ? hash['upgradeTime'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  DeviceListQueryItem.new(device_id: device_id,
                          mdn: mdn,
                          model: model,
                          make: make,
                          firmware: firmware,
                          fota_eligible: fota_eligible,
                          license_assigned: license_assigned,
                          upgrade_time: upgrade_time,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/verizon/models/device_list_query_item.rb', line 47

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['license_assigned'] = 'licenseAssigned'
  @_hash['upgrade_time'] = 'upgradeTime'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/verizon/models/device_list_query_item.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/verizon/models/device_list_query_item.rb', line 61

def self.optionals
  %w[
    device_id
    mdn
    model
    make
    firmware
    fota_eligible
    license_assigned
    upgrade_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



140
141
142
143
144
145
146
# File 'lib/verizon/models/device_list_query_item.rb', line 140

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id.inspect}, mdn: #{@mdn.inspect}, model:"\
  " #{@model.inspect}, make: #{@make.inspect}, firmware: #{@firmware.inspect}, fota_eligible:"\
  " #{@fota_eligible.inspect}, license_assigned: #{@license_assigned.inspect}, upgrade_time:"\
  " #{@upgrade_time.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



131
132
133
134
135
136
137
# File 'lib/verizon/models/device_list_query_item.rb', line 131

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id}, mdn: #{@mdn}, model: #{@model}, make: #{@make},"\
  " firmware: #{@firmware}, fota_eligible: #{@fota_eligible}, license_assigned:"\
  " #{@license_assigned}, upgrade_time: #{@upgrade_time}, additional_properties:"\
  " #{@additional_properties}>"
end