Class: Verizon::CheckInHistoryItem

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

Overview

Check-in history for a device.

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, client_type = nil, result = nil, failure_type = nil, time_completed = nil) ⇒ CheckInHistoryItem

Returns a new instance of CheckInHistoryItem.



54
55
56
57
58
59
60
61
# File 'lib/verizon/models/check_in_history_item.rb', line 54

def initialize(device_id = nil, client_type = nil, result = nil,
               failure_type = nil, time_completed = nil)
  @device_id = device_id
  @client_type = client_type
  @result = result
  @failure_type = failure_type
  @time_completed = time_completed
end

Instance Attribute Details

#client_typeString

Type of client.

Returns:

  • (String)


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

def client_type
  @client_type
end

#device_idString

Device IMEI.

Returns:

  • (String)


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

def device_id
  @device_id
end

#failure_typeString

Type of client.

Returns:

  • (String)


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

def failure_type
  @failure_type
end

#resultString

Type of client.

Returns:

  • (String)


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

def result
  @result
end

#time_completedDateTime

Type of client.

Returns:

  • (DateTime)


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

def time_completed
  @time_completed
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/verizon/models/check_in_history_item.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('deviceId') ? hash['deviceId'] : nil
  client_type = hash.key?('clientType') ? hash['clientType'] : nil
  result = hash.key?('result') ? hash['result'] : nil
  failure_type = hash.key?('failureType') ? hash['failureType'] : nil
  time_completed = if hash.key?('timeCompleted')
                     (DateTimeHelper.from_rfc3339(hash['timeCompleted']) if hash['timeCompleted'])
                   end

  # Create object from extracted values.
  CheckInHistoryItem.new(device_id,
                         client_type,
                         result,
                         failure_type,
                         time_completed)
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/check_in_history_item.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'deviceId'
  @_hash['client_type'] = 'clientType'
  @_hash['result'] = 'result'
  @_hash['failure_type'] = 'failureType'
  @_hash['time_completed'] = 'timeCompleted'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/verizon/models/check_in_history_item.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
# File 'lib/verizon/models/check_in_history_item.rb', line 45

def self.optionals
  []
end

Instance Method Details

#to_custom_time_completedObject



84
85
86
# File 'lib/verizon/models/check_in_history_item.rb', line 84

def to_custom_time_completed
  DateTimeHelper.to_rfc3339(time_completed)
end