Class: TableCheckApi::Pos::V1::Table
- Inherits:
-
Object
- Object
- TableCheckApi::Pos::V1::Table
- Defined in:
- lib/table_check_api/pos/v1/table.rb
Overview
Service class for TableCheck Table endpoints.
Usage:
TableCheckApi::Pos::V1::Table.list(shop_id)
request = TableCheckApi::Pos::V1::Table::StatusRequest.new(table_id: 'id', time: '2020-01-29T19:00:00Z')
TableCheckApi::Pos::V1::Table.status(shop_id, request)
TableCheckApi::Pos::V1::Table.status(shop_id, request, headers: { 'Authorization' => 'Bearer other_key' })
Defined Under Namespace
Classes: ListResponse, StatusRequest, StatusResponse
Constant Summary collapse
- RESOURCE_PATH =
'/pos/v1/shops'
Class Method Summary collapse
- .build_payload(request) ⇒ Object
-
.list(shop_id, headers: {}) ⇒ Object
GET /shops/:shop_id/tables — List all tables for a specific shop.
-
.status(shop_id, request, headers: {}) ⇒ Object
POST /shops/:shop_id/table_status/show — Show the status of a table.
Class Method Details
.build_payload(request) ⇒ Object
40 41 42 43 |
# File 'lib/table_check_api/pos/v1/table.rb', line 40 def self.build_payload(request) raise ArgumentError, 'request must respond to :to_h' unless request.respond_to?(:to_h) request.to_h end |
.list(shop_id, headers: {}) ⇒ Object
GET /shops/:shop_id/tables — List all tables for a specific shop.
20 21 22 23 24 25 26 27 |
# File 'lib/table_check_api/pos/v1/table.rb', line 20 def self.list(shop_id, headers: {}) response = TableCheckApi::Client.get( "#{RESOURCE_PATH}/#{shop_id}/tables", headers: headers ) ListResponse.from_response(response) end |
.status(shop_id, request, headers: {}) ⇒ Object
POST /shops/:shop_id/table_status/show — Show the status of a table.
30 31 32 33 34 35 36 37 38 |
# File 'lib/table_check_api/pos/v1/table.rb', line 30 def self.status(shop_id, request, headers: {}) response = TableCheckApi::Client.post( "#{RESOURCE_PATH}/#{shop_id}/table_status/show", params: build_payload(request), headers: headers ) StatusResponse.from_response(response) end |