Class: Verizon::DevicesLocationsApi
- Defined in:
- lib/verizon/apis/devices_locations_api.rb
Overview
DevicesLocationsApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#cancel_queued_location_report_generation(account_name, txid) ⇒ ApiResponse
Cancel a queued device location report.
-
#create_location_report(body) ⇒ ApiResponse
Request an asynchronous device location report.
-
#get_location_report_status(account_name, txid) ⇒ ApiResponse
Returns the current status of a requested device location report.
-
#list_devices_locations_asynchronous(body) ⇒ ApiResponse
Requests the current or cached location of up to 10,000 IoT or consumer devices (phones, tablets. etc.).
-
#list_devices_locations_synchronous(body) ⇒ ApiResponse
This locations endpoint retrieves the locations for a list of devices.
-
#retrieve_location_report(account_name, txid, startindex) ⇒ ApiResponse
Download a completed asynchronous device location report.
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_queued_location_report_generation(account_name, txid) ⇒ ApiResponse
Cancel a queued device location report. “##########-#####”. cancel.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/verizon/apis/devices_locations_api.rb', line 159 def cancel_queued_location_report_generation(account_name, txid) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/locationreports/{accountName}/report/{txid}', Server::DEVICE_LOCATION) .template_param(new_parameter(account_name, key: 'accountName') .is_required(true) .should_encode(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 |
#create_location_report(body) ⇒ ApiResponse
Request an asynchronous device location report. location report.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/verizon/apis/devices_locations_api.rb', line 67 def create_location_report(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/locationreports', Server::DEVICE_LOCATION) .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(AsynchronousLocationRequestResult.method(:from_hash)) .is_api_response(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#get_location_report_status(account_name, txid) ⇒ ApiResponse
Returns the current status of a requested device location report. “##########-#####”.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/verizon/apis/devices_locations_api.rb', line 129 def get_location_report_status(account_name, txid) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/locationreports/{accountName}/report/{txid}/status', Server::DEVICE_LOCATION) .template_param(new_parameter(account_name, key: 'accountName') .is_required(true) .should_encode(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(LocationReportStatus.method(:from_hash)) .is_api_response(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#list_devices_locations_asynchronous(body) ⇒ ApiResponse
Requests the current or cached location of up to 10,000 IoT or consumer devices (phones, tablets. etc.). This request returns a synchronous transaction ID, and the location information for each device is returned asynchronously as a DeviceLocation callback message. to obtain locations of devices.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/verizon/apis/devices_locations_api.rb', line 42 def list_devices_locations_asynchronous(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/devicelocations', Server::DEVICE_LOCATION) .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(SynchronousLocationRequestResult.method(:from_hash)) .is_api_response(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#list_devices_locations_synchronous(body) ⇒ ApiResponse
This locations endpoint retrieves the locations for a list of devices. location of devices.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/verizon/apis/devices_locations_api.rb', line 13 def list_devices_locations_synchronous(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/locations', Server::DEVICE_LOCATION) .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', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Location.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#retrieve_location_report(account_name, txid, startindex) ⇒ ApiResponse
Download a completed asynchronous device location report. “##########-#####”. /locationreports response. first record to return.
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/devices_locations_api.rb', line 96 def retrieve_location_report(account_name, txid, startindex) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/locationreports/{accountName}/report/{txid}/index/{startindex}', Server::DEVICE_LOCATION) .template_param(new_parameter(account_name, key: 'accountName') .is_required(true) .should_encode(true)) .template_param(new_parameter(txid, key: 'txid') .is_required(true) .should_encode(true)) .template_param(new_parameter(startindex, key: 'startindex') .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(LocationReport.method(:from_hash)) .is_api_response(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |