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

#exclude_devices(body) ⇒ DeviceLocationSuccessResult

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

Parameters:

  • body (ConsentRequest)

    Required parameter: Request to update account

Returns:



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

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(Single.new('oAuth2')))
    .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, start_index) ⇒ DevicesConsentResult

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

Parameters:

  • account (String)

    Required parameter: Account identifier in

  • start_index (String)

    Required parameter: Zero-based number of the

Returns:



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

def list_excluded_devices(,
                          start_index)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/consents/{account}/index/{startIndex}',
                                 Server::DEVICE_LOCATION)
               .template_param(new_parameter(, key: 'account')
                                .should_encode(true))
               .template_param(new_parameter(start_index, key: 'startIndex')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oAuth2')))
    .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) ⇒ DeviceLocationSuccessResult

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:



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

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(Single.new('oAuth2')))
    .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