Class: Verizon::ClientRegistrationRequestV2

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

Overview

Request for v2/clients/registration endpoint. It requires the Client Type, Subtype and Vendor to be defined.

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(client_type = nil, client_subtype = nil, vendor_id = nil, device_id = SKIP, imei = SKIP, iccid = SKIP, imsi = SKIP) ⇒ ClientRegistrationRequestV2

Returns a new instance of ClientRegistrationRequestV2.



94
95
96
97
98
99
100
101
102
103
# File 'lib/verizon/models/client_registration_request_v2.rb', line 94

def initialize(client_type = nil, client_subtype = nil, vendor_id = nil,
               device_id = SKIP, imei = SKIP, iccid = SKIP, imsi = SKIP)
  @client_type = client_type
  @client_subtype = client_subtype
  @vendor_id = vendor_id
  @device_id = device_id unless device_id == SKIP
  @imei = imei unless imei == SKIP
  @iccid = iccid unless iccid == SKIP
  @imsi = imsi unless imsi == SKIP
end

Instance Attribute Details

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



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

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:



33
34
35
# File 'lib/verizon/models/client_registration_request_v2.rb', line 33

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)


52
53
54
# File 'lib/verizon/models/client_registration_request_v2.rb', line 52

def device_id
  @device_id
end

#iccidString

The ICCID number of the device.

Returns:

  • (String)


60
61
62
# File 'lib/verizon/models/client_registration_request_v2.rb', line 60

def iccid
  @iccid
end

#imeiString

The IMEI number of the device.

Returns:

  • (String)


56
57
58
# File 'lib/verizon/models/client_registration_request_v2.rb', line 56

def imei
  @imei
end

#imsiString

The IMSI number of the device.

Returns:

  • (String)


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

def imsi
  @imsi
end

#vendor_idString

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

Returns:

  • (String)


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

def vendor_id
  @vendor_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/verizon/models/client_registration_request_v2.rb', line 106

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  client_type = hash.key?('ClientType') ? hash['ClientType'] : nil
  client_subtype = hash.key?('ClientSubtype') ? hash['ClientSubtype'] : nil
  vendor_id = hash.key?('VendorID') ? hash['VendorID'] : nil
  device_id = hash.key?('DeviceID') ? hash['DeviceID'] : SKIP
  imei = hash.key?('IMEI') ? hash['IMEI'] : SKIP
  iccid = hash.key?('ICCID') ? hash['ICCID'] : SKIP
  imsi = hash.key?('IMSI') ? hash['IMSI'] : SKIP

  # Create object from extracted values.
  ClientRegistrationRequestV2.new(client_type,
                                  client_subtype,
                                  vendor_id,
                                  device_id,
                                  imei,
                                  iccid,
                                  imsi)
end

.namesObject

A mapping from model property names to API property names.



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/verizon/models/client_registration_request_v2.rb', line 67

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_type'] = 'ClientType'
  @_hash['client_subtype'] = 'ClientSubtype'
  @_hash['vendor_id'] = 'VendorID'
  @_hash['device_id'] = 'DeviceID'
  @_hash['imei'] = 'IMEI'
  @_hash['iccid'] = 'ICCID'
  @_hash['imsi'] = 'IMSI'
  @_hash
end

.nullablesObject

An array for nullable fields



90
91
92
# File 'lib/verizon/models/client_registration_request_v2.rb', line 90

def self.nullables
  []
end

.optionalsObject

An array for optional fields



80
81
82
83
84
85
86
87
# File 'lib/verizon/models/client_registration_request_v2.rb', line 80

def self.optionals
  %w[
    device_id
    imei
    iccid
    imsi
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



137
138
139
140
141
142
143
# File 'lib/verizon/models/client_registration_request_v2.rb', line 137

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

#to_sObject

Provides a human-readable string representation of the object.



129
130
131
132
133
134
# File 'lib/verizon/models/client_registration_request_v2.rb', line 129

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