Class: Verizon::FirmwareUpgradeRequest

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

Overview

Details of the firmware upgrade request.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_name = nil, firmware_name = nil, firmware_to = nil, start_date = nil, device_list = nil) ⇒ FirmwareUpgradeRequest

Returns a new instance of FirmwareUpgradeRequest.



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

def initialize( = nil,
               firmware_name = nil,
               firmware_to = nil,
               start_date = nil,
               device_list = nil)
  @account_name = 
  @firmware_name = firmware_name
  @firmware_to = firmware_to
  @start_date = start_date
  @device_list = device_list
end

Instance Attribute Details

#account_nameString

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

Returns:

  • (String)


15
16
17
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 15

def 
  @account_name
end

#device_listArray[String]

The IMEIs of the devices.

Returns:

  • (Array[String])


33
34
35
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 33

def device_list
  @device_list
end

#firmware_nameString

The name of the firmware image that will be used for the upgrade, from a GET /firmware response.

Returns:

  • (String)


20
21
22
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 20

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)


25
26
27
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 25

def firmware_to
  @firmware_to
end

#start_dateDateTime

The date that the upgrade should begin.

Returns:

  • (DateTime)


29
30
31
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 29

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : nil
  firmware_name = hash.key?('firmwareName') ? hash['firmwareName'] : nil
  firmware_to = hash.key?('firmwareTo') ? hash['firmwareTo'] : nil
  start_date = if hash.key?('startDate')
                 (DateTimeHelper.from_rfc3339(hash['startDate']) if hash['startDate'])
               end
  device_list = hash.key?('deviceList') ? hash['deviceList'] : nil

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

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
44
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 36

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

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 47

def self.optionals
  []
end

Instance Method Details

#to_custom_start_dateObject



89
90
91
# File 'lib/verizon/models/firmware_upgrade_request.rb', line 89

def to_custom_start_date
  DateTimeHelper.to_rfc3339(start_date)
end