Class: Verizon::RegistrationApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/verizon/apis/registration_api.rb

Overview

RegistrationApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Verizon::BaseApi

Instance Method Details

#get_etx_device_certificate(device_id: nil, imei: nil, iccid: nil, imsi: nil) ⇒ ApiResponse

With this API call the user can check the certificate of the device. At least one of the DeviceID, IMEI, ICCID or IMSI is required to make the call. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API. description here

Parameters:

  • device_id (UUID | String) (defaults to: nil)

    Optional parameter: TODO: type

  • imei (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • iccid (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • imsi (String) (defaults to: nil)

    Optional parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/verizon/apis/registration_api.rb', line 180

def get_etx_device_certificate(device_id: nil,
                               imei: nil,
                               iccid: nil,
                               imsi: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v2/clients/registration',
                                 Server::IMP_SERVER)
               .query_param(new_parameter(device_id, key: 'DeviceID'))
               .query_param(new_parameter(imei, key: 'IMEI'))
               .query_param(new_parameter(iccid, key: 'ICCID'))
               .query_param(new_parameter(imsi, key: 'IMSI'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(And.new('thingspace_oauth', 'SessionToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ClientPersistenceResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request',
                             EtxResponseErrorException)
                .local_error('401',
                             'Unauthorized',
                             EtxResponseErrorException)
                .local_error('403',
                             'Forbidden Request',
                             EtxResponseErrorException)
                .local_error('404',
                             'Not Found',
                             EtxResponseErrorException)
                .local_error('429',
                             'Too Many Requests',
                             EtxResponseErrorException)
                .local_error('500',
                             'Internal server Error',
                             EtxResponseErrorException)
                .local_error('default',
                             'Forbidden',
                             EtxResponseErrorException))
    .execute
end

#register_etx_device(body) ⇒ ApiResponse

With this API call the user (client) registers its device or software service to the ETX system. Therefore, when a connection is initiated from the device or software service to the ETX system along with the credential provided by this registration call, then the connection will be authorized.

  • The user can register multiple devices or software services, which can

all be used at the same time.

  • There rules set in the system that limit the type and subtype of the

clients that are allowed to be registered under the VendorID. The rules are created based ont he agreement between the Vendor and Verizon.

  • The user will only be able to register a limited number of devices or

software services under the same VendorID. This registration limit is specified by the agreement between the Vendor and Verizon. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/verizon/apis/registration_api.rb', line 27

def register_etx_device(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v2/clients/registration',
                                 Server::IMP_SERVER)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('thingspace_oauth', 'SessionToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ClientRegistrationResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid Request',
                             EtxResponseErrorException)
                .local_error('401',
                             'Unauthorized Request',
                             EtxResponseErrorException)
                .local_error('403',
                             'Forbidden Request',
                             EtxResponseErrorException)
                .local_error('429',
                             'Too Many Requests',
                             EtxResponseErrorException)
                .local_error('503',
                             'Internal Server Error',
                             EtxResponseErrorException)
                .local_error('default',
                             'Forbidden',
                             EtxResponseErrorException))
    .execute
end

#renew_etx_device(device_id, vendor_id, body: nil) ⇒ ApiResponse

With this API call the user (client) can:

  • renew the certificate of a device or software service in the ETX system

if the original certificate has expired. If the client’s certificate expired or going to expire within 30 days and new certificate will be issued. If the certificate expires more than 30 days, the current certificate will be returned to the client.

  • complete its device or software service registration to the ETX system

if the original registration request was not successful because of a pending certificate generation. Whenever the user receives a “client registration is pending” response (HTTP 202) from POST /clients/registration call. The client should initiate this PUT API call to finish the registration process and get the required certificate. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API. description here Vendor registration call.

Parameters:

  • device_id (UUID | String)

    Required parameter: TODO: type

  • vendor_id (String)

    Required parameter: The VendorID set during the

  • body (Object) (defaults to: nil)

    Optional parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/verizon/apis/registration_api.rb', line 83

def renew_etx_device(device_id,
                     vendor_id,
                     body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/api/v2/clients/registration',
                                 Server::IMP_SERVER)
               .header_param(new_parameter(device_id, key: 'DeviceID')
                              .is_required(true))
               .header_param(new_parameter(vendor_id, key: 'VendorID')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(APIHelper.method(:json_serialize))
               .auth(And.new('thingspace_oauth', 'SessionToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ClientRegistrationResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid Request',
                             EtxResponseErrorException)
                .local_error('401',
                             'Unauthorized Request',
                             EtxResponseErrorException)
                .local_error('403',
                             'Forbidden Request',
                             EtxResponseErrorException)
                .local_error('429',
                             'Too Many Requests',
                             EtxResponseErrorException)
                .local_error('503',
                             'Internal Server Error',
                             EtxResponseErrorException)
                .local_error('default',
                             'Forbidden',
                             EtxResponseErrorException))
    .execute
end

#retrieve_mqtturl(vendor_id, body) ⇒ ApiResponse

With this API call the device or software service requests the MQTT URL for the location that it needs to connect. To determine the proper URL the device or software service needs to provide its ID (the one that was provided in the registration request), location (GPS coordinates), and whether it is on the Verizon cellular network or not. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API. Vendor registration call. here

Parameters:

  • vendor_id (String)

    Required parameter: The VendorID set during the

  • body (ConnectionRequest)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/verizon/apis/registration_api.rb', line 234

def retrieve_mqtturl(vendor_id,
                     body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v2/clients/connection',
                                 Server::IMP_SERVER)
               .header_param(new_parameter(vendor_id, key: 'VendorID')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('thingspace_oauth', 'SessionToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ConnectionResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request',
                             EtxResponseErrorException)
                .local_error('401',
                             'Unauthorized',
                             EtxResponseErrorException)
                .local_error('403',
                             'Forbidden Request',
                             EtxResponseErrorException)
                .local_error('429',
                             'Too Many Requests',
                             EtxResponseErrorException)
                .local_error('503',
                             'Internal server Error',
                             EtxResponseErrorException)
                .local_error('default',
                             'Forbidden',
                             EtxResponseErrorException))
    .execute
end

#retrieve_mqtturl_multi_mec(vendor_id, body) ⇒ ApiResponse

With this API call the device or software service requests the MQTT URL for the location that it needs to connect. To determine the proper URL the device or software service needs to provide its ID (the one that was provided in the registration request), location (GPS coordinates), and whether it is on the Verizon cellular network or not. If there are multiple MECs that serve the location of the client all options are provided in the response, and the client is free to choose which MEC they want to connect. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API. Vendor registration call. here

Parameters:

  • vendor_id (String)

    Required parameter: The VendorID set during the

  • body (ConnectionRequest)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/verizon/apis/registration_api.rb', line 288

def retrieve_mqtturl_multi_mec(vendor_id,
                               body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/api/v3/clients/connection',
                                 Server::IMP_SERVER)
               .header_param(new_parameter(vendor_id, key: 'VendorID')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(And.new('thingspace_oauth', 'SessionToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ConnectionResponseV3.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request',
                             EtxResponseErrorException)
                .local_error('401',
                             'Unauthorized',
                             EtxResponseErrorException)
                .local_error('403',
                             'Forbidden Request',
                             EtxResponseErrorException)
                .local_error('429',
                             'Too Many Requests',
                             EtxResponseErrorException)
                .local_error('503',
                             'Internal server Error',
                             EtxResponseErrorException)
                .local_error('default',
                             'Forbidden',
                             EtxResponseErrorException))
    .execute
end

#unregister_etx_device(vendor_id, device_i_ds) ⇒ ApiResponse

With this API call the user (client) can unregister its devices and software services from the ETX system. The unregistered devices and services will no longer be able to use the ETX Message Exchange. Note: The user needs to authenticate with their ThingSpace credentials using the Access/Bearer and Session/M2M tokens in order to call this API. Vendor registration call. device IDs and software service IDs to be unregistered

Parameters:

  • vendor_id (String)

    Required parameter: The VendorID set during the

  • device_i_ds (Array[UUID | String])

    Required parameter: The list of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/verizon/apis/registration_api.rb', line 134

def unregister_etx_device(vendor_id,
                          device_i_ds)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/api/v2/clients/registration',
                                 Server::IMP_SERVER)
               .header_param(new_parameter(vendor_id, key: 'VendorID')
                              .is_required(true))
               .query_param(new_parameter(device_i_ds, key: 'DeviceIDs')
                             .is_required(true))
               .auth(And.new('thingspace_oauth', 'SessionToken')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Invalid Request',
                             EtxResponseErrorException)
                .local_error('401',
                             'Unauthorized Request',
                             EtxResponseErrorException)
                .local_error('403',
                             'Forbidden Request',
                             EtxResponseErrorException)
                .local_error('429',
                             'Too Many Requests',
                             EtxResponseErrorException)
                .local_error('503',
                             'Internal Server Error',
                             EtxResponseErrorException)
                .local_error('default',
                             'Forbidden',
                             EtxResponseErrorException))
    .execute
end