Class: Verizon::DeviceFirmwareUpgrade

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

Overview

Firmware upgrades 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 = nil, campaign_id = nil, account_name = nil, start_date = nil, status = nil, reason = nil, firmware_name = SKIP, firmware_from = SKIP, firmware_to = SKIP, report_updated_time = SKIP) ⇒ DeviceFirmwareUpgrade

Returns a new instance of DeviceFirmwareUpgrade.



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

def initialize(device_id = nil, campaign_id = nil,  = nil,
               start_date = nil, status = nil, reason = nil,
               firmware_name = SKIP, firmware_from = SKIP,
               firmware_to = SKIP, report_updated_time = SKIP)
  @device_id = device_id
  @campaign_id = campaign_id
  @account_name = 
  @firmware_name = firmware_name unless firmware_name == SKIP
  @firmware_from = firmware_from unless firmware_from == SKIP
  @firmware_to = firmware_to unless firmware_to == SKIP
  @start_date = start_date
  @status = status
  @reason = reason
  @report_updated_time = report_updated_time unless report_updated_time == SKIP
end

Instance Attribute Details

#account_nameString

Account identifier.

Returns:

  • (String)


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

def 
  @account_name
end

#campaign_idString

Campaign identifier.

Returns:

  • (String)


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

def campaign_id
  @campaign_id
end

#device_idString

Device identifier.

Returns:

  • (String)


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

def device_id
  @device_id
end

#firmware_fromString

Old firmware version.

Returns:

  • (String)


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

def firmware_from
  @firmware_from
end

#firmware_nameString

Firmware name.

Returns:

  • (String)


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

def firmware_name
  @firmware_name
end

#firmware_toString

New firmware version.

Returns:

  • (String)


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

def firmware_to
  @firmware_to
end

#reasonString

Software upgrade result reason.

Returns:

  • (String)


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

def reason
  @reason
end

#report_updated_timeString

Report updated time.

Returns:

  • (String)


50
51
52
# File 'lib/verizon/models/device_firmware_upgrade.rb', line 50

def report_updated_time
  @report_updated_time
end

#start_dateDate

Firmware upgrade start date.

Returns:

  • (Date)


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

def start_date
  @start_date
end

#statusString

Firmware upgrade status.

Returns:

  • (String)


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

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('deviceId') ? hash['deviceId'] : nil
  campaign_id = hash.key?('campaignId') ? hash['campaignId'] : nil
   = hash.key?('accountName') ? hash['accountName'] : nil
  start_date = hash.key?('startDate') ? hash['startDate'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  reason = hash.key?('reason') ? hash['reason'] : nil
  firmware_name = hash.key?('firmwareName') ? hash['firmwareName'] : SKIP
  firmware_from = hash.key?('firmwareFrom') ? hash['firmwareFrom'] : SKIP
  firmware_to = hash.key?('firmwareTo') ? hash['firmwareTo'] : SKIP
  report_updated_time =
    hash.key?('reportUpdatedTime') ? hash['reportUpdatedTime'] : SKIP

  # Create object from extracted values.
  DeviceFirmwareUpgrade.new(device_id,
                            campaign_id,
                            ,
                            start_date,
                            status,
                            reason,
                            firmware_name,
                            firmware_from,
                            firmware_to,
                            report_updated_time)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'deviceId'
  @_hash['campaign_id'] = 'campaignId'
  @_hash['account_name'] = 'accountName'
  @_hash['firmware_name'] = 'firmwareName'
  @_hash['firmware_from'] = 'firmwareFrom'
  @_hash['firmware_to'] = 'firmwareTo'
  @_hash['start_date'] = 'startDate'
  @_hash['status'] = 'status'
  @_hash['reason'] = 'reason'
  @_hash['report_updated_time'] = 'reportUpdatedTime'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



69
70
71
72
73
74
75
76
# File 'lib/verizon/models/device_firmware_upgrade.rb', line 69

def self.optionals
  %w[
    firmware_name
    firmware_from
    firmware_to
    report_updated_time
  ]
end