Class: Verizon::ConnectionEvent
- Defined in:
- lib/verizon/models/connection_event.rb
Overview
Network connection events for a device during a specified time period.
Instance Attribute Summary collapse
-
#connection_event_attributes ⇒ Array[CustomFields]
The attributes that describe the connection event.
-
#extended_attributes ⇒ Array[CustomFields]
Currently not used.
-
#occurred_at ⇒ String
The date and time when the connection event occured.
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_event_attributes: SKIP, extended_attributes: SKIP, occurred_at: SKIP, additional_properties: nil) ⇒ ConnectionEvent
constructor
A new instance of ConnectionEvent.
-
#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_event_attributes: SKIP, extended_attributes: SKIP, occurred_at: SKIP, additional_properties: nil) ⇒ ConnectionEvent
Returns a new instance of ConnectionEvent.
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/verizon/models/connection_event.rb', line 47 def initialize(connection_event_attributes: SKIP, extended_attributes: SKIP, occurred_at: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? unless connection_event_attributes == SKIP @connection_event_attributes = connection_event_attributes end @extended_attributes = extended_attributes unless extended_attributes == SKIP @occurred_at = occurred_at unless occurred_at == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#connection_event_attributes ⇒ Array[CustomFields]
The attributes that describe the connection event.
14 15 16 |
# File 'lib/verizon/models/connection_event.rb', line 14 def connection_event_attributes @connection_event_attributes end |
#extended_attributes ⇒ Array[CustomFields]
Currently not used.
18 19 20 |
# File 'lib/verizon/models/connection_event.rb', line 18 def extended_attributes @extended_attributes end |
#occurred_at ⇒ String
The date and time when the connection event occured.
22 23 24 |
# File 'lib/verizon/models/connection_event.rb', line 22 def occurred_at @occurred_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 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 95 96 97 98 99 100 |
# File 'lib/verizon/models/connection_event.rb', line 62 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_event_attributes = nil unless hash['connectionEventAttributes'].nil? connection_event_attributes = [] hash['connectionEventAttributes'].each do |structure| connection_event_attributes << (CustomFields.from_hash(structure) if structure) end end connection_event_attributes = SKIP unless hash.key?('connectionEventAttributes') # Parameter is an array, so we need to iterate through it extended_attributes = nil unless hash['extendedAttributes'].nil? extended_attributes = [] hash['extendedAttributes'].each do |structure| extended_attributes << (CustomFields.from_hash(structure) if structure) end end extended_attributes = SKIP unless hash.key?('extendedAttributes') occurred_at = hash.key?('occurredAt') ? hash['occurredAt'] : 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. ConnectionEvent.new(connection_event_attributes: connection_event_attributes, extended_attributes: extended_attributes, occurred_at: occurred_at, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/verizon/models/connection_event.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['connection_event_attributes'] = 'connectionEventAttributes' @_hash['extended_attributes'] = 'extendedAttributes' @_hash['occurred_at'] = 'occurredAt' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/verizon/models/connection_event.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/verizon/models/connection_event.rb', line 34 def self.optionals %w[ connection_event_attributes extended_attributes occurred_at ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 116 |
# File 'lib/verizon/models/connection_event.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} connection_event_attributes: #{@connection_event_attributes.inspect},"\ " extended_attributes: #{@extended_attributes.inspect}, occurred_at:"\ " #{@occurred_at.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 108 |
# File 'lib/verizon/models/connection_event.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} connection_event_attributes: #{@connection_event_attributes},"\ " extended_attributes: #{@extended_attributes}, occurred_at: #{@occurred_at},"\ " additional_properties: #{@additional_properties}>" end |