Class: Verizon::FirmwareUpgrade

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

Overview

Array of upgrade objects with the specified status.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = SKIP, account_name = SKIP, firmware_name = SKIP, firmware_to = SKIP, start_date = SKIP, status = SKIP, device_list = SKIP) ⇒ FirmwareUpgrade

Returns a new instance of FirmwareUpgrade.



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/verizon/models/firmware_upgrade.rb', line 74

def initialize(id = SKIP,  = SKIP, firmware_name = SKIP,
               firmware_to = SKIP, start_date = SKIP, status = SKIP,
               device_list = SKIP)
  @id = id unless id == SKIP
  @account_name =  unless  == SKIP
  @firmware_name = firmware_name unless firmware_name == SKIP
  @firmware_to = firmware_to unless firmware_to == SKIP
  @start_date = start_date unless start_date == SKIP
  @status = status unless status == SKIP
  @device_list = device_list unless device_list == SKIP
end

Instance Attribute Details

#account_nameString

Account identifier in “##########-#####”.

Returns:

  • (String)


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

def 
  @account_name
end

#device_listArray[FirmwareUpgradeDeviceListItem]

A JSON object for each device that was included in the upgrade, showing the device IMEI, the status of the upgrade, and additional information about the status.

Returns:



41
42
43
# File 'lib/verizon/models/firmware_upgrade.rb', line 41

def device_list
  @device_list
end

#firmware_nameString

The name of the firmware image that will be used for the upgrade.

Returns:

  • (String)


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

def firmware_name
  @firmware_name
end

#firmware_toString

The name of the firmware version that will be on the devices after a successful upgrade.

Returns:

  • (String)


27
28
29
# File 'lib/verizon/models/firmware_upgrade.rb', line 27

def firmware_to
  @firmware_to
end

#idString

The unique identifier for this upgrade.

Returns:

  • (String)


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

def id
  @id
end

#start_dateString

The intended start date for the upgrade.

Returns:

  • (String)


31
32
33
# File 'lib/verizon/models/firmware_upgrade.rb', line 31

def start_date
  @start_date
end

#statusString

The current status of the upgrade.

Returns:

  • (String)


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

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/verizon/models/firmware_upgrade.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  firmware_name = hash.key?('firmwareName') ? hash['firmwareName'] : SKIP
  firmware_to = hash.key?('firmwareTo') ? hash['firmwareTo'] : SKIP
  start_date = hash.key?('startDate') ? hash['startDate'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  # Parameter is an array, so we need to iterate through it
  device_list = nil
  unless hash['deviceList'].nil?
    device_list = []
    hash['deviceList'].each do |structure|
      device_list << (FirmwareUpgradeDeviceListItem.from_hash(structure) if structure)
    end
  end

  device_list = SKIP unless hash.key?('deviceList')

  # Create object from extracted values.
  FirmwareUpgrade.new(id,
                      ,
                      firmware_name,
                      firmware_to,
                      start_date,
                      status,
                      device_list)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/verizon/models/firmware_upgrade.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['account_name'] = 'accountName'
  @_hash['firmware_name'] = 'firmwareName'
  @_hash['firmware_to'] = 'firmwareTo'
  @_hash['start_date'] = 'startDate'
  @_hash['status'] = 'status'
  @_hash['device_list'] = 'deviceList'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/verizon/models/firmware_upgrade.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/verizon/models/firmware_upgrade.rb', line 57

def self.optionals
  %w[
    id
    account_name
    firmware_name
    firmware_to
    start_date
    status
    device_list
  ]
end