Class: Verizon::RetrieveTheTriggersController

Inherits:
BaseController show all
Defined in:
lib/verizon/controllers/retrieve_the_triggers_controller.rb

Overview

RetrieveTheTriggersController

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

#get_all_available_triggersApiResponse

Retrieves all of the available triggers for pseudo-MDN.

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/verizon/controllers/retrieve_the_triggers_controller.rb', line 11

def get_all_available_triggers
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/m2m/v2/triggers',
                                 Server::THINGSPACE)
               .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(TriggerValueResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ReadySimRestErrorResponseException))
    .execute
end

#get_all_triggers_by_account_name(account_name) ⇒ ApiResponse

Retrieve the triggers associated with an account name.

Parameters:

  • account_name (String)

    Required parameter: The account name

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/verizon/controllers/retrieve_the_triggers_controller.rb', line 31

def ()
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/m2m/v2/triggers/accounts/{accountName}',
                                 Server::THINGSPACE)
               .template_param(new_parameter(, key: 'accountName')
                                .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(TriggerValueResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ReadySimRestErrorResponseException))
    .execute
end

#get_all_triggers_by_trigger_categoryApiResponse

Retrieves all of the triggers for the specified account associated with the PromoAlert category

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/verizon/controllers/retrieve_the_triggers_controller.rb', line 53

def get_all_triggers_by_trigger_category
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/m2m/v2/triggers/categories/PromoAlerts',
                                 Server::THINGSPACE)
               .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(TriggerValueResponse2.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ReadySimRestErrorResponseException))
    .execute
end

#get_triggers_by_id(trigger_id) ⇒ ApiResponse

Retrives a specific trigger by its ID. trigger

Parameters:

  • trigger_id (String)

    Required parameter: The ID of a specific

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/verizon/controllers/retrieve_the_triggers_controller.rb', line 74

def get_triggers_by_id(trigger_id)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/m2m/v2/triggers/{triggerId}',
                                 Server::THINGSPACE)
               .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(TriggerValueResponse2.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response',
                             ReadySimRestErrorResponseException))
    .execute
end