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) ⇒ ConnectionHistoryResult
constructor
A new instance of ConnectionHistoryResult.
Methods inherited from BaseModel
Constructor Details
#initialize(connection_history = SKIP, has_more_data = SKIP) ⇒ ConnectionHistoryResult
Returns a new instance of ConnectionHistoryResult.
46 47 48 49 50 |
# File 'lib/verizon/models/connection_history_result.rb', line 46 def initialize(connection_history = SKIP, has_more_data = SKIP) @connection_history = connection_history unless connection_history == SKIP @has_more_data = has_more_data unless has_more_data == SKIP 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.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/verizon/models/connection_history_result.rb', line 53 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 object from extracted values. ConnectionHistoryResult.new(connection_history, has_more_data) 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 |