Class: Verizon::ConnectionHistoryResult
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- Verizon::ConnectionHistoryResult
- Defined in:
- lib/verizon/models/connection_history_result.rb
Overview
Response containing the connection history. It is a list of Network Connection Events for a device.
Instance Attribute Summary collapse
-
#connection_history ⇒ Array[ConnectionEvent]
Device connection events, sorted by the occurredAt timestamp, oldest first.
-
#has_more_data ⇒ TrueClass | FalseClass
False for a status 200 response.True for a status 202 response, indicating that there is more data to be retrieved.
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(connection_history: SKIP, has_more_data: SKIP, additional_properties: nil) ⇒ ConnectionHistoryResult
constructor
A new instance of ConnectionHistoryResult.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(connection_history: SKIP, has_more_data: SKIP, additional_properties: nil) ⇒ ConnectionHistoryResult
Returns a new instance of ConnectionHistoryResult.
46 47 48 49 50 51 52 53 54 |
# File 'lib/verizon/models/connection_history_result.rb', line 46 def initialize(connection_history: SKIP, has_more_data: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @connection_history = connection_history unless connection_history == SKIP @has_more_data = has_more_data unless has_more_data == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#connection_history ⇒ Array[ConnectionEvent]
Device connection events, sorted by the occurredAt timestamp, oldest first.
16 17 18 |
# File 'lib/verizon/models/connection_history_result.rb', line 16 def connection_history @connection_history end |
#has_more_data ⇒ TrueClass | FalseClass
False for a status 200 response.True for a status 202 response, indicating that there is more data to be retrieved. Send another request, adjusting the earliest value in the request based on the occuredAt value for the last device in the current response.
23 24 25 |
# File 'lib/verizon/models/connection_history_result.rb', line 23 def has_more_data @has_more_data end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/verizon/models/connection_history_result.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it connection_history = nil unless hash['connectionHistory'].nil? connection_history = [] hash['connectionHistory'].each do |structure| connection_history << (ConnectionEvent.from_hash(structure) if structure) end end connection_history = SKIP unless hash.key?('connectionHistory') has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : SKIP # 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. ConnectionHistoryResult.new(connection_history: connection_history, has_more_data: has_more_data, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 |
# File 'lib/verizon/models/connection_history_result.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['connection_history'] = 'connectionHistory' @_hash['has_more_data'] = 'hasMoreData' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/verizon/models/connection_history_result.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 |
# File 'lib/verizon/models/connection_history_result.rb', line 34 def self.optionals %w[ connection_history has_more_data ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
94 95 96 97 98 |
# File 'lib/verizon/models/connection_history_result.rb', line 94 def inspect class_name = self.class.name.split('::').last "<#{class_name} connection_history: #{@connection_history.inspect}, has_more_data:"\ " #{@has_more_data.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
87 88 89 90 91 |
# File 'lib/verizon/models/connection_history_result.rb', line 87 def to_s class_name = self.class.name.split('::').last "<#{class_name} connection_history: #{@connection_history}, has_more_data:"\ " #{@has_more_data}, additional_properties: #{@additional_properties}>" end |