Class: Verizon::ExclusionsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/verizon/apis/exclusions_api.rb

Overview

ExclusionsApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

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

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)

    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
35
# File 'lib/verizon/apis/exclusions_api.rb', line 16

def devices_location_get_consent_async(,
                                       device_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/devicelocations/action/consents',
                                 Server::DEVICE_LOCATION)
               .query_param(new_parameter(, key: 'accountName')
                             .is_required(true))
               .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)

    Complete http response with raw body and status code.



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

def devices_location_give_consent_async(body: nil)
  @api_call
    .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)

    Complete http response with raw body and status code.



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

def devices_location_update_consent(body: nil)
  @api_call
    .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)

    Complete http response with raw body and status code.



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

def exclude_devices(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/consents',
                                 Server::DEVICE_LOCATION)
               .header_param(new_parameter('*/*', 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(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)

    Complete http response with raw body and status code.



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/verizon/apis/exclusions_api.rb', line 146

def list_excluded_devices(,
                          start_index)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/consents/{accountName}/index/{startIndex}',
                                 Server::DEVICE_LOCATION)
               .template_param(new_parameter(, key: 'accountName')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(start_index, key: 'startIndex')
                                .is_required(true)
                                .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)

    Complete http response with raw body and status code.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/verizon/apis/exclusions_api.rb', line 118

def remove_devices_from_exclusion_list(,
                                       device_list)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/consents',
                                 Server::DEVICE_LOCATION)
               .query_param(new_parameter(, key: 'accountName')
                             .is_required(true))
               .query_param(new_parameter(device_list, key: 'deviceList')
                             .is_required(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(DeviceLocationSuccessResult.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error.',
                             DeviceLocationResultException))
    .execute
end