Class: SquareConnect::OrdersApi
- Inherits:
-
Object
- Object
- SquareConnect::OrdersApi
- Defined in:
- lib/square_connect/api/orders_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#batch_retrieve_orders(location_id, body, opts = {}) ⇒ BatchRetrieveOrdersResponse
BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs.
-
#batch_retrieve_orders_with_http_info(location_id, body, opts = {}) ⇒ Array<(BatchRetrieveOrdersResponse, Fixnum, Hash)>
BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs.
-
#create_order(location_id, body, opts = {}) ⇒ CreateOrderResponse
CreateOrder Creates an [Order](#type-order) that can then be referenced as ‘order_id` in a request to the [Charge](#endpoint-charge) endpoint.
-
#create_order_with_http_info(location_id, body, opts = {}) ⇒ Array<(CreateOrderResponse, Fixnum, Hash)>
CreateOrder Creates an [Order](#type-order) that can then be referenced as `order_id` in a request to the [Charge](#endpoint-charge) endpoint.
-
#initialize(api_client = ApiClient.default) ⇒ OrdersApi
constructor
A new instance of OrdersApi.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
14 15 16 |
# File 'lib/square_connect/api/orders_api.rb', line 14 def api_client @api_client end |
Instance Method Details
#batch_retrieve_orders(location_id, body, opts = {}) ⇒ BatchRetrieveOrdersResponse
BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs. If a given Order ID does not exist, the ID is ignored instead of generating an error.
26 27 28 29 |
# File 'lib/square_connect/api/orders_api.rb', line 26 def batch_retrieve_orders(location_id, body, opts = {}) data, _status_code, _headers = batch_retrieve_orders_with_http_info(location_id, body, opts) return data end |
#batch_retrieve_orders_with_http_info(location_id, body, opts = {}) ⇒ Array<(BatchRetrieveOrdersResponse, Fixnum, Hash)>
BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs. If a given Order ID does not exist, the ID is ignored instead of generating an error.
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 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/square_connect/api/orders_api.rb', line 37 def batch_retrieve_orders_with_http_info(location_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrdersApi.batch_retrieve_orders ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling OrdersApi.batch_retrieve_orders" if location_id.nil? # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling OrdersApi.batch_retrieve_orders" if body.nil? # resource path local_var_path = "/v2/locations/{location_id}/orders/batch-retrieve".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'BatchRetrieveOrdersResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersApi#batch_retrieve_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_order(location_id, body, opts = {}) ⇒ CreateOrderResponse
CreateOrder Creates an [Order](#type-order) that can then be referenced as ‘order_id` in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order’s ‘id` in the `order_id` field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the [Orders API Overview](docs.connect.squareup.com/articles/orders-api-overview).
83 84 85 86 |
# File 'lib/square_connect/api/orders_api.rb', line 83 def create_order(location_id, body, opts = {}) data, _status_code, _headers = create_order_with_http_info(location_id, body, opts) return data end |
#create_order_with_http_info(location_id, body, opts = {}) ⇒ Array<(CreateOrderResponse, Fixnum, Hash)>
CreateOrder Creates an [Order](#type-order) that can then be referenced as `order_id` in a request to the [Charge](#endpoint-charge) endpoint. Orders specify products for purchase, along with discounts, taxes, and other settings to apply to the purchase. To associate a created order with a request to the Charge endpoint, provide the order's `id` in the `order_id` field of your request. You cannot modify an order after you create it. If you need to modify an order, instead create a new order with modified details. To learn more about the Orders API, see the [Orders API Overview](docs.connect.squareup.com/articles/orders-api-overview).
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/square_connect/api/orders_api.rb', line 94 def create_order_with_http_info(location_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: OrdersApi.create_order ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling OrdersApi.create_order" if location_id.nil? # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling OrdersApi.create_order" if body.nil? # resource path local_var_path = "/v2/locations/{location_id}/orders".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreateOrderResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: OrdersApi#create_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |