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

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(device_id:, campaign_id:, account_name:, start_date:, status:, reason:, firmware_name: SKIP, firmware_from: SKIP, firmware_to: SKIP, report_updated_time: SKIP, additional_properties: nil) ⇒ DeviceFirmwareUpgrade

Returns a new instance of DeviceFirmwareUpgrade.



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

def initialize(device_id:, campaign_id:, account_name:, start_date:,
               status:, reason:, firmware_name: SKIP, firmware_from: SKIP,
               firmware_to: SKIP, report_updated_time: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @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
  @additional_properties = additional_properties
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.



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

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 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.
  DeviceFirmwareUpgrade.new(device_id: device_id,
                            campaign_id: campaign_id,
                            account_name: ,
                            start_date: start_date,
                            status: status,
                            reason: reason,
                            firmware_name: firmware_name,
                            firmware_from: firmware_from,
                            firmware_to: firmware_to,
                            report_updated_time: report_updated_time,
                            additional_properties: additional_properties)
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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



152
153
154
155
156
157
158
159
160
# File 'lib/verizon/models/device_firmware_upgrade.rb', line 152

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

#to_sObject

Provides a human-readable string representation of the object.



142
143
144
145
146
147
148
149
# File 'lib/verizon/models/device_firmware_upgrade.rb', line 142

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