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

#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) ⇒ 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
101
# File 'lib/verizon/models/device_upgrade_history.rb', line 83

def initialize(device_id = SKIP,
               id = SKIP,
                = SKIP,
               firmware_from = SKIP,
               firmware_to = SKIP,
               start_date = SKIP,
               upgrade_start_time = SKIP,
               status = SKIP,
               reason = SKIP)
  @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
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.



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

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 object from extracted values.
  DeviceUpgradeHistory.new(device_id,
                           id,
                           ,
                           firmware_from,
                           firmware_to,
                           start_date,
                           upgrade_start_time,
                           status,
                           reason)
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