Class: Verizon::DeviceUpgradeHistory

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

Overview

Firmware upgrade information.

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, id: SKIP, account_name: SKIP, firmware_from: SKIP, firmware_to: SKIP, start_date: SKIP, upgrade_start_time: SKIP, status: SKIP, reason: SKIP, additional_properties: nil) ⇒ DeviceUpgradeHistory

Returns a new instance of DeviceUpgradeHistory.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/verizon/models/device_upgrade_history.rb', line 83

def initialize(device_id: SKIP, id: SKIP, account_name: SKIP,
               firmware_from: SKIP, firmware_to: SKIP, start_date: SKIP,
               upgrade_start_time: SKIP, status: SKIP, reason: 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
  @id = id unless id == SKIP
  @account_name =  unless  == SKIP
  @firmware_from = firmware_from unless firmware_from == SKIP
  @firmware_to = firmware_to unless firmware_to == SKIP
  @start_date = start_date unless start_date == SKIP
  @upgrade_start_time = upgrade_start_time unless upgrade_start_time == SKIP
  @status = status unless status == SKIP
  @reason = reason unless reason == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_nameString

The name (number) of the billing account that the device belongs to.

Returns:

  • (String)


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

def 
  @account_name
end

#device_idString

Device IMEI.

Returns:

  • (String)


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

def device_id
  @device_id
end

#firmware_fromString

The firmware version that was on the device before the upgrade.

Returns:

  • (String)


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

def firmware_from
  @firmware_from
end

#firmware_toString

The name of the firmware version that was on the device after the upgrade.

Returns:

  • (String)


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

def firmware_to
  @firmware_to
end

#idString

The unique identifier for the upgrade.

Returns:

  • (String)


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

def id
  @id
end

#reasonString

More information about the status.

Returns:

  • (String)


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

def reason
  @reason
end

#start_dateString

The date of the upgrade.

Returns:

  • (String)


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

def start_date
  @start_date
end

#statusString

The status of the upgrade for this device.

Returns:

  • (String)


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

def status
  @status
end

#upgrade_start_timeString

The date and time that the upgrade actually started for this device.

Returns:

  • (String)


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

def upgrade_start_time
  @upgrade_start_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
129
130
131
132
133
134
135
136
# File 'lib/verizon/models/device_upgrade_history.rb', line 103

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('deviceId') ? hash['deviceId'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  firmware_from = hash.key?('firmwareFrom') ? hash['firmwareFrom'] : SKIP
  firmware_to = hash.key?('firmwareTo') ? hash['firmwareTo'] : SKIP
  start_date = hash.key?('startDate') ? hash['startDate'] : SKIP
  upgrade_start_time =
    hash.key?('upgradeStartTime') ? hash['upgradeStartTime'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  reason = hash.key?('reason') ? hash['reason'] : 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.
  DeviceUpgradeHistory.new(device_id: device_id,
                           id: id,
                           account_name: ,
                           firmware_from: firmware_from,
                           firmware_to: firmware_to,
                           start_date: start_date,
                           upgrade_start_time: upgrade_start_time,
                           status: status,
                           reason: reason,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/verizon/models/device_upgrade_history.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'deviceId'
  @_hash['id'] = 'id'
  @_hash['account_name'] = 'accountName'
  @_hash['firmware_from'] = 'firmwareFrom'
  @_hash['firmware_to'] = 'firmwareTo'
  @_hash['start_date'] = 'startDate'
  @_hash['upgrade_start_time'] = 'upgradeStartTime'
  @_hash['status'] = 'status'
  @_hash['reason'] = 'reason'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/verizon/models/device_upgrade_history.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/verizon/models/device_upgrade_history.rb', line 64

def self.optionals
  %w[
    device_id
    id
    account_name
    firmware_from
    firmware_to
    start_date
    upgrade_start_time
    status
    reason
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



148
149
150
151
152
153
154
155
# File 'lib/verizon/models/device_upgrade_history.rb', line 148

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id.inspect}, id: #{@id.inspect}, account_name:"\
  " #{@account_name.inspect}, firmware_from: #{@firmware_from.inspect}, firmware_to:"\
  " #{@firmware_to.inspect}, start_date: #{@start_date.inspect}, upgrade_start_time:"\
  " #{@upgrade_start_time.inspect}, status: #{@status.inspect}, reason: #{@reason.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id}, id: #{@id}, account_name: #{@account_name},"\
  " firmware_from: #{@firmware_from}, firmware_to: #{@firmware_to}, start_date:"\
  " #{@start_date}, upgrade_start_time: #{@upgrade_start_time}, status: #{@status}, reason:"\
  " #{@reason}, additional_properties: #{@additional_properties}>"
end