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

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(device_id:, client_type:, result:, failure_type:, time_completed:, additional_properties: nil) ⇒ CheckInHistoryItem

Returns a new instance of CheckInHistoryItem.



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

def initialize(device_id:, client_type:, result:, failure_type:,
               time_completed:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @device_id = device_id
  @client_type = client_type
  @result = result
  @failure_type = failure_type
  @time_completed = time_completed
  @additional_properties = additional_properties
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.



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

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 a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  CheckInHistoryItem.new(device_id: device_id,
                         client_type: client_type,
                         result: result,
                         failure_type: failure_type,
                         time_completed: time_completed,
                         additional_properties: additional_properties)
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

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
# File 'lib/verizon/models/check_in_history_item.rb', line 109

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id.inspect}, client_type: #{@client_type.inspect},"\
  " result: #{@result.inspect}, failure_type: #{@failure_type.inspect}, time_completed:"\
  " #{@time_completed.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_time_completedObject



96
97
98
# File 'lib/verizon/models/check_in_history_item.rb', line 96

def to_custom_time_completed
  DateTimeHelper.to_rfc3339(time_completed)
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
106
# File 'lib/verizon/models/check_in_history_item.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id}, client_type: #{@client_type}, result: #{@result},"\
  " failure_type: #{@failure_type}, time_completed: #{@time_completed}, additional_properties:"\
  " #{@additional_properties}>"
end