square_connect 2.0.0 → 2.0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +151 -9
- data/Rakefile +8 -0
- data/docs/Address.md +26 -0
- data/docs/CaptureTransactionRequest.md +11 -0
- data/docs/CaptureTransactionResponse.md +12 -0
- data/docs/Card.md +18 -0
- data/docs/CardBrand.md +20 -0
- data/docs/ChargeRequest.md +22 -0
- data/docs/ChargeResponse.md +13 -0
- data/docs/Checkout.md +20 -0
- data/docs/CheckoutApi.md +62 -0
- data/docs/Country.md +261 -0
- data/docs/CreateCheckoutRequest.md +18 -0
- data/docs/CreateCheckoutResponse.md +13 -0
- data/docs/CreateCustomerCardRequest.md +14 -0
- data/docs/CreateCustomerCardResponse.md +13 -0
- data/docs/CreateCustomerRequest.md +20 -0
- data/docs/CreateCustomerResponse.md +13 -0
- data/docs/CreateOrderRequest.md +13 -0
- data/docs/CreateOrderRequestLineItem.md +14 -0
- data/docs/CreateOrderRequestOrder.md +13 -0
- data/docs/CreateRefundRequest.md +15 -0
- data/docs/CreateRefundResponse.md +13 -0
- data/docs/Currency.md +191 -0
- data/docs/Customer.md +26 -0
- data/docs/CustomerApi.md +267 -0
- data/docs/CustomerCardApi.md +116 -0
- data/docs/CustomerGroupInfo.md +13 -0
- data/docs/CustomerPreferences.md +12 -0
- data/docs/DeleteCustomerCardRequest.md +11 -0
- data/docs/DeleteCustomerCardResponse.md +12 -0
- data/docs/DeleteCustomerRequest.md +11 -0
- data/docs/DeleteCustomerResponse.md +12 -0
- data/docs/Error.md +15 -0
- data/docs/ErrorCategory.md +17 -0
- data/docs/ErrorCode.md +83 -0
- data/docs/ListCustomersRequest.md +12 -0
- data/docs/ListCustomersResponse.md +14 -0
- data/docs/ListLocationsRequest.md +11 -0
- data/docs/ListLocationsResponse.md +13 -0
- data/docs/ListRefundsRequest.md +15 -0
- data/docs/ListRefundsResponse.md +14 -0
- data/docs/ListTransactionsRequest.md +15 -0
- data/docs/ListTransactionsResponse.md +14 -0
- data/docs/Location.md +16 -0
- data/docs/LocationApi.md +56 -0
- data/docs/LocationCapability.md +12 -0
- data/docs/Money.md +13 -0
- data/docs/Order.md +16 -0
- data/docs/OrderLineItem.md +16 -0
- data/docs/Refund.md +20 -0
- data/docs/RefundApi.md +126 -0
- data/docs/RefundStatus.md +15 -0
- data/docs/RetrieveCustomerRequest.md +11 -0
- data/docs/RetrieveCustomerResponse.md +13 -0
- data/docs/RetrieveTransactionRequest.md +11 -0
- data/docs/RetrieveTransactionResponse.md +13 -0
- data/docs/SortOrder.md +13 -0
- data/docs/Tender.md +22 -0
- data/docs/TenderCardDetails.md +14 -0
- data/docs/TenderCardDetailsEntryMethod.md +16 -0
- data/docs/TenderCardDetailsStatus.md +15 -0
- data/docs/TenderCashDetails.md +13 -0
- data/docs/TenderType.md +17 -0
- data/docs/Transaction.md +21 -0
- data/docs/TransactionApi.md +285 -0
- data/docs/TransactionProduct.md +19 -0
- data/docs/UpdateCustomerRequest.md +20 -0
- data/docs/UpdateCustomerResponse.md +13 -0
- data/docs/VoidTransactionRequest.md +11 -0
- data/docs/VoidTransactionResponse.md +12 -0
- data/lib/square_connect.rb +33 -16
- data/lib/square_connect/api/checkout_api.rb +82 -0
- data/lib/square_connect/api/customer_api.rb +121 -162
- data/lib/square_connect/api/customer_card_api.rb +31 -50
- data/lib/square_connect/api/location_api.rb +12 -20
- data/lib/square_connect/api/refund_api.rb +70 -90
- data/lib/square_connect/api/transaction_api.rb +119 -165
- data/lib/square_connect/api_client.rb +64 -17
- data/lib/square_connect/api_error.rb +7 -3
- data/lib/square_connect/configuration.rb +31 -1
- data/lib/square_connect/models/address.rb +149 -78
- data/lib/square_connect/models/capture_transaction_request.rb +176 -0
- data/lib/square_connect/models/capture_transaction_response.rb +54 -26
- data/lib/square_connect/models/card.rb +98 -52
- data/lib/square_connect/models/card_brand.rb +12 -133
- data/lib/square_connect/models/charge_request.rb +106 -67
- data/lib/square_connect/models/charge_response.rb +57 -30
- data/lib/square_connect/models/checkout.rb +266 -0
- data/lib/square_connect/models/country.rb +253 -133
- data/lib/square_connect/models/create_checkout_request.rb +316 -0
- data/lib/square_connect/models/create_checkout_response.rb +198 -0
- data/lib/square_connect/models/create_customer_card_request.rb +66 -35
- data/lib/square_connect/models/create_customer_card_response.rb +58 -31
- data/lib/square_connect/models/create_customer_request.rb +79 -59
- data/lib/square_connect/models/create_customer_response.rb +58 -31
- data/lib/square_connect/models/create_order_request.rb +234 -0
- data/lib/square_connect/models/create_order_request_line_item.rb +268 -0
- data/lib/square_connect/models/create_order_request_order.rb +219 -0
- data/lib/square_connect/models/create_refund_request.rb +79 -39
- data/lib/square_connect/models/create_refund_response.rb +57 -30
- data/lib/square_connect/models/currency.rb +183 -133
- data/lib/square_connect/models/customer.rb +130 -77
- data/lib/square_connect/models/customer_group_info.rb +206 -0
- data/lib/square_connect/models/customer_preferences.rb +186 -0
- data/lib/square_connect/models/delete_customer_card_request.rb +176 -0
- data/lib/square_connect/models/delete_customer_card_response.rb +55 -27
- data/lib/square_connect/models/delete_customer_request.rb +176 -0
- data/lib/square_connect/models/delete_customer_response.rb +55 -27
- data/lib/square_connect/models/error.rb +107 -45
- data/lib/square_connect/models/error_category.rb +9 -133
- data/lib/square_connect/models/error_code.rb +75 -133
- data/lib/square_connect/models/list_customers_request.rb +55 -27
- data/lib/square_connect/models/list_customers_response.rb +61 -35
- data/lib/square_connect/models/list_locations_request.rb +176 -0
- data/lib/square_connect/models/list_locations_response.rb +57 -30
- data/lib/square_connect/models/list_refunds_request.rb +91 -42
- data/lib/square_connect/models/list_refunds_response.rb +59 -33
- data/lib/square_connect/models/list_transactions_request.rb +91 -42
- data/lib/square_connect/models/list_transactions_response.rb +59 -33
- data/lib/square_connect/models/location.rb +86 -41
- data/lib/square_connect/models/location_capability.rb +4 -133
- data/lib/square_connect/models/money.rb +85 -34
- data/lib/square_connect/models/order.rb +228 -0
- data/lib/square_connect/models/order_line_item.rb +226 -0
- data/lib/square_connect/models/refund.rb +138 -59
- data/lib/square_connect/models/refund_status.rb +7 -133
- data/lib/square_connect/models/retrieve_customer_request.rb +176 -0
- data/lib/square_connect/models/retrieve_customer_response.rb +58 -31
- data/lib/square_connect/models/retrieve_transaction_request.rb +176 -0
- data/lib/square_connect/models/retrieve_transaction_response.rb +57 -30
- data/lib/square_connect/models/sort_order.rb +5 -133
- data/lib/square_connect/models/tender.rb +112 -65
- data/lib/square_connect/models/tender_card_details.rb +93 -40
- data/lib/square_connect/models/tender_card_details_entry_method.rb +8 -133
- data/lib/square_connect/models/tender_card_details_status.rb +7 -133
- data/lib/square_connect/models/tender_cash_details.rb +58 -31
- data/lib/square_connect/models/tender_type.rb +9 -133
- data/lib/square_connect/models/transaction.rb +132 -56
- data/lib/square_connect/models/transaction_product.rb +11 -133
- data/lib/square_connect/models/update_customer_request.rb +79 -59
- data/lib/square_connect/models/update_customer_response.rb +58 -31
- data/lib/square_connect/models/void_transaction_request.rb +176 -0
- data/lib/square_connect/models/void_transaction_response.rb +54 -26
- data/lib/square_connect/version.rb +2 -3
- data/spec/api/checkout_api_spec.rb +53 -0
- data/spec/api/customer_api_spec.rb +121 -0
- data/spec/api/customer_card_api_spec.rb +71 -0
- data/spec/api/location_api_spec.rb +58 -0
- data/spec/api/refund_api_spec.rb +75 -0
- data/spec/api/transaction_api_spec.rb +128 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/address_spec.rb +186 -0
- data/spec/models/capture_transaction_request_spec.rb +36 -0
- data/spec/models/capture_transaction_response_spec.rb +46 -0
- data/spec/models/card_brand_spec.rb +36 -0
- data/spec/models/card_spec.rb +106 -0
- data/spec/models/charge_request_spec.rb +146 -0
- data/spec/models/charge_response_spec.rb +56 -0
- data/spec/models/checkout_spec.rb +126 -0
- data/spec/models/country_spec.rb +36 -0
- data/spec/models/create_checkout_request_spec.rb +106 -0
- data/spec/models/create_checkout_response_spec.rb +56 -0
- data/spec/models/create_customer_card_request_spec.rb +66 -0
- data/spec/models/create_customer_card_response_spec.rb +56 -0
- data/spec/models/create_customer_request_spec.rb +126 -0
- data/spec/models/create_customer_response_spec.rb +56 -0
- data/spec/models/create_order_request_line_item_spec.rb +66 -0
- data/spec/models/create_order_request_order_spec.rb +56 -0
- data/spec/models/create_order_request_spec.rb +56 -0
- data/spec/models/create_refund_request_spec.rb +76 -0
- data/spec/models/create_refund_response_spec.rb +56 -0
- data/spec/models/currency_spec.rb +36 -0
- data/spec/models/customer_group_info_spec.rb +56 -0
- data/spec/models/customer_preferences_spec.rb +46 -0
- data/spec/models/customer_spec.rb +186 -0
- data/spec/models/delete_customer_card_request_spec.rb +36 -0
- data/spec/models/delete_customer_card_response_spec.rb +46 -0
- data/spec/models/delete_customer_request_spec.rb +36 -0
- data/spec/models/delete_customer_response_spec.rb +46 -0
- data/spec/models/error_category_spec.rb +36 -0
- data/spec/models/error_code_spec.rb +36 -0
- data/spec/models/error_spec.rb +76 -0
- data/spec/models/list_customers_request_spec.rb +46 -0
- data/spec/models/list_customers_response_spec.rb +66 -0
- data/spec/models/list_locations_request_spec.rb +36 -0
- data/spec/models/list_locations_response_spec.rb +56 -0
- data/spec/models/list_refunds_request_spec.rb +76 -0
- data/spec/models/list_refunds_response_spec.rb +66 -0
- data/spec/models/list_transactions_request_spec.rb +76 -0
- data/spec/models/list_transactions_response_spec.rb +66 -0
- data/spec/models/location_capability_spec.rb +36 -0
- data/spec/models/location_spec.rb +86 -0
- data/spec/models/money_spec.rb +56 -0
- data/spec/models/order_line_item_spec.rb +86 -0
- data/spec/models/order_spec.rb +86 -0
- data/spec/models/refund_spec.rb +126 -0
- data/spec/models/refund_status_spec.rb +36 -0
- data/spec/models/retrieve_customer_request_spec.rb +36 -0
- data/spec/models/retrieve_customer_response_spec.rb +56 -0
- data/spec/models/retrieve_transaction_request_spec.rb +36 -0
- data/spec/models/retrieve_transaction_response_spec.rb +56 -0
- data/spec/models/sort_order_spec.rb +36 -0
- data/spec/models/tender_card_details_entry_method_spec.rb +36 -0
- data/spec/models/tender_card_details_spec.rb +66 -0
- data/spec/models/tender_card_details_status_spec.rb +36 -0
- data/spec/models/tender_cash_details_spec.rb +56 -0
- data/spec/models/tender_spec.rb +146 -0
- data/spec/models/tender_type_spec.rb +36 -0
- data/spec/models/transaction_product_spec.rb +36 -0
- data/spec/models/transaction_spec.rb +136 -0
- data/spec/models/update_customer_request_spec.rb +126 -0
- data/spec/models/update_customer_response_spec.rb +56 -0
- data/spec/models/void_transaction_request_spec.rb +36 -0
- data/spec/models/void_transaction_response_spec.rb +46 -0
- data/spec/spec_helper.rb +115 -0
- data/square_connect.gemspec +22 -11
- data/travis-ci/accounts.enc +0 -0
- metadata +264 -31
@@ -0,0 +1,82 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require "uri"
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
class CheckoutApi
|
14
|
+
attr_accessor :api_client
|
15
|
+
|
16
|
+
def initialize(api_client = ApiClient.default)
|
17
|
+
@api_client = api_client
|
18
|
+
end
|
19
|
+
|
20
|
+
# CreateCheckout
|
21
|
+
# Creates a [Checkout](#type-checkout) response that links a `checkoutId` and `checkout_page_url` that customers can be directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
|
22
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
23
|
+
# @param location_id The ID of the business location to associate the checkout with.
|
24
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [CreateCheckoutResponse]
|
27
|
+
def create_checkout(authorization, location_id, body, opts = {})
|
28
|
+
data, _status_code, _headers = create_checkout_with_http_info(authorization, location_id, body, opts)
|
29
|
+
return data
|
30
|
+
end
|
31
|
+
|
32
|
+
# CreateCheckout
|
33
|
+
# Creates a [Checkout](#type-checkout) response that links a `checkoutId` and `checkout_page_url` that customers can be directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
|
34
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
35
|
+
# @param location_id The ID of the business location to associate the checkout with.
|
36
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
37
|
+
# @param [Hash] opts the optional parameters
|
38
|
+
# @return [Array<(CreateCheckoutResponse, Fixnum, Hash)>] CreateCheckoutResponse data, response status code and response headers
|
39
|
+
def create_checkout_with_http_info(authorization, location_id, body, opts = {})
|
40
|
+
if @api_client.config.debugging
|
41
|
+
@api_client.config.logger.debug "Calling API: CheckoutApi.create_checkout ..."
|
42
|
+
end
|
43
|
+
# verify the required parameter 'authorization' is set
|
44
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling CheckoutApi.create_checkout" if authorization.nil?
|
45
|
+
# verify the required parameter 'location_id' is set
|
46
|
+
fail ArgumentError, "Missing the required parameter 'location_id' when calling CheckoutApi.create_checkout" if location_id.nil?
|
47
|
+
# verify the required parameter 'body' is set
|
48
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling CheckoutApi.create_checkout" if body.nil?
|
49
|
+
# resource path
|
50
|
+
local_var_path = "/v2/locations/{location_id}/checkouts".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
|
51
|
+
|
52
|
+
# query parameters
|
53
|
+
query_params = {}
|
54
|
+
|
55
|
+
# header parameters
|
56
|
+
header_params = {}
|
57
|
+
# HTTP header 'Accept' (if needed)
|
58
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
59
|
+
# HTTP header 'Content-Type'
|
60
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
61
|
+
header_params[:'Authorization'] = authorization
|
62
|
+
|
63
|
+
# form parameters
|
64
|
+
form_params = {}
|
65
|
+
|
66
|
+
# http body (model)
|
67
|
+
post_body = @api_client.object_to_http_body(body)
|
68
|
+
auth_names = []
|
69
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
70
|
+
:header_params => header_params,
|
71
|
+
:query_params => query_params,
|
72
|
+
:form_params => form_params,
|
73
|
+
:body => post_body,
|
74
|
+
:auth_names => auth_names,
|
75
|
+
:return_type => 'CreateCheckoutResponse')
|
76
|
+
if @api_client.config.debugging
|
77
|
+
@api_client.config.logger.debug "API called: CheckoutApi#create_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
78
|
+
end
|
79
|
+
return data, status_code, headers
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -1,11 +1,10 @@
|
|
1
1
|
=begin
|
2
|
-
Square Connect API
|
2
|
+
#Square Connect API
|
3
3
|
|
4
4
|
OpenAPI spec version: 2.0
|
5
5
|
|
6
6
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
7
|
|
8
|
-
|
9
8
|
=end
|
10
9
|
|
11
10
|
require "uri"
|
@@ -18,180 +17,158 @@ module SquareConnect
|
|
18
17
|
@api_client = api_client
|
19
18
|
end
|
20
19
|
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# @param authorization The value to provide in the Authorization header of
|
20
|
+
# CreateCustomer
|
21
|
+
# Creates a new customer for a business, which can have associated cards on file. You must provide __at least one__ of the following values in your request to this endpoint: - `given_name` - `family_name` - `company_name` - `email_address` - `phone_number` This endpoint does not accept an idempotency key. If you accidentally create a duplicate customer, you can delete it with the [DeleteCustomer](#endpoint-deletecustomer) endpoint.
|
22
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
23
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
24
24
|
# @param [Hash] opts the optional parameters
|
25
|
-
# @
|
26
|
-
|
27
|
-
|
28
|
-
data, status_code, headers = list_customers_with_http_info(authorization, opts)
|
25
|
+
# @return [CreateCustomerResponse]
|
26
|
+
def create_customer(authorization, body, opts = {})
|
27
|
+
data, _status_code, _headers = create_customer_with_http_info(authorization, body, opts)
|
29
28
|
return data
|
30
29
|
end
|
31
30
|
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# @param authorization The value to provide in the Authorization header of
|
31
|
+
# CreateCustomer
|
32
|
+
# Creates a new customer for a business, which can have associated cards on file. You must provide __at least one__ of the following values in your request to this endpoint: - `given_name` - `family_name` - `company_name` - `email_address` - `phone_number` This endpoint does not accept an idempotency key. If you accidentally create a duplicate customer, you can delete it with the [DeleteCustomer](#endpoint-deletecustomer) endpoint.
|
33
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
34
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
35
35
|
# @param [Hash] opts the optional parameters
|
36
|
-
# @
|
37
|
-
|
38
|
-
def list_customers_with_http_info(authorization, opts = {})
|
36
|
+
# @return [Array<(CreateCustomerResponse, Fixnum, Hash)>] CreateCustomerResponse data, response status code and response headers
|
37
|
+
def create_customer_with_http_info(authorization, body, opts = {})
|
39
38
|
if @api_client.config.debugging
|
40
|
-
@api_client.config.logger.debug "Calling API: CustomerApi
|
39
|
+
@api_client.config.logger.debug "Calling API: CustomerApi.create_customer ..."
|
41
40
|
end
|
42
|
-
|
43
41
|
# verify the required parameter 'authorization' is set
|
44
|
-
fail "Missing the required parameter 'authorization' when calling
|
45
|
-
|
42
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling CustomerApi.create_customer" if authorization.nil?
|
43
|
+
# verify the required parameter 'body' is set
|
44
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling CustomerApi.create_customer" if body.nil?
|
46
45
|
# resource path
|
47
|
-
|
46
|
+
local_var_path = "/v2/customers".sub('{format}','json')
|
48
47
|
|
49
48
|
# query parameters
|
50
49
|
query_params = {}
|
51
|
-
query_params[:'cursor'] = opts[:'cursor'] if opts[:'cursor']
|
52
50
|
|
53
51
|
# header parameters
|
54
52
|
header_params = {}
|
55
|
-
|
56
53
|
# HTTP header 'Accept' (if needed)
|
57
|
-
|
58
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
59
|
-
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
60
55
|
# HTTP header 'Content-Type'
|
61
|
-
|
62
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
56
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
63
57
|
header_params[:'Authorization'] = authorization
|
64
58
|
|
65
59
|
# form parameters
|
66
60
|
form_params = {}
|
67
61
|
|
68
62
|
# http body (model)
|
69
|
-
post_body =
|
70
|
-
|
63
|
+
post_body = @api_client.object_to_http_body(body)
|
71
64
|
auth_names = []
|
72
|
-
data, status_code, headers = @api_client.call_api(:
|
65
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
73
66
|
:header_params => header_params,
|
74
67
|
:query_params => query_params,
|
75
68
|
:form_params => form_params,
|
76
69
|
:body => post_body,
|
77
70
|
:auth_names => auth_names,
|
78
|
-
:return_type => '
|
71
|
+
:return_type => 'CreateCustomerResponse')
|
79
72
|
if @api_client.config.debugging
|
80
|
-
@api_client.config.logger.debug "API called: CustomerApi#
|
73
|
+
@api_client.config.logger.debug "API called: CustomerApi#create_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
81
74
|
end
|
82
75
|
return data, status_code, headers
|
83
76
|
end
|
84
77
|
|
85
|
-
#
|
86
|
-
#
|
87
|
-
# @param authorization The value to provide in the Authorization header of
|
88
|
-
# @param
|
78
|
+
# DeleteCustomer
|
79
|
+
# Deletes a customer from a business, along with any linked cards on file.
|
80
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
81
|
+
# @param customer_id The ID of the customer to delete.
|
89
82
|
# @param [Hash] opts the optional parameters
|
90
|
-
# @return [
|
91
|
-
def
|
92
|
-
data,
|
83
|
+
# @return [DeleteCustomerResponse]
|
84
|
+
def delete_customer(authorization, customer_id, opts = {})
|
85
|
+
data, _status_code, _headers = delete_customer_with_http_info(authorization, customer_id, opts)
|
93
86
|
return data
|
94
87
|
end
|
95
88
|
|
96
|
-
#
|
97
|
-
#
|
98
|
-
# @param authorization The value to provide in the Authorization header of
|
99
|
-
# @param
|
89
|
+
# DeleteCustomer
|
90
|
+
# Deletes a customer from a business, along with any linked cards on file.
|
91
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
92
|
+
# @param customer_id The ID of the customer to delete.
|
100
93
|
# @param [Hash] opts the optional parameters
|
101
|
-
# @return [Array<(
|
102
|
-
def
|
94
|
+
# @return [Array<(DeleteCustomerResponse, Fixnum, Hash)>] DeleteCustomerResponse data, response status code and response headers
|
95
|
+
def delete_customer_with_http_info(authorization, customer_id, opts = {})
|
103
96
|
if @api_client.config.debugging
|
104
|
-
@api_client.config.logger.debug "Calling API: CustomerApi
|
97
|
+
@api_client.config.logger.debug "Calling API: CustomerApi.delete_customer ..."
|
105
98
|
end
|
106
|
-
|
107
99
|
# verify the required parameter 'authorization' is set
|
108
|
-
fail "Missing the required parameter 'authorization' when calling
|
109
|
-
|
110
|
-
|
111
|
-
fail "Missing the required parameter 'body' when calling create_customer" if body.nil?
|
112
|
-
|
100
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling CustomerApi.delete_customer" if authorization.nil?
|
101
|
+
# verify the required parameter 'customer_id' is set
|
102
|
+
fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.delete_customer" if customer_id.nil?
|
113
103
|
# resource path
|
114
|
-
|
104
|
+
local_var_path = "/v2/customers/{customer_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
|
115
105
|
|
116
106
|
# query parameters
|
117
107
|
query_params = {}
|
118
108
|
|
119
109
|
# header parameters
|
120
110
|
header_params = {}
|
121
|
-
|
122
111
|
# HTTP header 'Accept' (if needed)
|
123
|
-
|
124
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
125
|
-
|
112
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
126
113
|
# HTTP header 'Content-Type'
|
127
|
-
|
128
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
114
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
129
115
|
header_params[:'Authorization'] = authorization
|
130
116
|
|
131
117
|
# form parameters
|
132
118
|
form_params = {}
|
133
119
|
|
134
120
|
# http body (model)
|
135
|
-
post_body =
|
136
|
-
|
121
|
+
post_body = nil
|
137
122
|
auth_names = []
|
138
|
-
data, status_code, headers = @api_client.call_api(:
|
123
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
139
124
|
:header_params => header_params,
|
140
125
|
:query_params => query_params,
|
141
126
|
:form_params => form_params,
|
142
127
|
:body => post_body,
|
143
128
|
:auth_names => auth_names,
|
144
|
-
:return_type => '
|
129
|
+
:return_type => 'DeleteCustomerResponse')
|
145
130
|
if @api_client.config.debugging
|
146
|
-
@api_client.config.logger.debug "API called: CustomerApi#
|
131
|
+
@api_client.config.logger.debug "API called: CustomerApi#delete_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
147
132
|
end
|
148
133
|
return data, status_code, headers
|
149
134
|
end
|
150
135
|
|
151
|
-
#
|
152
|
-
#
|
153
|
-
# @param authorization The value to provide in the Authorization header of
|
154
|
-
# @param customer_id
|
136
|
+
# ListCustomers
|
137
|
+
# Lists a business's customers.
|
138
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
155
139
|
# @param [Hash] opts the optional parameters
|
156
|
-
# @
|
157
|
-
|
158
|
-
|
140
|
+
# @option opts [String] :cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information.
|
141
|
+
# @return [ListCustomersResponse]
|
142
|
+
def list_customers(authorization, opts = {})
|
143
|
+
data, _status_code, _headers = list_customers_with_http_info(authorization, opts)
|
159
144
|
return data
|
160
145
|
end
|
161
146
|
|
162
|
-
#
|
163
|
-
#
|
164
|
-
# @param authorization The value to provide in the Authorization header of
|
165
|
-
# @param customer_id
|
147
|
+
# ListCustomers
|
148
|
+
# Lists a business's customers.
|
149
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
166
150
|
# @param [Hash] opts the optional parameters
|
167
|
-
# @
|
168
|
-
|
151
|
+
# @option opts [String] :cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information.
|
152
|
+
# @return [Array<(ListCustomersResponse, Fixnum, Hash)>] ListCustomersResponse data, response status code and response headers
|
153
|
+
def list_customers_with_http_info(authorization, opts = {})
|
169
154
|
if @api_client.config.debugging
|
170
|
-
@api_client.config.logger.debug "Calling API: CustomerApi
|
155
|
+
@api_client.config.logger.debug "Calling API: CustomerApi.list_customers ..."
|
171
156
|
end
|
172
|
-
|
173
157
|
# verify the required parameter 'authorization' is set
|
174
|
-
fail "Missing the required parameter 'authorization' when calling
|
175
|
-
|
176
|
-
# verify the required parameter 'customer_id' is set
|
177
|
-
fail "Missing the required parameter 'customer_id' when calling retrieve_customer" if customer_id.nil?
|
178
|
-
|
158
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling CustomerApi.list_customers" if authorization.nil?
|
179
159
|
# resource path
|
180
|
-
|
160
|
+
local_var_path = "/v2/customers".sub('{format}','json')
|
181
161
|
|
182
162
|
# query parameters
|
183
163
|
query_params = {}
|
164
|
+
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
|
184
165
|
|
185
166
|
# header parameters
|
186
167
|
header_params = {}
|
187
|
-
|
188
168
|
# HTTP header 'Accept' (if needed)
|
189
|
-
|
190
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
191
|
-
|
169
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
192
170
|
# HTTP header 'Content-Type'
|
193
|
-
|
194
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
171
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
195
172
|
header_params[:'Authorization'] = authorization
|
196
173
|
|
197
174
|
# form parameters
|
@@ -199,154 +176,136 @@ module SquareConnect
|
|
199
176
|
|
200
177
|
# http body (model)
|
201
178
|
post_body = nil
|
202
|
-
|
203
179
|
auth_names = []
|
204
|
-
data, status_code, headers = @api_client.call_api(:GET,
|
180
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
205
181
|
:header_params => header_params,
|
206
182
|
:query_params => query_params,
|
207
183
|
:form_params => form_params,
|
208
184
|
:body => post_body,
|
209
185
|
:auth_names => auth_names,
|
210
|
-
:return_type => '
|
186
|
+
:return_type => 'ListCustomersResponse')
|
211
187
|
if @api_client.config.debugging
|
212
|
-
@api_client.config.logger.debug "API called: CustomerApi#
|
188
|
+
@api_client.config.logger.debug "API called: CustomerApi#list_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
213
189
|
end
|
214
190
|
return data, status_code, headers
|
215
191
|
end
|
216
192
|
|
217
|
-
#
|
218
|
-
#
|
219
|
-
# @param authorization The value to provide in the Authorization header of
|
220
|
-
# @param customer_id The customer to
|
221
|
-
# @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
|
193
|
+
# RetrieveCustomer
|
194
|
+
# Returns details for a single customer.
|
195
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
196
|
+
# @param customer_id The ID of the customer to retrieve.
|
222
197
|
# @param [Hash] opts the optional parameters
|
223
|
-
# @return [
|
224
|
-
def
|
225
|
-
data,
|
198
|
+
# @return [RetrieveCustomerResponse]
|
199
|
+
def retrieve_customer(authorization, customer_id, opts = {})
|
200
|
+
data, _status_code, _headers = retrieve_customer_with_http_info(authorization, customer_id, opts)
|
226
201
|
return data
|
227
202
|
end
|
228
203
|
|
229
|
-
#
|
230
|
-
#
|
231
|
-
# @param authorization The value to provide in the Authorization header of
|
232
|
-
# @param customer_id The customer to
|
233
|
-
# @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
|
204
|
+
# RetrieveCustomer
|
205
|
+
# Returns details for a single customer.
|
206
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
207
|
+
# @param customer_id The ID of the customer to retrieve.
|
234
208
|
# @param [Hash] opts the optional parameters
|
235
|
-
# @return [Array<(
|
236
|
-
def
|
209
|
+
# @return [Array<(RetrieveCustomerResponse, Fixnum, Hash)>] RetrieveCustomerResponse data, response status code and response headers
|
210
|
+
def retrieve_customer_with_http_info(authorization, customer_id, opts = {})
|
237
211
|
if @api_client.config.debugging
|
238
|
-
@api_client.config.logger.debug "Calling API: CustomerApi
|
212
|
+
@api_client.config.logger.debug "Calling API: CustomerApi.retrieve_customer ..."
|
239
213
|
end
|
240
|
-
|
241
214
|
# verify the required parameter 'authorization' is set
|
242
|
-
fail "Missing the required parameter 'authorization' when calling
|
243
|
-
|
215
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling CustomerApi.retrieve_customer" if authorization.nil?
|
244
216
|
# verify the required parameter 'customer_id' is set
|
245
|
-
fail "Missing the required parameter 'customer_id' when calling
|
246
|
-
|
247
|
-
# verify the required parameter 'body' is set
|
248
|
-
fail "Missing the required parameter 'body' when calling update_customer" if body.nil?
|
249
|
-
|
217
|
+
fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.retrieve_customer" if customer_id.nil?
|
250
218
|
# resource path
|
251
|
-
|
219
|
+
local_var_path = "/v2/customers/{customer_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
|
252
220
|
|
253
221
|
# query parameters
|
254
222
|
query_params = {}
|
255
223
|
|
256
224
|
# header parameters
|
257
225
|
header_params = {}
|
258
|
-
|
259
226
|
# HTTP header 'Accept' (if needed)
|
260
|
-
|
261
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
262
|
-
|
227
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
263
228
|
# HTTP header 'Content-Type'
|
264
|
-
|
265
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
229
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
266
230
|
header_params[:'Authorization'] = authorization
|
267
231
|
|
268
232
|
# form parameters
|
269
233
|
form_params = {}
|
270
234
|
|
271
235
|
# http body (model)
|
272
|
-
post_body =
|
273
|
-
|
236
|
+
post_body = nil
|
274
237
|
auth_names = []
|
275
|
-
data, status_code, headers = @api_client.call_api(:
|
238
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
276
239
|
:header_params => header_params,
|
277
240
|
:query_params => query_params,
|
278
241
|
:form_params => form_params,
|
279
242
|
:body => post_body,
|
280
243
|
:auth_names => auth_names,
|
281
|
-
:return_type => '
|
244
|
+
:return_type => 'RetrieveCustomerResponse')
|
282
245
|
if @api_client.config.debugging
|
283
|
-
@api_client.config.logger.debug "API called: CustomerApi#
|
246
|
+
@api_client.config.logger.debug "API called: CustomerApi#retrieve_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
284
247
|
end
|
285
248
|
return data, status_code, headers
|
286
249
|
end
|
287
250
|
|
288
|
-
#
|
289
|
-
#
|
290
|
-
# @param authorization The value to provide in the Authorization header of
|
291
|
-
# @param customer_id
|
251
|
+
# UpdateCustomer
|
252
|
+
# Updates the details of an existing customer. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
|
253
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
254
|
+
# @param customer_id The ID of the customer to update.
|
255
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
292
256
|
# @param [Hash] opts the optional parameters
|
293
|
-
# @return [
|
294
|
-
def
|
295
|
-
data,
|
257
|
+
# @return [UpdateCustomerResponse]
|
258
|
+
def update_customer(authorization, customer_id, body, opts = {})
|
259
|
+
data, _status_code, _headers = update_customer_with_http_info(authorization, customer_id, body, opts)
|
296
260
|
return data
|
297
261
|
end
|
298
262
|
|
299
|
-
#
|
300
|
-
#
|
301
|
-
# @param authorization The value to provide in the Authorization header of
|
302
|
-
# @param customer_id
|
263
|
+
# UpdateCustomer
|
264
|
+
# Updates the details of an existing customer. You cannot edit a customer's cards on file with this endpoint. To make changes to a card on file, you must delete the existing card on file with the [DeleteCustomerCard](#endpoint-deletecustomercard) endpoint, then create a new one with the [CreateCustomerCard](#endpoint-createcustomercard) endpoint.
|
265
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
266
|
+
# @param customer_id The ID of the customer to update.
|
267
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
303
268
|
# @param [Hash] opts the optional parameters
|
304
|
-
# @return [Array<(
|
305
|
-
def
|
269
|
+
# @return [Array<(UpdateCustomerResponse, Fixnum, Hash)>] UpdateCustomerResponse data, response status code and response headers
|
270
|
+
def update_customer_with_http_info(authorization, customer_id, body, opts = {})
|
306
271
|
if @api_client.config.debugging
|
307
|
-
@api_client.config.logger.debug "Calling API: CustomerApi
|
272
|
+
@api_client.config.logger.debug "Calling API: CustomerApi.update_customer ..."
|
308
273
|
end
|
309
|
-
|
310
274
|
# verify the required parameter 'authorization' is set
|
311
|
-
fail "Missing the required parameter 'authorization' when calling
|
312
|
-
|
275
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling CustomerApi.update_customer" if authorization.nil?
|
313
276
|
# verify the required parameter 'customer_id' is set
|
314
|
-
fail "Missing the required parameter 'customer_id' when calling
|
315
|
-
|
277
|
+
fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.update_customer" if customer_id.nil?
|
278
|
+
# verify the required parameter 'body' is set
|
279
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling CustomerApi.update_customer" if body.nil?
|
316
280
|
# resource path
|
317
|
-
|
281
|
+
local_var_path = "/v2/customers/{customer_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
|
318
282
|
|
319
283
|
# query parameters
|
320
284
|
query_params = {}
|
321
285
|
|
322
286
|
# header parameters
|
323
287
|
header_params = {}
|
324
|
-
|
325
288
|
# HTTP header 'Accept' (if needed)
|
326
|
-
|
327
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
328
|
-
|
289
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
329
290
|
# HTTP header 'Content-Type'
|
330
|
-
|
331
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
291
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
332
292
|
header_params[:'Authorization'] = authorization
|
333
293
|
|
334
294
|
# form parameters
|
335
295
|
form_params = {}
|
336
296
|
|
337
297
|
# http body (model)
|
338
|
-
post_body =
|
339
|
-
|
298
|
+
post_body = @api_client.object_to_http_body(body)
|
340
299
|
auth_names = []
|
341
|
-
data, status_code, headers = @api_client.call_api(:
|
300
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
342
301
|
:header_params => header_params,
|
343
302
|
:query_params => query_params,
|
344
303
|
:form_params => form_params,
|
345
304
|
:body => post_body,
|
346
305
|
:auth_names => auth_names,
|
347
|
-
:return_type => '
|
306
|
+
:return_type => 'UpdateCustomerResponse')
|
348
307
|
if @api_client.config.debugging
|
349
|
-
@api_client.config.logger.debug "API called: CustomerApi#
|
308
|
+
@api_client.config.logger.debug "API called: CustomerApi#update_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
350
309
|
end
|
351
310
|
return data, status_code, headers
|
352
311
|
end
|