Class: Verizon::CloudConnectorSubscriptionsApi
- Defined in:
- lib/verizon/apis/cloud_connector_subscriptions_api.rb
Overview
CloudConnectorSubscriptionsApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#create_subscription(body) ⇒ ApiResponse
Create a subscription to define a streaming channel that sends data from devices in the account to an endpoint defined in a target resource.
-
#delete_subscription(body) ⇒ ApiResponse
Remove a subscription from a ThingSpace account.
-
#query_subscription(body) ⇒ ApiResponse
Search for subscriptions by property values.
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
#create_subscription(body) ⇒ ApiResponse
Create a subscription to define a streaming channel that sends data from devices in the account to an endpoint defined in a target resource. body provides the details of the subscription that you want to create.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/verizon/apis/cloud_connector_subscriptions_api.rb', line 14 def create_subscription(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/subscriptions', Server::CLOUD_CONNECTOR) .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(Subscription.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_subscription(body) ⇒ ApiResponse
Remove a subscription from a ThingSpace account. body identifies the subscription to delete.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/verizon/apis/cloud_connector_subscriptions_api.rb', line 60 def delete_subscription(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/subscriptions/actions/delete', Server::CLOUD_CONNECTOR) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .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 |
#query_subscription(body) ⇒ ApiResponse
Search for subscriptions by property values. Returns an array of all matching subscription resources. body specifies fields and values to match.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/verizon/apis/cloud_connector_subscriptions_api.rb', line 37 def query_subscription(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/subscriptions/actions/query', Server::CLOUD_CONNECTOR) .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(Subscription.method(:from_hash)) .is_api_response(true) .is_response_array(true)) .execute end |