Class: Square::CashDrawersApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/square/api/cash_drawers_api.rb

Overview

CashDrawersApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Square::BaseApi

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.

Parameters:

  • location_id (String)

    Required parameter: The ID of the location to

  • shift_id (String)

    Required parameter: The shift ID.

  • limit (Integer) (defaults to: nil)

    Optional parameter: Number of resources to be

  • cursor (String) (defaults to: nil)

    Optional parameter: Opaque cursor for fetching the

Returns:

  • (ListCashDrawerShiftEventsResponse Hash)

    response from the API call



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/square/api/cash_drawers_api.rb', line 79

def list_cash_drawer_shift_events(location_id:,
                                  shift_id:,
                                  limit: nil,
                                  cursor: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/cash-drawers/shifts/{shift_id}/events',
                                 'default')
               .query_param(new_parameter(location_id, key: 'location_id'))
               .template_param(new_parameter(shift_id, key: 'shift_id')
                                .should_encode(true))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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.

Parameters:

  • location_id (String)

    Required parameter: The ID of the location to

  • sort_order (SortOrder) (defaults to: nil)

    Optional parameter: The order in which cash

  • begin_time (String) (defaults to: nil)

    Optional parameter: The inclusive start time of

  • end_time (String) (defaults to: nil)

    Optional parameter: The exclusive end date of the

  • limit (Integer) (defaults to: nil)

    Optional parameter: Number of cash drawer shift

  • cursor (String) (defaults to: nil)

    Optional parameter: Opaque cursor for fetching the

Returns:

  • (ListCashDrawerShiftsResponse Hash)

    response from the API call



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/square/api/cash_drawers_api.rb', line 20

def list_cash_drawer_shifts(location_id:,
                            sort_order: nil,
                            begin_time: nil,
                            end_time: nil,
                            limit: nil,
                            cursor: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/cash-drawers/shifts',
                                 'default')
               .query_param(new_parameter(location_id, key: 'location_id'))
               .query_param(new_parameter(sort_order, key: 'sort_order'))
               .query_param(new_parameter(begin_time, key: 'begin_time'))
               .query_param(new_parameter(end_time, key: 'end_time'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
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.

Parameters:

  • location_id (String)

    Required parameter: The ID of the location to

  • shift_id (String)

    Required parameter: The shift ID.

Returns:

  • (RetrieveCashDrawerShiftResponse Hash)

    response from the API call



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/square/api/cash_drawers_api.rb', line 52

def retrieve_cash_drawer_shift(location_id:,
                               shift_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/cash-drawers/shifts/{shift_id}',
                                 'default')
               .query_param(new_parameter(location_id, key: 'location_id'))
               .template_param(new_parameter(shift_id, key: 'shift_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end