square_connect 2.0.0 → 2.0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -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"
|
@@ -20,53 +19,45 @@ module SquareConnect
|
|
20
19
|
|
21
20
|
# CreateCustomerCard
|
22
21
|
# Adds a card on file to an existing customer.
|
23
|
-
# @param authorization The value to provide in the Authorization header of
|
24
|
-
# @param customer_id
|
25
|
-
# @param body An object containing the fields to POST for the request
|
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 customer_id The ID of the customer to link the card on file to.
|
24
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
26
25
|
# @param [Hash] opts the optional parameters
|
27
26
|
# @return [CreateCustomerCardResponse]
|
28
27
|
def create_customer_card(authorization, customer_id, body, opts = {})
|
29
|
-
data,
|
28
|
+
data, _status_code, _headers = create_customer_card_with_http_info(authorization, customer_id, body, opts)
|
30
29
|
return data
|
31
30
|
end
|
32
31
|
|
33
32
|
# CreateCustomerCard
|
34
33
|
# Adds a card on file to an existing customer.
|
35
|
-
# @param authorization The value to provide in the Authorization header of
|
36
|
-
# @param customer_id
|
37
|
-
# @param body An object containing the fields to POST for the request
|
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 customer_id The ID of the customer to link the card on file to.
|
36
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
38
37
|
# @param [Hash] opts the optional parameters
|
39
38
|
# @return [Array<(CreateCustomerCardResponse, Fixnum, Hash)>] CreateCustomerCardResponse data, response status code and response headers
|
40
39
|
def create_customer_card_with_http_info(authorization, customer_id, body, opts = {})
|
41
40
|
if @api_client.config.debugging
|
42
|
-
@api_client.config.logger.debug "Calling API: CustomerCardApi
|
41
|
+
@api_client.config.logger.debug "Calling API: CustomerCardApi.create_customer_card ..."
|
43
42
|
end
|
44
|
-
|
45
43
|
# verify the required parameter 'authorization' is set
|
46
|
-
fail "Missing the required parameter 'authorization' when calling create_customer_card" if authorization.nil?
|
47
|
-
|
44
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling CustomerCardApi.create_customer_card" if authorization.nil?
|
48
45
|
# verify the required parameter 'customer_id' is set
|
49
|
-
fail "Missing the required parameter 'customer_id' when calling create_customer_card" if customer_id.nil?
|
50
|
-
|
46
|
+
fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerCardApi.create_customer_card" if customer_id.nil?
|
51
47
|
# verify the required parameter 'body' is set
|
52
|
-
fail "Missing the required parameter 'body' when calling create_customer_card" if body.nil?
|
53
|
-
|
48
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling CustomerCardApi.create_customer_card" if body.nil?
|
54
49
|
# resource path
|
55
|
-
|
50
|
+
local_var_path = "/v2/customers/{customer_id}/cards".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
|
56
51
|
|
57
52
|
# query parameters
|
58
53
|
query_params = {}
|
59
54
|
|
60
55
|
# header parameters
|
61
56
|
header_params = {}
|
62
|
-
|
63
57
|
# HTTP header 'Accept' (if needed)
|
64
|
-
|
65
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
66
|
-
|
58
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
67
59
|
# HTTP header 'Content-Type'
|
68
|
-
|
69
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
60
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
70
61
|
header_params[:'Authorization'] = authorization
|
71
62
|
|
72
63
|
# form parameters
|
@@ -74,9 +65,8 @@ module SquareConnect
|
|
74
65
|
|
75
66
|
# http body (model)
|
76
67
|
post_body = @api_client.object_to_http_body(body)
|
77
|
-
|
78
68
|
auth_names = []
|
79
|
-
data, status_code, headers = @api_client.call_api(:POST,
|
69
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
80
70
|
:header_params => header_params,
|
81
71
|
:query_params => query_params,
|
82
72
|
:form_params => form_params,
|
@@ -91,53 +81,45 @@ module SquareConnect
|
|
91
81
|
|
92
82
|
# DeleteCustomerCard
|
93
83
|
# Removes a card on file from a customer.
|
94
|
-
# @param authorization The value to provide in the Authorization header of
|
95
|
-
# @param customer_id
|
96
|
-
# @param card_id
|
84
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
85
|
+
# @param customer_id The ID of the customer that the card on file belongs to.
|
86
|
+
# @param card_id The ID of the card on file to delete.
|
97
87
|
# @param [Hash] opts the optional parameters
|
98
88
|
# @return [DeleteCustomerCardResponse]
|
99
89
|
def delete_customer_card(authorization, customer_id, card_id, opts = {})
|
100
|
-
data,
|
90
|
+
data, _status_code, _headers = delete_customer_card_with_http_info(authorization, customer_id, card_id, opts)
|
101
91
|
return data
|
102
92
|
end
|
103
93
|
|
104
94
|
# DeleteCustomerCard
|
105
95
|
# Removes a card on file from a customer.
|
106
|
-
# @param authorization The value to provide in the Authorization header of
|
107
|
-
# @param customer_id
|
108
|
-
# @param card_id
|
96
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
97
|
+
# @param customer_id The ID of the customer that the card on file belongs to.
|
98
|
+
# @param card_id The ID of the card on file to delete.
|
109
99
|
# @param [Hash] opts the optional parameters
|
110
100
|
# @return [Array<(DeleteCustomerCardResponse, Fixnum, Hash)>] DeleteCustomerCardResponse data, response status code and response headers
|
111
101
|
def delete_customer_card_with_http_info(authorization, customer_id, card_id, opts = {})
|
112
102
|
if @api_client.config.debugging
|
113
|
-
@api_client.config.logger.debug "Calling API: CustomerCardApi
|
103
|
+
@api_client.config.logger.debug "Calling API: CustomerCardApi.delete_customer_card ..."
|
114
104
|
end
|
115
|
-
|
116
105
|
# verify the required parameter 'authorization' is set
|
117
|
-
fail "Missing the required parameter 'authorization' when calling delete_customer_card" if authorization.nil?
|
118
|
-
|
106
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling CustomerCardApi.delete_customer_card" if authorization.nil?
|
119
107
|
# verify the required parameter 'customer_id' is set
|
120
|
-
fail "Missing the required parameter 'customer_id' when calling delete_customer_card" if customer_id.nil?
|
121
|
-
|
108
|
+
fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerCardApi.delete_customer_card" if customer_id.nil?
|
122
109
|
# verify the required parameter 'card_id' is set
|
123
|
-
fail "Missing the required parameter 'card_id' when calling delete_customer_card" if card_id.nil?
|
124
|
-
|
110
|
+
fail ArgumentError, "Missing the required parameter 'card_id' when calling CustomerCardApi.delete_customer_card" if card_id.nil?
|
125
111
|
# resource path
|
126
|
-
|
112
|
+
local_var_path = "/v2/customers/{customer_id}/cards/{card_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s).sub('{' + 'card_id' + '}', card_id.to_s)
|
127
113
|
|
128
114
|
# query parameters
|
129
115
|
query_params = {}
|
130
116
|
|
131
117
|
# header parameters
|
132
118
|
header_params = {}
|
133
|
-
|
134
119
|
# HTTP header 'Accept' (if needed)
|
135
|
-
|
136
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
137
|
-
|
120
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
138
121
|
# HTTP header 'Content-Type'
|
139
|
-
|
140
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
122
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
141
123
|
header_params[:'Authorization'] = authorization
|
142
124
|
|
143
125
|
# form parameters
|
@@ -145,9 +127,8 @@ module SquareConnect
|
|
145
127
|
|
146
128
|
# http body (model)
|
147
129
|
post_body = nil
|
148
|
-
|
149
130
|
auth_names = []
|
150
|
-
data, status_code, headers = @api_client.call_api(:DELETE,
|
131
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
151
132
|
:header_params => header_params,
|
152
133
|
:query_params => query_params,
|
153
134
|
:form_params => form_params,
|
@@ -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"
|
@@ -19,44 +18,38 @@ module SquareConnect
|
|
19
18
|
end
|
20
19
|
|
21
20
|
# ListLocations
|
22
|
-
# Provides
|
23
|
-
# @param authorization The value to provide in the Authorization header of
|
21
|
+
# Provides the details for all of a business's locations. Most other Connect API endpoints have a required `location_id` path parameter. The `id` field of the [`Location`](#type-location) objects returned by this endpoint correspond to that `location_id` parameter.
|
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`.
|
24
23
|
# @param [Hash] opts the optional parameters
|
25
24
|
# @return [ListLocationsResponse]
|
26
25
|
def list_locations(authorization, opts = {})
|
27
|
-
data,
|
26
|
+
data, _status_code, _headers = list_locations_with_http_info(authorization, opts)
|
28
27
|
return data
|
29
28
|
end
|
30
29
|
|
31
30
|
# ListLocations
|
32
|
-
# Provides
|
33
|
-
# @param authorization The value to provide in the Authorization header of
|
31
|
+
# Provides the details for all of a business's locations. Most other Connect API endpoints have a required `location_id` path parameter. The `id` field of the [`Location`](#type-location) objects returned by this endpoint correspond to that `location_id` parameter.
|
32
|
+
# @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
33
|
# @param [Hash] opts the optional parameters
|
35
34
|
# @return [Array<(ListLocationsResponse, Fixnum, Hash)>] ListLocationsResponse data, response status code and response headers
|
36
35
|
def list_locations_with_http_info(authorization, opts = {})
|
37
36
|
if @api_client.config.debugging
|
38
|
-
@api_client.config.logger.debug "Calling API: LocationApi
|
37
|
+
@api_client.config.logger.debug "Calling API: LocationApi.list_locations ..."
|
39
38
|
end
|
40
|
-
|
41
39
|
# verify the required parameter 'authorization' is set
|
42
|
-
fail "Missing the required parameter 'authorization' when calling list_locations" if authorization.nil?
|
43
|
-
|
40
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling LocationApi.list_locations" if authorization.nil?
|
44
41
|
# resource path
|
45
|
-
|
42
|
+
local_var_path = "/v2/locations".sub('{format}','json')
|
46
43
|
|
47
44
|
# query parameters
|
48
45
|
query_params = {}
|
49
46
|
|
50
47
|
# header parameters
|
51
48
|
header_params = {}
|
52
|
-
|
53
49
|
# HTTP header 'Accept' (if needed)
|
54
|
-
|
55
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
56
|
-
|
50
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
57
51
|
# HTTP header 'Content-Type'
|
58
|
-
|
59
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
52
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
60
53
|
header_params[:'Authorization'] = authorization
|
61
54
|
|
62
55
|
# form parameters
|
@@ -64,9 +57,8 @@ module SquareConnect
|
|
64
57
|
|
65
58
|
# http body (model)
|
66
59
|
post_body = nil
|
67
|
-
|
68
60
|
auth_names = []
|
69
|
-
data, status_code, headers = @api_client.call_api(:GET,
|
61
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
70
62
|
:header_params => header_params,
|
71
63
|
:query_params => query_params,
|
72
64
|
:form_params => form_params,
|
@@ -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,160 +17,141 @@ 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
|
24
|
-
# @param location_id The ID of the
|
20
|
+
# CreateRefund
|
21
|
+
# Initiates a refund for a previously charged tender.
|
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 original transaction's associated location.
|
24
|
+
# @param transaction_id The ID of the original transaction that includes the tender to refund.
|
25
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
25
26
|
# @param [Hash] opts the optional parameters
|
26
|
-
# @
|
27
|
-
|
28
|
-
|
29
|
-
# @option opts [String] :cursor A pagination cursor to retrieve the next set of results for your\noriginal query to the endpoint.
|
30
|
-
# @return [ListRefundsResponse]
|
31
|
-
def list_refunds(authorization, location_id, opts = {})
|
32
|
-
data, status_code, headers = list_refunds_with_http_info(authorization, location_id, opts)
|
27
|
+
# @return [CreateRefundResponse]
|
28
|
+
def create_refund(authorization, location_id, transaction_id, body, opts = {})
|
29
|
+
data, _status_code, _headers = create_refund_with_http_info(authorization, location_id, transaction_id, body, opts)
|
33
30
|
return data
|
34
31
|
end
|
35
32
|
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# @param authorization The value to provide in the Authorization header of
|
39
|
-
# @param location_id The ID of the
|
33
|
+
# CreateRefund
|
34
|
+
# Initiates a refund for a previously charged tender.
|
35
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
36
|
+
# @param location_id The ID of the original transaction's associated location.
|
37
|
+
# @param transaction_id The ID of the original transaction that includes the tender to refund.
|
38
|
+
# @param body An object containing the fields to POST for the request. See the corresponding object definition for field details.
|
40
39
|
# @param [Hash] opts the optional parameters
|
41
|
-
# @
|
42
|
-
|
43
|
-
# @option opts [String] :sort_order The order in which results are listed in the response.
|
44
|
-
# @option opts [String] :cursor A pagination cursor to retrieve the next set of results for your\noriginal query to the endpoint.
|
45
|
-
# @return [Array<(ListRefundsResponse, Fixnum, Hash)>] ListRefundsResponse data, response status code and response headers
|
46
|
-
def list_refunds_with_http_info(authorization, location_id, opts = {})
|
40
|
+
# @return [Array<(CreateRefundResponse, Fixnum, Hash)>] CreateRefundResponse data, response status code and response headers
|
41
|
+
def create_refund_with_http_info(authorization, location_id, transaction_id, body, opts = {})
|
47
42
|
if @api_client.config.debugging
|
48
|
-
@api_client.config.logger.debug "Calling API: RefundApi
|
43
|
+
@api_client.config.logger.debug "Calling API: RefundApi.create_refund ..."
|
49
44
|
end
|
50
|
-
|
51
45
|
# verify the required parameter 'authorization' is set
|
52
|
-
fail "Missing the required parameter 'authorization' when calling
|
53
|
-
|
46
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling RefundApi.create_refund" if authorization.nil?
|
54
47
|
# verify the required parameter 'location_id' is set
|
55
|
-
fail "Missing the required parameter 'location_id' when calling
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
48
|
+
fail ArgumentError, "Missing the required parameter 'location_id' when calling RefundApi.create_refund" if location_id.nil?
|
49
|
+
# verify the required parameter 'transaction_id' is set
|
50
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling RefundApi.create_refund" if transaction_id.nil?
|
51
|
+
# verify the required parameter 'body' is set
|
52
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling RefundApi.create_refund" if body.nil?
|
61
53
|
# resource path
|
62
|
-
|
54
|
+
local_var_path = "/v2/locations/{location_id}/transactions/{transaction_id}/refund".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s)
|
63
55
|
|
64
56
|
# query parameters
|
65
57
|
query_params = {}
|
66
|
-
query_params[:'begin_time'] = opts[:'begin_time'] if opts[:'begin_time']
|
67
|
-
query_params[:'end_time'] = opts[:'end_time'] if opts[:'end_time']
|
68
|
-
query_params[:'sort_order'] = opts[:'sort_order'] if opts[:'sort_order']
|
69
|
-
query_params[:'cursor'] = opts[:'cursor'] if opts[:'cursor']
|
70
58
|
|
71
59
|
# header parameters
|
72
60
|
header_params = {}
|
73
|
-
|
74
61
|
# HTTP header 'Accept' (if needed)
|
75
|
-
|
76
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
77
|
-
|
62
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
78
63
|
# HTTP header 'Content-Type'
|
79
|
-
|
80
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
64
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
81
65
|
header_params[:'Authorization'] = authorization
|
82
66
|
|
83
67
|
# form parameters
|
84
68
|
form_params = {}
|
85
69
|
|
86
70
|
# http body (model)
|
87
|
-
post_body =
|
88
|
-
|
71
|
+
post_body = @api_client.object_to_http_body(body)
|
89
72
|
auth_names = []
|
90
|
-
data, status_code, headers = @api_client.call_api(:
|
73
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
91
74
|
:header_params => header_params,
|
92
75
|
:query_params => query_params,
|
93
76
|
:form_params => form_params,
|
94
77
|
:body => post_body,
|
95
78
|
:auth_names => auth_names,
|
96
|
-
:return_type => '
|
79
|
+
:return_type => 'CreateRefundResponse')
|
97
80
|
if @api_client.config.debugging
|
98
|
-
@api_client.config.logger.debug "API called: RefundApi#
|
81
|
+
@api_client.config.logger.debug "API called: RefundApi#create_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
99
82
|
end
|
100
83
|
return data, status_code, headers
|
101
84
|
end
|
102
85
|
|
103
|
-
#
|
104
|
-
#
|
105
|
-
# @param authorization The value to provide in the Authorization header of
|
106
|
-
# @param location_id The ID of the
|
107
|
-
# @param transaction_id
|
108
|
-
# @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
|
86
|
+
# ListRefunds
|
87
|
+
# Lists refunds for one of a business's locations. Refunds with a `status` of `PENDING` are not currently included in this endpoint's response. Max results per [page](#paginatingresults): 50
|
88
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
89
|
+
# @param location_id The ID of the location to list refunds for.
|
109
90
|
# @param [Hash] opts the optional parameters
|
110
|
-
# @
|
111
|
-
|
112
|
-
|
91
|
+
# @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.
|
92
|
+
# @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.
|
93
|
+
# @option opts [String] :sort_order The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC`
|
94
|
+
# @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.
|
95
|
+
# @return [ListRefundsResponse]
|
96
|
+
def list_refunds(authorization, location_id, opts = {})
|
97
|
+
data, _status_code, _headers = list_refunds_with_http_info(authorization, location_id, opts)
|
113
98
|
return data
|
114
99
|
end
|
115
100
|
|
116
|
-
#
|
117
|
-
#
|
118
|
-
# @param authorization The value to provide in the Authorization header of
|
119
|
-
# @param location_id The ID of the
|
120
|
-
# @param transaction_id
|
121
|
-
# @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
|
101
|
+
# ListRefunds
|
102
|
+
# Lists refunds for one of a business's locations. Refunds with a `status` of `PENDING` are not currently included in this endpoint's response. Max results per [page](#paginatingresults): 50
|
103
|
+
# @param authorization The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
|
104
|
+
# @param location_id The ID of the location to list refunds for.
|
122
105
|
# @param [Hash] opts the optional parameters
|
123
|
-
# @
|
124
|
-
|
106
|
+
# @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.
|
107
|
+
# @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.
|
108
|
+
# @option opts [String] :sort_order The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC`
|
109
|
+
# @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.
|
110
|
+
# @return [Array<(ListRefundsResponse, Fixnum, Hash)>] ListRefundsResponse data, response status code and response headers
|
111
|
+
def list_refunds_with_http_info(authorization, location_id, opts = {})
|
125
112
|
if @api_client.config.debugging
|
126
|
-
@api_client.config.logger.debug "Calling API: RefundApi
|
113
|
+
@api_client.config.logger.debug "Calling API: RefundApi.list_refunds ..."
|
127
114
|
end
|
128
|
-
|
129
115
|
# verify the required parameter 'authorization' is set
|
130
|
-
fail "Missing the required parameter 'authorization' when calling
|
131
|
-
|
116
|
+
fail ArgumentError, "Missing the required parameter 'authorization' when calling RefundApi.list_refunds" if authorization.nil?
|
132
117
|
# verify the required parameter 'location_id' is set
|
133
|
-
fail "Missing the required parameter 'location_id' when calling
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
# verify the required parameter 'body' is set
|
139
|
-
fail "Missing the required parameter 'body' when calling create_refund" if body.nil?
|
140
|
-
|
118
|
+
fail ArgumentError, "Missing the required parameter 'location_id' when calling RefundApi.list_refunds" if location_id.nil?
|
119
|
+
if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])
|
120
|
+
fail ArgumentError, 'invalid value for "sort_order", must be one of DESC, ASC'
|
121
|
+
end
|
141
122
|
# resource path
|
142
|
-
|
123
|
+
local_var_path = "/v2/locations/{location_id}/refunds".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
|
143
124
|
|
144
125
|
# query parameters
|
145
126
|
query_params = {}
|
127
|
+
query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil?
|
128
|
+
query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
|
129
|
+
query_params[:'sort_order'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
|
130
|
+
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
|
146
131
|
|
147
132
|
# header parameters
|
148
133
|
header_params = {}
|
149
|
-
|
150
134
|
# HTTP header 'Accept' (if needed)
|
151
|
-
|
152
|
-
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
153
|
-
|
135
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
154
136
|
# HTTP header 'Content-Type'
|
155
|
-
|
156
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
137
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
157
138
|
header_params[:'Authorization'] = authorization
|
158
139
|
|
159
140
|
# form parameters
|
160
141
|
form_params = {}
|
161
142
|
|
162
143
|
# http body (model)
|
163
|
-
post_body =
|
164
|
-
|
144
|
+
post_body = nil
|
165
145
|
auth_names = []
|
166
|
-
data, status_code, headers = @api_client.call_api(:
|
146
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
167
147
|
:header_params => header_params,
|
168
148
|
:query_params => query_params,
|
169
149
|
:form_params => form_params,
|
170
150
|
:body => post_body,
|
171
151
|
:auth_names => auth_names,
|
172
|
-
:return_type => '
|
152
|
+
:return_type => 'ListRefundsResponse')
|
173
153
|
if @api_client.config.debugging
|
174
|
-
@api_client.config.logger.debug "API called: RefundApi#
|
154
|
+
@api_client.config.logger.debug "API called: RefundApi#list_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
175
155
|
end
|
176
156
|
return data, status_code, headers
|
177
157
|
end
|