Class: Verizon::ConnectionResponse
- Defined in:
- lib/verizon/models/connection_response.rb
Overview
response for /clients/connection
Instance Attribute Summary collapse
-
#host ⇒ String
The hostname of the MQTT broker to connect to.
-
#mqtt_url ⇒ String
The full MQTT URL including protocol, host, and port.
-
#port ⇒ Integer
The port number of the MQTT broker.
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(mqtt_url = nil, host = SKIP, port = SKIP) ⇒ ConnectionResponse
constructor
A new instance of ConnectionResponse.
-
#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(mqtt_url = nil, host = SKIP, port = SKIP) ⇒ ConnectionResponse
Returns a new instance of ConnectionResponse.
46 47 48 49 50 |
# File 'lib/verizon/models/connection_response.rb', line 46 def initialize(mqtt_url = nil, host = SKIP, port = SKIP) @mqtt_url = mqtt_url @host = host unless host == SKIP @port = port unless port == SKIP end |
Instance Attribute Details
#host ⇒ String
The hostname of the MQTT broker to connect to.
18 19 20 |
# File 'lib/verizon/models/connection_response.rb', line 18 def host @host end |
#mqtt_url ⇒ String
The full MQTT URL including protocol, host, and port.
14 15 16 |
# File 'lib/verizon/models/connection_response.rb', line 14 def mqtt_url @mqtt_url end |
#port ⇒ Integer
The port number of the MQTT broker.
22 23 24 |
# File 'lib/verizon/models/connection_response.rb', line 22 def port @port 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 |
# File 'lib/verizon/models/connection_response.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mqtt_url = hash.key?('MqttURL') ? hash['MqttURL'] : nil host = hash.key?('Host') ? hash['Host'] : SKIP port = hash.key?('Port') ? hash['Port'] : SKIP # Create object from extracted values. ConnectionResponse.new(mqtt_url, host, port) 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_response.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['mqtt_url'] = 'MqttURL' @_hash['host'] = 'Host' @_hash['port'] = 'Port' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/verizon/models/connection_response.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_response.rb', line 34 def self.optionals %w[ host port ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
74 75 76 77 78 |
# File 'lib/verizon/models/connection_response.rb', line 74 def inspect class_name = self.class.name.split('::').last "<#{class_name} mqtt_url: #{@mqtt_url.inspect}, host: #{@host.inspect}, port:"\ " #{@port.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
68 69 70 71 |
# File 'lib/verizon/models/connection_response.rb', line 68 def to_s class_name = self.class.name.split('::').last "<#{class_name} mqtt_url: #{@mqtt_url}, host: #{@host}, port: #{@port}>" end |