Class: Verizon::TargetsController
- Inherits:
-
BaseController
- Object
- BaseController
- Verizon::TargetsController
- Defined in:
- lib/verizon/controllers/targets_controller.rb
Overview
TargetsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_azure_central_io_t_application(billingaccount_id, body) ⇒ ApiResponse
Deploy a new Azure IoT Central application based on the Verizon ARM template within the specified Azure Active Directory account.
-
#create_target(body) ⇒ ApiResponse
Define a target to receive data streams, alerts, or callbacks.
-
#delete_target(body) ⇒ ApiResponse
Remove a target from a ThingSpace account.
-
#generate_target_external_id(body) ⇒ ApiResponse
Create a unique string that ThingSpace will pass to AWS for increased security.
-
#query_target(body) ⇒ ApiResponse
Search for targets by property 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_azure_central_io_t_application(billingaccount_id, body) ⇒ ApiResponse
Deploy a new Azure IoT Central application based on the Verizon ARM template within the specified Azure Active Directory account. of the authenticating billing account. body must include the UUID of the subscription that you want to update plus any properties that you want to change.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/verizon/controllers/targets_controller.rb', line 104 def create_azure_central_io_t_application(billingaccount_id, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/targets/actions/newaic', Server::CLOUD_CONNECTOR) .header_param(new_parameter(billingaccount_id, key: 'BillingaccountID')) .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(CreateIoTApplicationResponse.method(:from_hash)) .is_api_response(true)) .execute end |
#create_target(body) ⇒ ApiResponse
Define a target to receive data streams, alerts, or callbacks. After creating the target resource, use its ID in a subscription to set up a data stream. provides the details of the target that you want to create.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/verizon/controllers/targets_controller.rb', line 57 def create_target(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/targets', Server::CLOUD_CONNECTOR) .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(Target.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_target(body) ⇒ ApiResponse
Remove a target from a ThingSpace account. identifies the target to delete.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/verizon/controllers/targets_controller.rb', line 36 def delete_target(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/targets/actions/delete', Server::CLOUD_CONNECTOR) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(And.new('thingspace_oauth', 'VZ-M2M-Token'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#generate_target_external_id(body) ⇒ ApiResponse
Create a unique string that ThingSpace will pass to AWS for increased security. body only contains the authenticating account.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/verizon/controllers/targets_controller.rb', line 79 def generate_target_external_id(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/targets/actions/newextid', Server::CLOUD_CONNECTOR) .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(GenerateExternalIDResult.method(:from_hash)) .is_api_response(true)) .execute end |
#query_target(body) ⇒ ApiResponse
Search for targets by property values. Returns an array of all matching target resources. property values.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/verizon/controllers/targets_controller.rb', line 14 def query_target(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/targets/actions/query', Server::CLOUD_CONNECTOR) .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(Target.method(:from_hash)) .is_api_response(true) .is_response_array(true)) .execute end |