Class: NewStoreApi::CashboxesController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/cashboxes_controller.rb

Overview

CashboxesController

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 NewStoreApi::BaseController

Instance Method Details

#create_cashbox(store_id, body) ⇒ CashboxCreatedV1Dto

Activate cashbox by using the given cashbox configuration for the given store identifier. description here

Parameters:

  • store_id (String)

    Required parameter: TODO: type description here

  • body (CashboxCreateV1Dto)

    Required parameter: TODO: type

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/new_store_api/controllers/cashboxes_controller.rb', line 33

def create_cashbox(store_id,
                   body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/stores/{storeId}/cashboxes',
                                 Server::API)
               .template_param(new_parameter(store_id, key: 'storeId')
                                .should_encode(true))
               .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(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CashboxCreatedV1Dto.method(:from_hash)))
    .execute
end

#create_cashbox_release(store_id, cashbox_id, body) ⇒ CashboxV1Dto

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
[Italy] Create a release for the deactivated fiscal printer so it can be reassigned to another tenant or store. here description here

Parameters:

  • store_id (String)

    Required parameter: TODO: type description here

  • cashbox_id (String)

    Required parameter: TODO: type description

  • body (CashboxReleaseV1Dto)

    Required parameter: TODO: type

Returns:



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

def create_cashbox_release(store_id,
                           cashbox_id,
                           body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/stores/{storeId}/cashboxes/{cashboxId}/release',
                                 Server::API)
               .template_param(new_parameter(store_id, key: 'storeId')
                                .should_encode(true))
               .template_param(new_parameter(cashbox_id, key: 'cashboxId')
                                .should_encode(true))
               .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(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CashboxV1Dto.method(:from_hash)))
    .execute
end

#destroy_cashbox(store_id, cashbox_id) ⇒ CashboxV1Dto

Deactivate cashbox for the given store and cashbox identifiers. here

Parameters:

  • store_id (String)

    Required parameter: TODO: type description here

  • cashbox_id (String)

    Required parameter: TODO: type description

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/new_store_api/controllers/cashboxes_controller.rb', line 57

def destroy_cashbox(store_id,
                    cashbox_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/stores/{storeId}/cashboxes/{cashboxId}',
                                 Server::API)
               .template_param(new_parameter(store_id, key: 'storeId')
                                .should_encode(true))
               .template_param(new_parameter(cashbox_id, key: 'cashboxId')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CashboxV1Dto.method(:from_hash)))
    .execute
end

#list_cashboxes(store_id) ⇒ CashboxListV1Dto

List cashboxes for the given store identifier.

Parameters:

  • store_id (String)

    Required parameter: TODO: type description here

Returns:



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/new_store_api/controllers/cashboxes_controller.rb', line 12

def list_cashboxes(store_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/stores/{storeId}/cashboxes',
                                 Server::API)
               .template_param(new_parameter(store_id, key: 'storeId')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CashboxListV1Dto.method(:from_hash)))
    .execute
end

#show_cashbox(store_id, cashbox_id) ⇒ CashboxGetV1Dto

Get cashbox for the given store and cashbox identifiers. here

Parameters:

  • store_id (String)

    Required parameter: TODO: type description here

  • cashbox_id (String)

    Required parameter: TODO: type description

Returns:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/new_store_api/controllers/cashboxes_controller.rb', line 80

def show_cashbox(store_id,
                 cashbox_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/stores/{storeId}/cashboxes/{cashboxId}',
                                 Server::API)
               .template_param(new_parameter(store_id, key: 'storeId')
                                .should_encode(true))
               .template_param(new_parameter(cashbox_id, key: 'cashboxId')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CashboxGetV1Dto.method(:from_hash)))
    .execute
end