Class: Verizon::BillingController

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

Overview

BillingController

Constant Summary

Constants inherited from BaseController

Verizon::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

#add_account(body) ⇒ ApiResponse

This endpoint allows user to add managed accounts to a primary account. and list of accounts to add

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def (body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/managedaccounts/actions/add',
                                 Server::SUBSCRIPTION_SERVER)
               .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(ManagedAccountsAddResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error',
                             DeviceLocationResultException))
    .execute
end

#cancel_managed_account_action(body) ⇒ ApiResponse

Deactivates a managed billing service relationship between a managed account and the primary account. and list of accounts to add

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def (body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/managedaccounts/actions/cancel',
                                 Server::SUBSCRIPTION_SERVER)
               .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(ManagedAccountCancelResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error',
                             DeviceLocationResultException))
    .execute
end

#list_managed_account(account_name, service_name) ⇒ ApiResponse

This endpoint allows user to retrieve the list of all accounts managed by a primary account. identifier

Parameters:

  • account_name (String)

    Required parameter: Primary account

  • service_name (String)

    Required parameter: Service name

Returns:

  • (ApiResponse)

    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
108
109
# File 'lib/verizon/controllers/billing_controller.rb', line 89

def (,
                         service_name)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/managedaccounts/{accountName}/service/{serviceName}',
                                 Server::SUBSCRIPTION_SERVER)
               .template_param(new_parameter(, key: 'accountName')
                                .should_encode(true))
               .template_param(new_parameter(service_name, key: 'serviceName')
                                .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(ManagedAccountsGetAllResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error',
                             DeviceLocationResultException))
    .execute
end

#managed_account_action(body) ⇒ ApiResponse

Activates a managed billing service relationship between a managed account and the primary account. name and list of accounts to add

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def (body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/managedaccounts/actions/provision',
                                 Server::SUBSCRIPTION_SERVER)
               .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(ManagedAccountsProvisionResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Unexpected error',
                             DeviceLocationResultException))
    .execute
end