Class: Verizon::ClientRegistrationResponse

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

Overview

Response for /clients/registration. It provides a generated device ID and the certificates needed to connect the ETX Message Exchange.

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(device_id:, certificate:) ⇒ ClientRegistrationResponse

Returns a new instance of ClientRegistrationResponse.



44
45
46
47
# File 'lib/verizon/models/client_registration_response.rb', line 44

def initialize(device_id:, certificate:)
  @device_id = device_id
  @certificate = certificate
end

Instance Attribute Details

#certificateCertificate

Structure for the credentials required to connect to the ETX MQTT Message Exchange.

Returns:



24
25
26
# File 'lib/verizon/models/client_registration_response.rb', line 24

def certificate
  @certificate
end

#device_idUUID | 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

Returns:

  • (UUID | String)


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

def device_id
  @device_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/verizon/models/client_registration_response.rb', line 50

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('DeviceID') ? hash['DeviceID'] : nil
  certificate = Certificate.from_hash(hash['Certificate']) if hash['Certificate']

  # Create object from extracted values.
  ClientRegistrationResponse.new(device_id: device_id,
                                 certificate: certificate)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'DeviceID'
  @_hash['certificate'] = 'Certificate'
  @_hash
end

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/verizon/models/client_registration_response.rb', line 40

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
# File 'lib/verizon/models/client_registration_response.rb', line 35

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id.inspect}, certificate: #{@certificate.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



63
64
65
66
# File 'lib/verizon/models/client_registration_response.rb', line 63

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