Class: Verizon::DevicesLocationsController
- Inherits:
-
BaseController
- Object
- BaseController
- Verizon::DevicesLocationsController
- Defined in:
- lib/verizon/controllers/devices_locations_controller.rb
Overview
DevicesLocationsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#cancel_device_location_request(account_name, txid) ⇒ TransactionID
Cancel a queued or unfinished device location request.
-
#cancel_queued_location_report_generation(account, txid) ⇒ TransactionID
Cancel a queued device location report.
-
#create_location_report(body) ⇒ AsynchronousLocationRequestResult
Request an asynchronous device location report.
-
#get_location_report_status(account, txid) ⇒ LocationReportStatus
Returns the current status of a requested device location report.
-
#list_devices_locations_asynchronous(body) ⇒ SynchronousLocationRequestResult
Requests the current or cached location of up to 10,000 IoT or consumer devices (phones, tablets. etc.).
-
#list_devices_locations_synchronous(body) ⇒ Array[Location]
This locations endpoint retrieves the locations for a list of devices.
-
#retrieve_location_report(account, txid, startindex) ⇒ LocationReport
Download a completed asynchronous device location report.
Methods inherited from BaseController
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from Verizon::BaseController
Instance Method Details
#cancel_device_location_request(account_name, txid) ⇒ TransactionID
Cancel a queued or unfinished device location request. “##########-#####”. cancel, from the synchronous response to the original request.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/verizon/controllers/devices_locations_controller.rb', line 67 def cancel_device_location_request(account_name, txid) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/devicelocations/{txid}', Server::DEVICE_LOCATION) .query_param(new_parameter(account_name, key: 'accountName')) .template_param(new_parameter(txid, key: 'txid') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oAuth2'))) .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 |
#cancel_queued_location_report_generation(account, txid) ⇒ TransactionID
Cancel a queued device location report. “##########-#####”. cancel.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/verizon/controllers/devices_locations_controller.rb', line 178 def cancel_queued_location_report_generation(account, txid) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/locationreports/{account}/report/{txid}', Server::DEVICE_LOCATION) .template_param(new_parameter(account, key: 'account') .should_encode(true)) .template_param(new_parameter(txid, key: 'txid') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oAuth2'))) .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) ⇒ AsynchronousLocationRequestResult
Request an asynchronous device location report. location report.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/verizon/controllers/devices_locations_controller.rb', line 92 def create_location_report(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/locationreports', Server::DEVICE_LOCATION) .header_param(new_parameter('*/*', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('oAuth2'))) .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, txid) ⇒ LocationReportStatus
Returns the current status of a requested device location report. “##########-#####”.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/verizon/controllers/devices_locations_controller.rb', line 150 def get_location_report_status(account, txid) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/locationreports/{account}/report/{txid}/status', Server::DEVICE_LOCATION) .template_param(new_parameter(account, key: 'account') .should_encode(true)) .template_param(new_parameter(txid, key: 'txid') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oAuth2'))) .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) ⇒ SynchronousLocationRequestResult
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.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/verizon/controllers/devices_locations_controller.rb', line 41 def list_devices_locations_asynchronous(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/devicelocations', Server::DEVICE_LOCATION) .header_param(new_parameter('*/*', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('oAuth2'))) .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) ⇒ Array[Location]
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 |
# File 'lib/verizon/controllers/devices_locations_controller.rb', line 13 def list_devices_locations_synchronous(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/locations', Server::DEVICE_LOCATION) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('oAuth2'))) .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, txid, startindex) ⇒ LocationReport
Download a completed asynchronous device location report. “##########-#####”. /locationreports response. first record to return.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/verizon/controllers/devices_locations_controller.rb', line 120 def retrieve_location_report(account, txid, startindex) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/locationreports/{account}/report/{txid}/index/{startindex}', Server::DEVICE_LOCATION) .template_param(new_parameter(account, key: 'account') .should_encode(true)) .template_param(new_parameter(txid, key: 'txid') .should_encode(true)) .template_param(new_parameter(startindex, key: 'startindex') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oAuth2'))) .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 |