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:, client_subtype:, vendor_id:, device_id: SKIP, imei: SKIP, iccid: SKIP, imsi: SKIP) ⇒ ClientRegistrationRequestV2

Returns a new instance of ClientRegistrationRequestV2.



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

def initialize(client_type:, client_subtype:, vendor_id:, 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_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:



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

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:



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)


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

def device_id
  @device_id
end

#iccidString

The ICCID number of the device.

Returns:

  • (String)


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

def iccid
  @iccid
end

#imeiString

The IMEI number of the device.

Returns:

  • (String)


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

def imei
  @imei
end

#imsiString

The IMSI number of the device.

Returns:

  • (String)


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

def imsi
  @imsi
end

#vendor_idString

The ID the vendor wants its devices to be registered under. E.g. Verizon, GM, Ford, etc.

Returns:

  • (String)


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

def vendor_id
  @vendor_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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_type,
                                  client_subtype: client_subtype,
                                  vendor_id: vendor_id,
                                  device_id: device_id,
                                  imei: imei,
                                  iccid: iccid,
                                  imsi: imsi)
end

.namesObject

A mapping from model property names to API property names.



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

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



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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.



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

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