Class: Square::V1Transactions::Client
- Inherits:
-
Object
- Object
- Square::V1Transactions::Client
- Defined in:
- lib/square/v_1_transactions/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ Square::V1Transactions::Client constructor
-
#v_1_list_orders(request_options: {}, **params) ⇒ Array[Square::Types::V1Order]
Provides summary information for a merchant’s online store orders.
-
#v_1_retrieve_order(request_options: {}, **params) ⇒ Square::Types::V1Order
Provides comprehensive information for a single online store order, including the order’s history.
-
#v_1_update_order(request_options: {}, **params) ⇒ Square::Types::V1Order
Updates the details of an online store order.
Constructor Details
#initialize(client:) ⇒ Square::V1Transactions::Client
7 8 9 |
# File 'lib/square/v_1_transactions/client.rb', line 7 def initialize(client:) @client = client end |
Instance Method Details
#v_1_list_orders(request_options: {}, **params) ⇒ Array[Square::Types::V1Order]
Provides summary information for a merchant’s online store orders.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/square/v_1_transactions/client.rb', line 14 def v_1_list_orders(request_options: {}, **params) _query_param_names = %w[order limit batch_token] _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: "v1/#{params[:location_id]}/orders", query: _query ) _response = @client.send(_request) return if _response.code >= "200" && _response.code < "300" raise _response.body end |
#v_1_retrieve_order(request_options: {}, **params) ⇒ Square::Types::V1Order
Provides comprehensive information for a single online store order, including the order’s history.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/square/v_1_transactions/client.rb', line 34 def v_1_retrieve_order(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v1/#{params[:location_id]}/orders/#{params[:order_id]}" ) _response = @client.send(_request) return Square::Types::V1Order.load(_response.body) if _response.code >= "200" && _response.code < "300" raise _response.body end |
#v_1_update_order(request_options: {}, **params) ⇒ Square::Types::V1Order
Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions:
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/square/v_1_transactions/client.rb', line 49 def v_1_update_order(request_options: {}, **params) _path_param_names = %w[location_id order_id] _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "PUT", path: "v1/#{params[:location_id]}/orders/#{params[:order_id]}", body: params.except(*_path_param_names) ) _response = @client.send(_request) return Square::Types::V1Order.load(_response.body) if _response.code >= "200" && _response.code < "300" raise _response.body end |