Class: Verizon::ExclusionsController
- Inherits:
-
BaseController
- Object
- BaseController
- Verizon::ExclusionsController
- Defined in:
- lib/verizon/controllers/exclusions_controller.rb
Overview
ExclusionsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#devices_location_get_consent_async(account_name, device_id: nil) ⇒ ApiResponse
Get the consent settings for the entire account or device list in an account.
-
#devices_location_give_consent_async(body: nil) ⇒ ApiResponse
Create a consent record to use location services as an asynchronous request.
-
#devices_location_update_consent(body: nil) ⇒ ApiResponse
Update the location services consent record for an entire account.
-
#exclude_devices(body) ⇒ ApiResponse
This consents endpoint sets a new exclusion list.
-
#list_excluded_devices(account_name, start_index) ⇒ ApiResponse
This consents endpoint retrieves a list of excluded devices in an account.
-
#remove_devices_from_exclusion_list(account_name, device_list) ⇒ ApiResponse
Removes devices from the exclusion list so that they can be located with Device Location Services requests.
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
#devices_location_get_consent_async(account_name, device_id: nil) ⇒ ApiResponse
Get the consent settings for the entire account or device list in an account. account. queried
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/verizon/controllers/exclusions_controller.rb', line 16 def (account_name, device_id: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/devicelocations/action/consents', Server::DEVICE_LOCATION) .query_param(new_parameter(account_name, key: 'accountName')) .query_param(new_parameter(device_id, key: 'deviceId')) .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(GetAccountDeviceConsent.method(:from_hash)) .is_api_response(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#devices_location_give_consent_async(body: nil) ⇒ ApiResponse
Create a consent record to use location services as an asynchronous request. create a consent record.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/verizon/controllers/exclusions_controller.rb', line 41 def (body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/devicelocations/action/consents', 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(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ConsentTransactionID.method(:from_hash)) .is_api_response(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#devices_location_update_consent(body: nil) ⇒ ApiResponse
Update the location services consent record for an entire account. update a consent record.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/verizon/controllers/exclusions_controller.rb', line 65 def (body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/devicelocations/action/consents', 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(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ConsentTransactionID.method(:from_hash)) .is_api_response(true) .local_error('default', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#exclude_devices(body) ⇒ ApiResponse
This consents endpoint sets a new exclusion list. consent exclusion list.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/verizon/controllers/exclusions_controller.rb', line 89 def exclude_devices(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/consents', 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(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', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#list_excluded_devices(account_name, start_index) ⇒ ApiResponse
This consents endpoint retrieves a list of excluded devices in an account. “##########-#####”. first record to return.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/verizon/controllers/exclusions_controller.rb', line 142 def list_excluded_devices(account_name, start_index) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/consents/{accountName}/index/{startIndex}', Server::DEVICE_LOCATION) .template_param(new_parameter(account_name, key: 'accountName') .should_encode(true)) .template_param(new_parameter(start_index, key: 'startIndex') .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(DevicesConsentResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error.', DeviceLocationResultException)) .execute end |
#remove_devices_from_exclusion_list(account_name, device_list) ⇒ ApiResponse
Removes devices from the exclusion list so that they can be located with Device Location Services requests. account. to remove from the exclusion list.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/verizon/controllers/exclusions_controller.rb', line 116 def remove_devices_from_exclusion_list(account_name, device_list) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/consents', Server::DEVICE_LOCATION) .query_param(new_parameter(account_name, key: 'accountName')) .query_param(new_parameter(device_list, key: 'deviceList')) .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', 'Unexpected error.', DeviceLocationResultException)) .execute end |