Class: Verizon::DeviceLocationCallbacksApi
- Defined in:
- lib/verizon/apis/device_location_callbacks_api.rb
Overview
DeviceLocationCallbacksApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#cancel_async_report(account_name, txid) ⇒ ApiResponse
Cancel an asynchronous report request.
-
#deregister_callback(account_name, service) ⇒ ApiResponse
Deregister a URL to stop receiving callback messages.
-
#list_registered_callbacks(account_name) ⇒ ApiResponse
Returns a list of all registered callback URLs for the account.
-
#register_callback(account_name, body) ⇒ ApiResponse
Provide a URL to receive messages from a ThingSpace callback service.
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
#cancel_async_report(account_name, txid) ⇒ ApiResponse
Cancel an asynchronous report request. “##########-#####”.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/verizon/apis/device_location_callbacks_api.rb', line 14 def cancel_async_report(account_name, txid) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/devicelocations/{txid}', Server::DEVICE_LOCATION) .query_param(new_parameter(account_name, key: 'accountName') .is_required(true)) .template_param(new_parameter(txid, key: 'txid') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(TransactionId.method(:from_hash)) .is_api_response(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#deregister_callback(account_name, service) ⇒ ApiResponse
Deregister a URL to stop receiving callback messages. name.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/verizon/apis/device_location_callbacks_api.rb', line 96 def deregister_callback(account_name, service) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/callbacks/{accountName}/name/{service}', Server::DEVICE_LOCATION) .template_param(new_parameter(account_name, key: 'accountName') .is_required(true) .should_encode(true)) .template_param(new_parameter(service, key: 'service') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(DeviceLocationSuccessResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Error response.', DeviceLocationResultException)) .execute end |
#list_registered_callbacks(account_name) ⇒ ApiResponse
Returns a list of all registered callback URLs for the account.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/verizon/apis/device_location_callbacks_api.rb', line 40 def list_registered_callbacks(account_name) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/callbacks/{accountName}', Server::DEVICE_LOCATION) .template_param(new_parameter(account_name, key: 'accountName') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(DeviceLocationCallback.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Error response.', DeviceLocationResultException)) .execute end |
#register_callback(account_name, body) ⇒ ApiResponse
Provide a URL to receive messages from a ThingSpace callback service. register a callback.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/verizon/apis/device_location_callbacks_api.rb', line 66 def register_callback(account_name, body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/callbacks/{accountName}', Server::DEVICE_LOCATION) .template_param(new_parameter(account_name, key: 'accountName') .is_required(true) .should_encode(true)) .header_param(new_parameter('*/*', 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', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(CallbackRegistrationResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Error response.', DeviceLocationResultException)) .execute end |