Class: Verizon::ConnectionResponseV3

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/connection_response_v3.rb

Overview

response for api/v3/clients/connection

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_ur_ls = nil, hosts = SKIP, ports = SKIP) ⇒ ConnectionResponseV3

Returns a new instance of ConnectionResponseV3.



47
48
49
50
51
# File 'lib/verizon/models/connection_response_v3.rb', line 47

def initialize(mqtt_ur_ls = nil, hosts = SKIP, ports = SKIP)
  @mqtt_ur_ls = mqtt_ur_ls
  @hosts = hosts unless hosts == SKIP
  @ports = ports unless ports == SKIP
end

Instance Attribute Details

#hostsArray[String]

Array of hostnames corresponding to each MQTT URL.

Returns:

  • (Array[String])


19
20
21
# File 'lib/verizon/models/connection_response_v3.rb', line 19

def hosts
  @hosts
end

#mqtt_ur_lsArray[String]

Array of full MQTT URLs including protocol, host, and port for each available MEC.

Returns:

  • (Array[String])


15
16
17
# File 'lib/verizon/models/connection_response_v3.rb', line 15

def mqtt_ur_ls
  @mqtt_ur_ls
end

#portsArray[Integer]

Array of port numbers corresponding to each MQTT URL.

Returns:

  • (Array[Integer])


23
24
25
# File 'lib/verizon/models/connection_response_v3.rb', line 23

def ports
  @ports
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/verizon/models/connection_response_v3.rb', line 54

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  mqtt_ur_ls = hash.key?('MqttURLs') ? hash['MqttURLs'] : nil
  hosts = hash.key?('Hosts') ? hash['Hosts'] : SKIP
  ports = hash.key?('Ports') ? hash['Ports'] : SKIP

  # Create object from extracted values.
  ConnectionResponseV3.new(mqtt_ur_ls,
                           hosts,
                           ports)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/verizon/models/connection_response_v3.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mqtt_ur_ls'] = 'MqttURLs'
  @_hash['hosts'] = 'Hosts'
  @_hash['ports'] = 'Ports'
  @_hash
end

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/verizon/models/connection_response_v3.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
# File 'lib/verizon/models/connection_response_v3.rb', line 35

def self.optionals
  %w[
    hosts
    ports
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



75
76
77
78
79
# File 'lib/verizon/models/connection_response_v3.rb', line 75

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} mqtt_ur_ls: #{@mqtt_ur_ls.inspect}, hosts: #{@hosts.inspect}, ports:"\
  " #{@ports.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



69
70
71
72
# File 'lib/verizon/models/connection_response_v3.rb', line 69

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} mqtt_ur_ls: #{@mqtt_ur_ls}, hosts: #{@hosts}, ports: #{@ports}>"
end