Class: Square::CashDrawersApi
- Defined in:
- lib/square/api/cash_drawers_api.rb
Overview
CashDrawersApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#initialize(config, http_call_back: nil) ⇒ CashDrawersApi
constructor
A new instance of CashDrawersApi.
-
#list_cash_drawer_shift_events(location_id:, shift_id:, limit: nil, cursor: nil) ⇒ ListCashDrawerShiftEventsResponse Hash
Provides a paginated list of events for a single cash drawer shift.
-
#list_cash_drawer_shifts(location_id:, sort_order: nil, begin_time: nil, end_time: nil, limit: nil, cursor: nil) ⇒ ListCashDrawerShiftsResponse Hash
Provides the details for all of the cash drawer shifts for a location in a date range.
-
#retrieve_cash_drawer_shift(location_id:, shift_id:) ⇒ RetrieveCashDrawerShiftResponse Hash
Provides the summary details for a single cash drawer shift.
Methods inherited from BaseApi
#execute_request, #get_user_agent, #validate_parameters
Constructor Details
#initialize(config, http_call_back: nil) ⇒ CashDrawersApi
Returns a new instance of CashDrawersApi.
4 5 6 |
# File 'lib/square/api/cash_drawers_api.rb', line 4 def initialize(config, http_call_back: nil) super(config, http_call_back: http_call_back) end |
Instance Method Details
#list_cash_drawer_shift_events(location_id:, shift_id:, limit: nil, cursor: nil) ⇒ ListCashDrawerShiftEventsResponse Hash
Provides a paginated list of events for a single cash drawer shift. list cash drawer shifts for. returned in a page of results (200 by default, 1000 max). next page of results.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/square/api/cash_drawers_api.rb', line 117 def list_cash_drawer_shift_events(location_id:, shift_id:, limit: nil, cursor: nil) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/cash-drawers/shifts/{shift_id}/events' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'shift_id' => { 'value' => shift_id, 'encode' => true } ) _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'location_id' => location_id, 'limit' => limit, 'cursor' => cursor ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#list_cash_drawer_shifts(location_id:, sort_order: nil, begin_time: nil, end_time: nil, limit: nil, cursor: nil) ⇒ ListCashDrawerShiftsResponse Hash
Provides the details for all of the cash drawer shifts for a location in a date range. query for a list of cash drawer shifts. drawer shifts are listed in the response, based on their opened_at field. Default value: ASC the query on opened_at, in ISO 8601 format. query on opened_at, in ISO 8601 format. events in a page of results (200 by default, 1000 max). next page of results.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/square/api/cash_drawers_api.rb', line 24 def list_cash_drawer_shifts(location_id:, sort_order: nil, begin_time: nil, end_time: nil, limit: nil, cursor: nil) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/cash-drawers/shifts' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'location_id' => location_id, 'sort_order' => sort_order, 'begin_time' => begin_time, 'end_time' => end_time, 'limit' => limit, 'cursor' => cursor ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#retrieve_cash_drawer_shift(location_id:, shift_id:) ⇒ RetrieveCashDrawerShiftResponse Hash
Provides the summary details for a single cash drawer shift. See [ListCashDrawerShiftEvents]($e/CashDrawers/ListCashDrawerShiftEvents) for a list of cash drawer shift events. retrieve cash drawer shifts from.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/square/api/cash_drawers_api.rb', line 72 def retrieve_cash_drawer_shift(location_id:, shift_id:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/cash-drawers/shifts/{shift_id}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'shift_id' => { 'value' => shift_id, 'encode' => true } ) _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'location_id' => location_id ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |