Class: Verizon::UsageTriggerManagementController
- Inherits:
-
BaseController
- Object
- BaseController
- Verizon::UsageTriggerManagementController
- Defined in:
- lib/verizon/controllers/usage_trigger_management_controller.rb
Overview
UsageTriggerManagementController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_new_trigger(body: nil) ⇒ ApiResponse
Create a new usage trigger, which will send an alert when the number of device location service transactions reaches a specified percentage of the monthly subscription amount.
-
#delete_trigger(account_name, trigger_id) ⇒ ApiResponse
eletes the specified usage trigger from the given account.
-
#update_trigger(trigger_id, body: nil) ⇒ ApiResponse
Update an existing usage trigger values.
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
#create_new_trigger(body: nil) ⇒ ApiResponse
Create a new usage trigger, which will send an alert when the number of device location service transactions reaches a specified percentage of the monthly subscription amount. assignment.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/verizon/controllers/usage_trigger_management_controller.rb', line 15 def create_new_trigger(body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/usage/triggers', Server::SUBSCRIPTION_SERVER) .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(UsageTriggerResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error', DeviceLocationResultException)) .execute end |
#delete_trigger(account_name, trigger_id) ⇒ ApiResponse
eletes the specified usage trigger from the given account
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/verizon/controllers/usage_trigger_management_controller.rb', line 67 def delete_trigger(account_name, trigger_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/usage/accounts/{accountName}/triggers/{triggerId}', Server::SUBSCRIPTION_SERVER) .template_param(new_parameter(account_name, key: 'accountName') .should_encode(true)) .template_param(new_parameter(trigger_id, key: 'triggerId') .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', 'Unexpected error', DeviceLocationResultException)) .execute end |
#update_trigger(trigger_id, body: nil) ⇒ ApiResponse
Update an existing usage trigger values
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/controllers/usage_trigger_management_controller.rb', line 40 def update_trigger(trigger_id, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/usage/triggers/{triggerId}', Server::SUBSCRIPTION_SERVER) .template_param(new_parameter(trigger_id, key: 'triggerId') .should_encode(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(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(UsageTriggerResponse.method(:from_hash)) .is_api_response(true) .local_error('400', 'Unexpected error', DeviceLocationResultException)) .execute end |