Class: Verizon::DeviceRoleController

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

Overview

DeviceRoleController

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_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from Verizon::BaseController

Instance Method Details

#get_acl_rules_by_vendor_id(vendor_id) ⇒ ApiResponse

This API allows the user to get the access control rules defined for them.

Parameters:

  • vendor_id (String)

    Required parameter: The user’s Vendor ID

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/verizon/controllers/device_role_controller.rb', line 12

def get_acl_rules_by_vendor_id(vendor_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/device-roles/vendor',
                                 Server::IMP_SERVER)
               .query_param(new_parameter(vendor_id, key: 'VendorID'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(And.new('thingspace_oauth', 'sessionToken')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(DeviceRole.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true)
                .local_error('400',
                             'Bad Request',
                             APIException)
                .local_error('401',
                             'Unauthorized',
                             APIException)
                .local_error('403',
                             'Forbidden',
                             APIException)
                .local_error('406',
                             'Not Acceptable',
                             APIException)
                .local_error('429',
                             'Too many requests',
                             APIException)
                .local_error('default',
                             'unexpected error',
                             APIException))
    .execute
end