Class: Verizon::Firmware
- Defined in:
- lib/verizon/models/firmware.rb
Overview
Firmware information.
Instance Attribute Summary collapse
-
#firmware_name ⇒ String
The name of the firmware image, provided by the device manufacturer.
-
#from_version ⇒ String
The firmware version that must currently be on the device to upgrade.
-
#launch_date ⇒ DateTime
The release date of the firmware image.
-
#make ⇒ String
The device make that the firmware applies to.
-
#model ⇒ String
The device model that the firmware applies to.
-
#participant_name ⇒ String
Internal reference; can be ignored.
-
#release_note ⇒ String
Additional information about the release.
-
#to_version ⇒ String
The firmware version that will be on the device after an upgrade.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(firmware_name = SKIP, participant_name = SKIP, launch_date = SKIP, release_note = SKIP, model = SKIP, make = SKIP, from_version = SKIP, to_version = SKIP) ⇒ Firmware
constructor
A new instance of Firmware.
- #to_custom_launch_date ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(firmware_name = SKIP, participant_name = SKIP, launch_date = SKIP, release_note = SKIP, model = SKIP, make = SKIP, from_version = SKIP, to_version = SKIP) ⇒ Firmware
Returns a new instance of Firmware.
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/verizon/models/firmware.rb', line 78 def initialize(firmware_name = SKIP, participant_name = SKIP, launch_date = SKIP, release_note = SKIP, model = SKIP, make = SKIP, from_version = SKIP, to_version = SKIP) @firmware_name = firmware_name unless firmware_name == SKIP @participant_name = participant_name unless participant_name == SKIP @launch_date = launch_date unless launch_date == SKIP @release_note = release_note unless release_note == SKIP @model = model unless model == SKIP @make = make unless make == SKIP @from_version = from_version unless from_version == SKIP @to_version = to_version unless to_version == SKIP end |
Instance Attribute Details
#firmware_name ⇒ String
The name of the firmware image, provided by the device manufacturer.
15 16 17 |
# File 'lib/verizon/models/firmware.rb', line 15 def firmware_name @firmware_name end |
#from_version ⇒ String
The firmware version that must currently be on the device to upgrade.
39 40 41 |
# File 'lib/verizon/models/firmware.rb', line 39 def from_version @from_version end |
#launch_date ⇒ DateTime
The release date of the firmware image.
23 24 25 |
# File 'lib/verizon/models/firmware.rb', line 23 def launch_date @launch_date end |
#make ⇒ String
The device make that the firmware applies to.
35 36 37 |
# File 'lib/verizon/models/firmware.rb', line 35 def make @make end |
#model ⇒ String
The device model that the firmware applies to.
31 32 33 |
# File 'lib/verizon/models/firmware.rb', line 31 def model @model end |
#participant_name ⇒ String
Internal reference; can be ignored.
19 20 21 |
# File 'lib/verizon/models/firmware.rb', line 19 def participant_name @participant_name end |
#release_note ⇒ String
Additional information about the release.
27 28 29 |
# File 'lib/verizon/models/firmware.rb', line 27 def release_note @release_note end |
#to_version ⇒ String
The firmware version that will be on the device after an upgrade.
43 44 45 |
# File 'lib/verizon/models/firmware.rb', line 43 def to_version @to_version end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 117 118 119 |
# File 'lib/verizon/models/firmware.rb', line 92 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. firmware_name = hash.key?('firmwareName') ? hash['firmwareName'] : SKIP participant_name = hash.key?('participantName') ? hash['participantName'] : SKIP launch_date = if hash.key?('launchDate') (DateTimeHelper.from_rfc3339(hash['launchDate']) if hash['launchDate']) else SKIP end release_note = hash.key?('releaseNote') ? hash['releaseNote'] : SKIP model = hash.key?('model') ? hash['model'] : SKIP make = hash.key?('make') ? hash['make'] : SKIP from_version = hash.key?('fromVersion') ? hash['fromVersion'] : SKIP to_version = hash.key?('toVersion') ? hash['toVersion'] : SKIP # Create object from extracted values. Firmware.new(firmware_name, participant_name, launch_date, release_note, model, make, from_version, to_version) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/verizon/models/firmware.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['firmware_name'] = 'firmwareName' @_hash['participant_name'] = 'participantName' @_hash['launch_date'] = 'launchDate' @_hash['release_note'] = 'releaseNote' @_hash['model'] = 'model' @_hash['make'] = 'make' @_hash['from_version'] = 'fromVersion' @_hash['to_version'] = 'toVersion' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 |
# File 'lib/verizon/models/firmware.rb', line 74 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/verizon/models/firmware.rb', line 60 def self.optionals %w[ firmware_name participant_name launch_date release_note model make from_version to_version ] end |
Instance Method Details
#to_custom_launch_date ⇒ Object
121 122 123 |
# File 'lib/verizon/models/firmware.rb', line 121 def to_custom_launch_date DateTimeHelper.to_rfc3339(launch_date) end |