Class: Verizon::DeviceFirmwareVersion

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

Overview

Device and firmware 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, firmware_version = nil, status = SKIP, reason = SKIP, firmware_version_update_time = SKIP) ⇒ DeviceFirmwareVersion

Returns a new instance of DeviceFirmwareVersion.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/verizon/models/device_firmware_version.rb', line 58

def initialize(device_id = nil, firmware_version = nil, status = SKIP,
               reason = SKIP, firmware_version_update_time = SKIP)
  @status = status unless status == SKIP
  @reason = reason unless reason == SKIP
  @device_id = device_id
  @firmware_version = firmware_version
  unless firmware_version_update_time == SKIP
    @firmware_version_update_time =
      firmware_version_update_time
  end
end

Instance Attribute Details

#device_idString

Device IMEI.

Returns:

  • (String)


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

def device_id
  @device_id
end

#firmware_versionString

Device Firmware Version.

Returns:

  • (String)


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

def firmware_version
  @firmware_version
end

#firmware_version_update_timeDateTime

Device Firmware Version.

Returns:

  • (DateTime)


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

def firmware_version_update_time
  @firmware_version_update_time
end

#reasonString

TODO: Write general description for this method

Returns:

  • (String)


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

def reason
  @reason
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


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

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/verizon/models/device_firmware_version.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('deviceId') ? hash['deviceId'] : nil
  firmware_version =
    hash.key?('firmwareVersion') ? hash['firmwareVersion'] : nil
  status = hash.key?('status') ? hash['status'] : SKIP
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  firmware_version_update_time = if hash.key?('firmwareVersionUpdateTime')
                                   (DateTimeHelper.from_rfc3339(hash['firmwareVersionUpdateTime']) if hash['firmwareVersionUpdateTime'])
                                 else
                                   SKIP
                                 end

  # Create object from extracted values.
  DeviceFirmwareVersion.new(device_id,
                            firmware_version,
                            status,
                            reason,
                            firmware_version_update_time)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/verizon/models/device_firmware_version.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['reason'] = 'reason'
  @_hash['device_id'] = 'deviceId'
  @_hash['firmware_version'] = 'firmwareVersion'
  @_hash['firmware_version_update_time'] = 'firmwareVersionUpdateTime'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/verizon/models/device_firmware_version.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
# File 'lib/verizon/models/device_firmware_version.rb', line 45

def self.optionals
  %w[
    status
    reason
    firmware_version_update_time
  ]
end

Instance Method Details

#to_custom_firmware_version_update_timeObject



94
95
96
# File 'lib/verizon/models/device_firmware_version.rb', line 94

def to_custom_firmware_version_update_time
  DateTimeHelper.to_rfc3339(firmware_version_update_time)
end