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.



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

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_subtypeClientSubtype

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_typeEtxClientType

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: PassengerCar, Truck, Bus, EmergencyVehicle, SchoolBus, MaintenanceVehicle)

  • VulnerableRoadUser - Traffic participants without a protecting

enclosure. (Subtypes: Motorcycle, 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. E.g. Verizon, GM, Ford, etc.

Returns:

  • (String)


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

def vendor_id
  @vendor_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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: device_id,
                                certificate: certificate,
                                client_type: client_type,
                                client_subtype: client_subtype,
                                vendor_id: vendor_id)
end

.namesObject

A mapping from model property names to API property names.



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

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



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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.



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

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.



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

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