Class: Verizon::ThingSpaceQualityOfServiceAPIActionsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/verizon/controllers/thing_space_quality_of_service_api_actions_controller.rb

Overview

ThingSpaceQualityOfServiceAPIActionsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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_a_thing_space_quality_of_service_api_subscription(body) ⇒ ApiResponse

Creates a QoS elevation subscription ID and activates the subscription. create a ThingSpace Quality of Service API subscription.

Parameters:

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/verizon/controllers/thing_space_quality_of_service_api_actions_controller.rb', line 13

def create_a_thing_space_quality_of_service_api_subscription(body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/m2m/v1/devices/actions/enhanceQoS',
                                 Server::THINGSPACE)
               .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(M201success.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error Response',
                             DefaultResponseException))
    .execute
end

#stop_a_thing_space_quality_of_service_api_subscription(account_name, qos_subscription_id) ⇒ ApiResponse

Stops an active ThingSpace Quality of Service API subscription using the account name and the subscription ID.

Parameters:

  • account_name (String)

    Required parameter: Example:

  • qos_subscription_id (String)

    Required parameter: Example:

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/verizon/controllers/thing_space_quality_of_service_api_actions_controller.rb', line 38

def stop_a_thing_space_quality_of_service_api_subscription(,
                                                           qos_subscription_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/m2m/v1/devices/actions/enhanceQoS',
                                 Server::THINGSPACE)
               .query_param(new_parameter(, key: 'accountName'))
               .query_param(new_parameter(qos_subscription_id, key: 'qosSubscriptionId'))
               .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(M201success.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error Response',
                             DefaultResponseException))
    .execute
end