Class: Square::CashDrawers::Shifts::Client
- Inherits:
-
Object
- Object
- Square::CashDrawers::Shifts::Client
- Defined in:
- lib/square/cash_drawers/shifts/client.rb
Instance Method Summary collapse
-
#get(request_options: {}, **params) ⇒ Square::Types::GetCashDrawerShiftResponse
Provides the summary details for a single cash drawer shift.
- #initialize(client:) ⇒ Square::CashDrawers::Shifts::Client constructor
-
#list(request_options: {}, **params) ⇒ Square::Types::ListCashDrawerShiftsResponse
Provides the details for all of the cash drawer shifts for a location in a date range.
-
#list_events(request_options: {}, **params) ⇒ Square::Types::ListCashDrawerShiftEventsResponse
Provides a paginated list of events for a single cash drawer shift.
Constructor Details
#initialize(client:) ⇒ Square::CashDrawers::Shifts::Client
8 9 10 |
# File 'lib/square/cash_drawers/shifts/client.rb', line 8 def initialize(client:) @client = client end |
Instance Method Details
#get(request_options: {}, **params) ⇒ Square::Types::GetCashDrawerShiftResponse
Provides the summary details for a single cash drawer shift. See [ListCashDrawerShiftEvents](api-endpoint:CashDrawers-ListCashDrawerShiftEvents) for a list of cash drawer shift events.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/square/cash_drawers/shifts/client.rb', line 39 def get(request_options: {}, **params) _query_param_names = ["location_id"] _query = params.slice(*_query_param_names) params = params.except(*_query_param_names) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/cash-drawers/shifts/#{params[:shift_id]}", query: _query ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::GetCashDrawerShiftResponse.load(_response.body) end raise _response.body end |
#list(request_options: {}, **params) ⇒ Square::Types::ListCashDrawerShiftsResponse
Provides the details for all of the cash drawer shifts for a location in a date range.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/square/cash_drawers/shifts/client.rb', line 16 def list(request_options: {}, **params) _query_param_names = %w[location_id sort_order begin_time end_time limit cursor] _query = params.slice(*_query_param_names) params.except(*_query_param_names) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/cash-drawers/shifts", query: _query ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::ListCashDrawerShiftsResponse.load(_response.body) end raise _response.body end |
#list_events(request_options: {}, **params) ⇒ Square::Types::ListCashDrawerShiftEventsResponse
Provides a paginated list of events for a single cash drawer shift.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/square/cash_drawers/shifts/client.rb', line 61 def list_events(request_options: {}, **params) _query_param_names = %w[location_id limit cursor] _query = params.slice(*_query_param_names) params = params.except(*_query_param_names) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/cash-drawers/shifts/#{params[:shift_id]}/events", query: _query ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::ListCashDrawerShiftEventsResponse.load(_response.body) end raise _response.body end |