Class: Verizon::ConnectionRequest
- Defined in:
- lib/verizon/models/connection_request.rb
Overview
Request for /clients/connection. It requires the device ID acquired in the registration request call; the geolocation of the device at the time of the request; and the network type (Verizon or non-Verizon). The system uses this information to determine with MQTT endpoint the device should use to connect the ETX Message Exchange.
Instance Attribute Summary collapse
-
#device_id ⇒ UUID | String
The generated ID (UUID v4) for the device.
-
#geolocation ⇒ Geolocation
Geolocation of the device at the time of the connection request in GPS coordinates.
-
#network_type ⇒ EtxNetworkType
The type of the device’s network connection at the time of the request.
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(device_id:, geolocation:, network_type:) ⇒ ConnectionRequest
constructor
A new instance of ConnectionRequest.
-
#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(device_id:, geolocation:, network_type:) ⇒ ConnectionRequest
Returns a new instance of ConnectionRequest.
56 57 58 59 60 |
# File 'lib/verizon/models/connection_request.rb', line 56 def initialize(device_id:, geolocation:, network_type:) @device_id = device_id @geolocation = geolocation @network_type = network_type end |
Instance Attribute Details
#device_id ⇒ UUID | String
The generated ID (UUID v4) for the device. It can be used as:
- the MQTT Client ID when connecting to the Message Exchange system
- a parameter when asking for the connection endpoint
- a parameter when finishing the device registration
- a parameter when unregistering the device
22 23 24 |
# File 'lib/verizon/models/connection_request.rb', line 22 def device_id @device_id end |
#geolocation ⇒ Geolocation
Geolocation of the device at the time of the connection request in GPS coordinates.
27 28 29 |
# File 'lib/verizon/models/connection_request.rb', line 27 def geolocation @geolocation end |
#network_type ⇒ EtxNetworkType
The type of the device’s network connection at the time of the request. If the device is on the Verizon cellular network it should use the “VZ” value otherwise the “non-VZ” value. Devices on the Verizon network can directly access the ETX Message Exchange on the MEC (Mobile Edge Compute server)
35 36 37 |
# File 'lib/verizon/models/connection_request.rb', line 35 def network_type @network_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/verizon/models/connection_request.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. device_id = hash.key?('DeviceID') ? hash['DeviceID'] : nil geolocation = Geolocation.from_hash(hash['Geolocation']) if hash['Geolocation'] network_type = hash.key?('NetworkType') ? hash['NetworkType'] : nil # Create object from extracted values. ConnectionRequest.new(device_id: device_id, geolocation: geolocation, network_type: network_type) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 |
# File 'lib/verizon/models/connection_request.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['device_id'] = 'DeviceID' @_hash['geolocation'] = 'Geolocation' @_hash['network_type'] = 'NetworkType' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/verizon/models/connection_request.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 |
# File 'lib/verizon/models/connection_request.rb', line 47 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
85 86 87 88 89 |
# File 'lib/verizon/models/connection_request.rb', line 85 def inspect class_name = self.class.name.split('::').last "<#{class_name} device_id: #{@device_id.inspect}, geolocation: #{@geolocation.inspect},"\ " network_type: #{@network_type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
78 79 80 81 82 |
# File 'lib/verizon/models/connection_request.rb', line 78 def to_s class_name = self.class.name.split('::').last "<#{class_name} device_id: #{@device_id}, geolocation: #{@geolocation}, network_type:"\ " #{@network_type}>" end |