Class: Verizon::ClientPersistenceResponse

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

Overview

Response for /v2/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 = SKIP, certificate = SKIP, client_type = SKIP, client_subtype = SKIP, vendor_id = SKIP) ⇒ ClientPersistenceResponse

Returns a new instance of ClientPersistenceResponse.



86
87
88
89
90
91
92
93
# File 'lib/verizon/models/client_persistence_response.rb', line 86

def initialize(device_id = SKIP, certificate = SKIP, client_type = SKIP,
               client_subtype = SKIP, vendor_id = SKIP)
  @device_id = device_id unless device_id == SKIP
  @certificate = certificate unless certificate == SKIP
  @client_type = client_type unless client_type == SKIP
  @client_subtype = client_subtype unless client_subtype == SKIP
  @vendor_id = vendor_id unless vendor_id == SKIP
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_persistence_response.rb', line 24

def certificate
  @certificate
end

#client_subtypeClientSubtypeEnum

The subtype or subgroup of the client type. This further specifies the client type. For example it will specify if the client is a passenger car or a truck. See the ClientType description for the supported Subtypes for each client type.

Returns:



53
54
55
# File 'lib/verizon/models/client_persistence_response.rb', line 53

def client_subtype
  @client_subtype
end

#client_typeEtxClientTypeEnum

The type of the client that is to be registered. This is one of the major traffic participant groups considered in V2X communication. The system uses this value to define which topics the client will be able to publish and subscribe to. Values:

  • Vehicle - Vehicle with an enclosure around the passengers.

(Subtypes: Motorcycle, PassengerCar, Truck, Bus, EmergencyVehicle, SchoolBus, MaintenanceVehicle)

  • VulnerableRoadUser - Traffic participants without a protecting

enclosure. (Subtypes: Bicycle, Pedestrian, Scooter)

  • TrafficLightController - A Traffic light controller system.

(Subtypes: NA)

  • InfrastructureSensor - Sensors that are deployed in the

infrastructure. (Subtypes: RoadSideUnit, Camera, Lidar, Radar, InductiveLoop, MagneticSensor)

  • OnboardSensor - Sensors that are onboard on a vehicle(Subtypes:

Camera, Lidar, Radar)

  • Software - A software system or application. (Subtypes: Platform,

Application, NA)

Returns:



46
47
48
# File 'lib/verizon/models/client_persistence_response.rb', line 46

def client_type
  @client_type
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_persistence_response.rb', line 19

def device_id
  @device_id
end

#vendor_idString

The ID the vendor wants its devices to be registered under.

Returns:

  • (String)


57
58
59
# File 'lib/verizon/models/client_persistence_response.rb', line 57

def vendor_id
  @vendor_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/verizon/models/client_persistence_response.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('DeviceID') ? hash['DeviceID'] : SKIP
  certificate = Certificate.from_hash(hash['Certificate']) if hash['Certificate']
  client_type = hash.key?('ClientType') ? hash['ClientType'] : SKIP
  client_subtype = hash.key?('ClientSubtype') ? hash['ClientSubtype'] : SKIP
  vendor_id = hash.key?('VendorID') ? hash['VendorID'] : SKIP

  # Create object from extracted values.
  ClientPersistenceResponse.new(device_id,
                                certificate,
                                client_type,
                                client_subtype,
                                vendor_id)
end

.namesObject

A mapping from model property names to API property names.



60
61
62
63
64
65
66
67
68
# File 'lib/verizon/models/client_persistence_response.rb', line 60

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'DeviceID'
  @_hash['certificate'] = 'Certificate'
  @_hash['client_type'] = 'ClientType'
  @_hash['client_subtype'] = 'ClientSubtype'
  @_hash['vendor_id'] = 'VendorID'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
# File 'lib/verizon/models/client_persistence_response.rb', line 82

def self.nullables
  []
end

.optionalsObject

An array for optional fields



71
72
73
74
75
76
77
78
79
# File 'lib/verizon/models/client_persistence_response.rb', line 71

def self.optionals
  %w[
    device_id
    certificate
    client_type
    client_subtype
    vendor_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
# File 'lib/verizon/models/client_persistence_response.rb', line 122

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

#to_sObject

Provides a human-readable string representation of the object.



115
116
117
118
119
# File 'lib/verizon/models/client_persistence_response.rb', line 115

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