Class: Verizon::ExclusionsController

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

Overview

ExclusionsController

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 the consent settings for the entire account or device list in an account. account. queried

Parameters:

  • account_name (String)

    Required parameter: The numeric name of the

  • device_id (String) (defaults to: nil)

    Optional parameter: The IMEI of the device being

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/verizon/controllers/exclusions_controller.rb', line 16

def devices_location_get_consent_async(,
                                       device_id: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/devicelocations/action/consents',
                                 Server::DEVICE_LOCATION)
               .query_param(new_parameter(, key: 'accountName'))
               .query_param(new_parameter(device_id, key: 'deviceId'))
               .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(GetAccountDeviceConsent.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Unexpected error.',
                             DeviceLocationResultException))
    .execute
end

Create a consent record to use location services as an asynchronous request. create a consent record.

Parameters:

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/verizon/controllers/exclusions_controller.rb', line 41

def devices_location_give_consent_async(body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/devicelocations/action/consents',
                                 Server::DEVICE_LOCATION)
               .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(ConsentTransactionID.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Unexpected error.',
                             DeviceLocationResultException))
    .execute
end

Update the location services consent record for an entire account. update a consent record.

Parameters:

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/verizon/controllers/exclusions_controller.rb', line 65

def devices_location_update_consent(body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/devicelocations/action/consents',
                                 Server::DEVICE_LOCATION)
               .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(ConsentTransactionID.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Unexpected error.',
                             DeviceLocationResultException))
    .execute
end

#exclude_devices(body) ⇒ ApiResponse

This consents endpoint sets a new exclusion list. consent exclusion list.

Parameters:

  • body (ConsentRequest)

    Required parameter: Request to update account

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/verizon/controllers/exclusions_controller.rb', line 89

def exclude_devices(body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/consents',
                                 Server::DEVICE_LOCATION)
               .header_param(new_parameter('*/*', 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(DeviceLocationSuccessResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             DeviceLocationResultException))
    .execute
end

#list_excluded_devices(account_name, start_index) ⇒ ApiResponse

This consents endpoint retrieves a list of excluded devices in an account. “##########-#####”. first record to return.

Parameters:

  • account_name (String)

    Required parameter: Account identifier in

  • start_index (String)

    Required parameter: Zero-based number of the

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/verizon/controllers/exclusions_controller.rb', line 142

def list_excluded_devices(,
                          start_index)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/consents/{accountName}/index/{startIndex}',
                                 Server::DEVICE_LOCATION)
               .template_param(new_parameter(, key: 'accountName')
                                .should_encode(true))
               .template_param(new_parameter(start_index, key: 'startIndex')
                                .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(DevicesConsentResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             DeviceLocationResultException))
    .execute
end

#remove_devices_from_exclusion_list(account_name, device_list) ⇒ ApiResponse

Removes devices from the exclusion list so that they can be located with Device Location Services requests. account. to remove from the exclusion list.

Parameters:

  • account_name (String)

    Required parameter: The numeric name of the

  • device_list (String)

    Required parameter: A list of the device IDs

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/verizon/controllers/exclusions_controller.rb', line 116

def remove_devices_from_exclusion_list(,
                                       device_list)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/consents',
                                 Server::DEVICE_LOCATION)
               .query_param(new_parameter(, key: 'accountName'))
               .query_param(new_parameter(device_list, key: 'deviceList'))
               .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