Class: Verizon::FirmwarePackage

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

Overview

Available firmware.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(firmware_name = nil, firmware_from = nil, firmware_to = nil, launch_date = nil, release_note = nil, model = nil, make = nil, protocol = CampaignMetaInfoProtocolEnum::LW_M2M) ⇒ FirmwarePackage

Returns a new instance of FirmwarePackage.



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/verizon/models/firmware_package.rb', line 69

def initialize(firmware_name = nil, firmware_from = nil, firmware_to = nil,
               launch_date = nil, release_note = nil, model = nil,
               make = nil, protocol = CampaignMetaInfoProtocolEnum::LW_M2M)
  @firmware_name = firmware_name
  @firmware_from = firmware_from
  @firmware_to = firmware_to
  @launch_date = launch_date
  @release_note = release_note
  @model = model
  @make = make
  @protocol = protocol
end

Instance Attribute Details

#firmware_fromString

Firmware from version.

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/firmware_package.rb', line 19

def firmware_from
  @firmware_from
end

#firmware_nameString

Firmware name.

Returns:

  • (String)


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

def firmware_name
  @firmware_name
end

#firmware_toString

Firmware to version.

Returns:

  • (String)


23
24
25
# File 'lib/verizon/models/firmware_package.rb', line 23

def firmware_to
  @firmware_to
end

#launch_dateDateTime

Firmware launch date.

Returns:

  • (DateTime)


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

def launch_date
  @launch_date
end

#makeString

Firmware applicable device make.

Returns:

  • (String)


39
40
41
# File 'lib/verizon/models/firmware_package.rb', line 39

def make
  @make
end

#modelString

Firmware applicable device model.

Returns:

  • (String)


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

def model
  @model
end

#protocolCampaignMetaInfoProtocolEnum

Firmware protocol. Valid values include: LWM2M, OMD-DM.



43
44
45
# File 'lib/verizon/models/firmware_package.rb', line 43

def protocol
  @protocol
end

#release_noteString

Firmware release note.

Returns:

  • (String)


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

def release_note
  @release_note
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/verizon/models/firmware_package.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  firmware_name = hash.key?('firmwareName') ? hash['firmwareName'] : nil
  firmware_from = hash.key?('firmwareFrom') ? hash['firmwareFrom'] : nil
  firmware_to = hash.key?('firmwareTo') ? hash['firmwareTo'] : nil
  launch_date = if hash.key?('launchDate')
                  (DateTimeHelper.from_rfc3339(hash['launchDate']) if hash['launchDate'])
                end
  release_note = hash.key?('releaseNote') ? hash['releaseNote'] : nil
  model = hash.key?('model') ? hash['model'] : nil
  make = hash.key?('make') ? hash['make'] : nil
  protocol = hash['protocol'] ||= CampaignMetaInfoProtocolEnum::LW_M2M

  # Create object from extracted values.
  FirmwarePackage.new(firmware_name,
                      firmware_from,
                      firmware_to,
                      launch_date,
                      release_note,
                      model,
                      make,
                      protocol)
end

.namesObject

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_package.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['firmware_name'] = 'firmwareName'
  @_hash['firmware_from'] = 'firmwareFrom'
  @_hash['firmware_to'] = 'firmwareTo'
  @_hash['launch_date'] = 'launchDate'
  @_hash['release_note'] = 'releaseNote'
  @_hash['model'] = 'model'
  @_hash['make'] = 'make'
  @_hash['protocol'] = 'protocol'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
# File 'lib/verizon/models/firmware_package.rb', line 65

def self.nullables
  []
end

.optionalsObject

An array for optional fields



60
61
62
# File 'lib/verizon/models/firmware_package.rb', line 60

def self.optionals
  []
end

Instance Method Details

#to_custom_launch_dateObject



109
110
111
# File 'lib/verizon/models/firmware_package.rb', line 109

def to_custom_launch_date
  DateTimeHelper.to_rfc3339(launch_date)
end