Class: Verizon::V3DeviceStatus
- Defined in:
- lib/verizon/models/v3_device_status.rb
Overview
Device status.
Instance Attribute Summary collapse
-
#device_id ⇒ String
Device IMEI.
-
#next_attempt_time ⇒ DateTime
Next attempt time.
-
#recent_attempt_time ⇒ DateTime
The most recent attempt time.
-
#result_reason ⇒ String
Result reason.
-
#status ⇒ String
Success or failure.
-
#updated_time ⇒ DateTime
Updated Time.
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(device_id = nil, status = nil, result_reason = SKIP, updated_time = SKIP, recent_attempt_time = SKIP, next_attempt_time = SKIP) ⇒ V3DeviceStatus
constructor
A new instance of V3DeviceStatus.
- #to_custom_next_attempt_time ⇒ Object
- #to_custom_recent_attempt_time ⇒ Object
- #to_custom_updated_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(device_id = nil, status = nil, result_reason = SKIP, updated_time = SKIP, recent_attempt_time = SKIP, next_attempt_time = SKIP) ⇒ V3DeviceStatus
Returns a new instance of V3DeviceStatus.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/verizon/models/v3_device_status.rb', line 64 def initialize(device_id = nil, status = nil, result_reason = SKIP, updated_time = SKIP, recent_attempt_time = SKIP, next_attempt_time = SKIP) @device_id = device_id @status = status @result_reason = result_reason unless result_reason == SKIP @updated_time = updated_time unless updated_time == SKIP @recent_attempt_time = recent_attempt_time unless recent_attempt_time == SKIP @next_attempt_time = next_attempt_time unless next_attempt_time == SKIP end |
Instance Attribute Details
#device_id ⇒ String
Device IMEI.
15 16 17 |
# File 'lib/verizon/models/v3_device_status.rb', line 15 def device_id @device_id end |
#next_attempt_time ⇒ DateTime
Next attempt time.
35 36 37 |
# File 'lib/verizon/models/v3_device_status.rb', line 35 def next_attempt_time @next_attempt_time end |
#recent_attempt_time ⇒ DateTime
The most recent attempt time.
31 32 33 |
# File 'lib/verizon/models/v3_device_status.rb', line 31 def recent_attempt_time @recent_attempt_time end |
#result_reason ⇒ String
Result reason.
23 24 25 |
# File 'lib/verizon/models/v3_device_status.rb', line 23 def result_reason @result_reason end |
#status ⇒ String
Success or failure.
19 20 21 |
# File 'lib/verizon/models/v3_device_status.rb', line 19 def status @status end |
#updated_time ⇒ DateTime
Updated Time.
27 28 29 |
# File 'lib/verizon/models/v3_device_status.rb', line 27 def updated_time @updated_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/verizon/models/v3_device_status.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. device_id = hash.key?('deviceId') ? hash['deviceId'] : nil status = hash.key?('status') ? hash['status'] : nil result_reason = hash.key?('resultReason') ? hash['resultReason'] : SKIP updated_time = if hash.key?('updatedTime') (DateTimeHelper.from_rfc3339(hash['updatedTime']) if hash['updatedTime']) else SKIP end recent_attempt_time = if hash.key?('recentAttemptTime') (DateTimeHelper.from_rfc3339(hash['recentAttemptTime']) if hash['recentAttemptTime']) else SKIP end next_attempt_time = if hash.key?('nextAttemptTime') (DateTimeHelper.from_rfc3339(hash['nextAttemptTime']) if hash['nextAttemptTime']) else SKIP end # Create object from extracted values. V3DeviceStatus.new(device_id, status, result_reason, updated_time, recent_attempt_time, next_attempt_time) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/verizon/models/v3_device_status.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['device_id'] = 'deviceId' @_hash['status'] = 'status' @_hash['result_reason'] = 'resultReason' @_hash['updated_time'] = 'updatedTime' @_hash['recent_attempt_time'] = 'recentAttemptTime' @_hash['next_attempt_time'] = 'nextAttemptTime' @_hash end |
.nullables ⇒ Object
An array for nullable fields
60 61 62 |
# File 'lib/verizon/models/v3_device_status.rb', line 60 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 |
# File 'lib/verizon/models/v3_device_status.rb', line 50 def self.optionals %w[ result_reason updated_time recent_attempt_time next_attempt_time ] end |
Instance Method Details
#to_custom_next_attempt_time ⇒ Object
116 117 118 |
# File 'lib/verizon/models/v3_device_status.rb', line 116 def to_custom_next_attempt_time DateTimeHelper.to_rfc3339(next_attempt_time) end |
#to_custom_recent_attempt_time ⇒ Object
112 113 114 |
# File 'lib/verizon/models/v3_device_status.rb', line 112 def to_custom_recent_attempt_time DateTimeHelper.to_rfc3339(recent_attempt_time) end |
#to_custom_updated_time ⇒ Object
108 109 110 |
# File 'lib/verizon/models/v3_device_status.rb', line 108 def to_custom_updated_time DateTimeHelper.to_rfc3339(updated_time) end |