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.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/README.md +151 -9
  4. data/Rakefile +8 -0
  5. data/docs/Address.md +26 -0
  6. data/docs/CaptureTransactionRequest.md +11 -0
  7. data/docs/CaptureTransactionResponse.md +12 -0
  8. data/docs/Card.md +18 -0
  9. data/docs/CardBrand.md +20 -0
  10. data/docs/ChargeRequest.md +22 -0
  11. data/docs/ChargeResponse.md +13 -0
  12. data/docs/Checkout.md +20 -0
  13. data/docs/CheckoutApi.md +62 -0
  14. data/docs/Country.md +261 -0
  15. data/docs/CreateCheckoutRequest.md +18 -0
  16. data/docs/CreateCheckoutResponse.md +13 -0
  17. data/docs/CreateCustomerCardRequest.md +14 -0
  18. data/docs/CreateCustomerCardResponse.md +13 -0
  19. data/docs/CreateCustomerRequest.md +20 -0
  20. data/docs/CreateCustomerResponse.md +13 -0
  21. data/docs/CreateOrderRequest.md +13 -0
  22. data/docs/CreateOrderRequestLineItem.md +14 -0
  23. data/docs/CreateOrderRequestOrder.md +13 -0
  24. data/docs/CreateRefundRequest.md +15 -0
  25. data/docs/CreateRefundResponse.md +13 -0
  26. data/docs/Currency.md +191 -0
  27. data/docs/Customer.md +26 -0
  28. data/docs/CustomerApi.md +267 -0
  29. data/docs/CustomerCardApi.md +116 -0
  30. data/docs/CustomerGroupInfo.md +13 -0
  31. data/docs/CustomerPreferences.md +12 -0
  32. data/docs/DeleteCustomerCardRequest.md +11 -0
  33. data/docs/DeleteCustomerCardResponse.md +12 -0
  34. data/docs/DeleteCustomerRequest.md +11 -0
  35. data/docs/DeleteCustomerResponse.md +12 -0
  36. data/docs/Error.md +15 -0
  37. data/docs/ErrorCategory.md +17 -0
  38. data/docs/ErrorCode.md +83 -0
  39. data/docs/ListCustomersRequest.md +12 -0
  40. data/docs/ListCustomersResponse.md +14 -0
  41. data/docs/ListLocationsRequest.md +11 -0
  42. data/docs/ListLocationsResponse.md +13 -0
  43. data/docs/ListRefundsRequest.md +15 -0
  44. data/docs/ListRefundsResponse.md +14 -0
  45. data/docs/ListTransactionsRequest.md +15 -0
  46. data/docs/ListTransactionsResponse.md +14 -0
  47. data/docs/Location.md +16 -0
  48. data/docs/LocationApi.md +56 -0
  49. data/docs/LocationCapability.md +12 -0
  50. data/docs/Money.md +13 -0
  51. data/docs/Order.md +16 -0
  52. data/docs/OrderLineItem.md +16 -0
  53. data/docs/Refund.md +20 -0
  54. data/docs/RefundApi.md +126 -0
  55. data/docs/RefundStatus.md +15 -0
  56. data/docs/RetrieveCustomerRequest.md +11 -0
  57. data/docs/RetrieveCustomerResponse.md +13 -0
  58. data/docs/RetrieveTransactionRequest.md +11 -0
  59. data/docs/RetrieveTransactionResponse.md +13 -0
  60. data/docs/SortOrder.md +13 -0
  61. data/docs/Tender.md +22 -0
  62. data/docs/TenderCardDetails.md +14 -0
  63. data/docs/TenderCardDetailsEntryMethod.md +16 -0
  64. data/docs/TenderCardDetailsStatus.md +15 -0
  65. data/docs/TenderCashDetails.md +13 -0
  66. data/docs/TenderType.md +17 -0
  67. data/docs/Transaction.md +21 -0
  68. data/docs/TransactionApi.md +285 -0
  69. data/docs/TransactionProduct.md +19 -0
  70. data/docs/UpdateCustomerRequest.md +20 -0
  71. data/docs/UpdateCustomerResponse.md +13 -0
  72. data/docs/VoidTransactionRequest.md +11 -0
  73. data/docs/VoidTransactionResponse.md +12 -0
  74. data/lib/square_connect.rb +33 -16
  75. data/lib/square_connect/api/checkout_api.rb +82 -0
  76. data/lib/square_connect/api/customer_api.rb +121 -162
  77. data/lib/square_connect/api/customer_card_api.rb +31 -50
  78. data/lib/square_connect/api/location_api.rb +12 -20
  79. data/lib/square_connect/api/refund_api.rb +70 -90
  80. data/lib/square_connect/api/transaction_api.rb +119 -165
  81. data/lib/square_connect/api_client.rb +64 -17
  82. data/lib/square_connect/api_error.rb +7 -3
  83. data/lib/square_connect/configuration.rb +31 -1
  84. data/lib/square_connect/models/address.rb +149 -78
  85. data/lib/square_connect/models/capture_transaction_request.rb +176 -0
  86. data/lib/square_connect/models/capture_transaction_response.rb +54 -26
  87. data/lib/square_connect/models/card.rb +98 -52
  88. data/lib/square_connect/models/card_brand.rb +12 -133
  89. data/lib/square_connect/models/charge_request.rb +106 -67
  90. data/lib/square_connect/models/charge_response.rb +57 -30
  91. data/lib/square_connect/models/checkout.rb +266 -0
  92. data/lib/square_connect/models/country.rb +253 -133
  93. data/lib/square_connect/models/create_checkout_request.rb +316 -0
  94. data/lib/square_connect/models/create_checkout_response.rb +198 -0
  95. data/lib/square_connect/models/create_customer_card_request.rb +66 -35
  96. data/lib/square_connect/models/create_customer_card_response.rb +58 -31
  97. data/lib/square_connect/models/create_customer_request.rb +79 -59
  98. data/lib/square_connect/models/create_customer_response.rb +58 -31
  99. data/lib/square_connect/models/create_order_request.rb +234 -0
  100. data/lib/square_connect/models/create_order_request_line_item.rb +268 -0
  101. data/lib/square_connect/models/create_order_request_order.rb +219 -0
  102. data/lib/square_connect/models/create_refund_request.rb +79 -39
  103. data/lib/square_connect/models/create_refund_response.rb +57 -30
  104. data/lib/square_connect/models/currency.rb +183 -133
  105. data/lib/square_connect/models/customer.rb +130 -77
  106. data/lib/square_connect/models/customer_group_info.rb +206 -0
  107. data/lib/square_connect/models/customer_preferences.rb +186 -0
  108. data/lib/square_connect/models/delete_customer_card_request.rb +176 -0
  109. data/lib/square_connect/models/delete_customer_card_response.rb +55 -27
  110. data/lib/square_connect/models/delete_customer_request.rb +176 -0
  111. data/lib/square_connect/models/delete_customer_response.rb +55 -27
  112. data/lib/square_connect/models/error.rb +107 -45
  113. data/lib/square_connect/models/error_category.rb +9 -133
  114. data/lib/square_connect/models/error_code.rb +75 -133
  115. data/lib/square_connect/models/list_customers_request.rb +55 -27
  116. data/lib/square_connect/models/list_customers_response.rb +61 -35
  117. data/lib/square_connect/models/list_locations_request.rb +176 -0
  118. data/lib/square_connect/models/list_locations_response.rb +57 -30
  119. data/lib/square_connect/models/list_refunds_request.rb +91 -42
  120. data/lib/square_connect/models/list_refunds_response.rb +59 -33
  121. data/lib/square_connect/models/list_transactions_request.rb +91 -42
  122. data/lib/square_connect/models/list_transactions_response.rb +59 -33
  123. data/lib/square_connect/models/location.rb +86 -41
  124. data/lib/square_connect/models/location_capability.rb +4 -133
  125. data/lib/square_connect/models/money.rb +85 -34
  126. data/lib/square_connect/models/order.rb +228 -0
  127. data/lib/square_connect/models/order_line_item.rb +226 -0
  128. data/lib/square_connect/models/refund.rb +138 -59
  129. data/lib/square_connect/models/refund_status.rb +7 -133
  130. data/lib/square_connect/models/retrieve_customer_request.rb +176 -0
  131. data/lib/square_connect/models/retrieve_customer_response.rb +58 -31
  132. data/lib/square_connect/models/retrieve_transaction_request.rb +176 -0
  133. data/lib/square_connect/models/retrieve_transaction_response.rb +57 -30
  134. data/lib/square_connect/models/sort_order.rb +5 -133
  135. data/lib/square_connect/models/tender.rb +112 -65
  136. data/lib/square_connect/models/tender_card_details.rb +93 -40
  137. data/lib/square_connect/models/tender_card_details_entry_method.rb +8 -133
  138. data/lib/square_connect/models/tender_card_details_status.rb +7 -133
  139. data/lib/square_connect/models/tender_cash_details.rb +58 -31
  140. data/lib/square_connect/models/tender_type.rb +9 -133
  141. data/lib/square_connect/models/transaction.rb +132 -56
  142. data/lib/square_connect/models/transaction_product.rb +11 -133
  143. data/lib/square_connect/models/update_customer_request.rb +79 -59
  144. data/lib/square_connect/models/update_customer_response.rb +58 -31
  145. data/lib/square_connect/models/void_transaction_request.rb +176 -0
  146. data/lib/square_connect/models/void_transaction_response.rb +54 -26
  147. data/lib/square_connect/version.rb +2 -3
  148. data/spec/api/checkout_api_spec.rb +53 -0
  149. data/spec/api/customer_api_spec.rb +121 -0
  150. data/spec/api/customer_card_api_spec.rb +71 -0
  151. data/spec/api/location_api_spec.rb +58 -0
  152. data/spec/api/refund_api_spec.rb +75 -0
  153. data/spec/api/transaction_api_spec.rb +128 -0
  154. data/spec/api_client_spec.rb +226 -0
  155. data/spec/configuration_spec.rb +42 -0
  156. data/spec/models/address_spec.rb +186 -0
  157. data/spec/models/capture_transaction_request_spec.rb +36 -0
  158. data/spec/models/capture_transaction_response_spec.rb +46 -0
  159. data/spec/models/card_brand_spec.rb +36 -0
  160. data/spec/models/card_spec.rb +106 -0
  161. data/spec/models/charge_request_spec.rb +146 -0
  162. data/spec/models/charge_response_spec.rb +56 -0
  163. data/spec/models/checkout_spec.rb +126 -0
  164. data/spec/models/country_spec.rb +36 -0
  165. data/spec/models/create_checkout_request_spec.rb +106 -0
  166. data/spec/models/create_checkout_response_spec.rb +56 -0
  167. data/spec/models/create_customer_card_request_spec.rb +66 -0
  168. data/spec/models/create_customer_card_response_spec.rb +56 -0
  169. data/spec/models/create_customer_request_spec.rb +126 -0
  170. data/spec/models/create_customer_response_spec.rb +56 -0
  171. data/spec/models/create_order_request_line_item_spec.rb +66 -0
  172. data/spec/models/create_order_request_order_spec.rb +56 -0
  173. data/spec/models/create_order_request_spec.rb +56 -0
  174. data/spec/models/create_refund_request_spec.rb +76 -0
  175. data/spec/models/create_refund_response_spec.rb +56 -0
  176. data/spec/models/currency_spec.rb +36 -0
  177. data/spec/models/customer_group_info_spec.rb +56 -0
  178. data/spec/models/customer_preferences_spec.rb +46 -0
  179. data/spec/models/customer_spec.rb +186 -0
  180. data/spec/models/delete_customer_card_request_spec.rb +36 -0
  181. data/spec/models/delete_customer_card_response_spec.rb +46 -0
  182. data/spec/models/delete_customer_request_spec.rb +36 -0
  183. data/spec/models/delete_customer_response_spec.rb +46 -0
  184. data/spec/models/error_category_spec.rb +36 -0
  185. data/spec/models/error_code_spec.rb +36 -0
  186. data/spec/models/error_spec.rb +76 -0
  187. data/spec/models/list_customers_request_spec.rb +46 -0
  188. data/spec/models/list_customers_response_spec.rb +66 -0
  189. data/spec/models/list_locations_request_spec.rb +36 -0
  190. data/spec/models/list_locations_response_spec.rb +56 -0
  191. data/spec/models/list_refunds_request_spec.rb +76 -0
  192. data/spec/models/list_refunds_response_spec.rb +66 -0
  193. data/spec/models/list_transactions_request_spec.rb +76 -0
  194. data/spec/models/list_transactions_response_spec.rb +66 -0
  195. data/spec/models/location_capability_spec.rb +36 -0
  196. data/spec/models/location_spec.rb +86 -0
  197. data/spec/models/money_spec.rb +56 -0
  198. data/spec/models/order_line_item_spec.rb +86 -0
  199. data/spec/models/order_spec.rb +86 -0
  200. data/spec/models/refund_spec.rb +126 -0
  201. data/spec/models/refund_status_spec.rb +36 -0
  202. data/spec/models/retrieve_customer_request_spec.rb +36 -0
  203. data/spec/models/retrieve_customer_response_spec.rb +56 -0
  204. data/spec/models/retrieve_transaction_request_spec.rb +36 -0
  205. data/spec/models/retrieve_transaction_response_spec.rb +56 -0
  206. data/spec/models/sort_order_spec.rb +36 -0
  207. data/spec/models/tender_card_details_entry_method_spec.rb +36 -0
  208. data/spec/models/tender_card_details_spec.rb +66 -0
  209. data/spec/models/tender_card_details_status_spec.rb +36 -0
  210. data/spec/models/tender_cash_details_spec.rb +56 -0
  211. data/spec/models/tender_spec.rb +146 -0
  212. data/spec/models/tender_type_spec.rb +36 -0
  213. data/spec/models/transaction_product_spec.rb +36 -0
  214. data/spec/models/transaction_spec.rb +136 -0
  215. data/spec/models/update_customer_request_spec.rb +126 -0
  216. data/spec/models/update_customer_response_spec.rb +56 -0
  217. data/spec/models/void_transaction_request_spec.rb +36 -0
  218. data/spec/models/void_transaction_response_spec.rb +46 -0
  219. data/spec/spec_helper.rb +115 -0
  220. data/square_connect.gemspec +22 -11
  221. data/travis-ci/accounts.enc +0 -0
  222. 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
- # ListCustomers
22
- # Lists a business&#39;s customers.
23
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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
- # @option opts [String] :cursor
26
- # @return [ListCustomersResponse]
27
- def list_customers(authorization, opts = {})
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
- # ListCustomers
33
- # Lists a business&#39;s customers.
34
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
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: - &#x60;given_name&#x60; - &#x60;family_name&#x60; - &#x60;company_name&#x60; - &#x60;email_address&#x60; - &#x60;phone_number&#x60; 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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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
- # @option opts [String] :cursor
37
- # @return [Array<(ListCustomersResponse, Fixnum, Hash)>] ListCustomersResponse data, response status code and response headers
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#list_customers ..."
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 list_customers" if authorization.nil?
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
- path = "/v2/customers".sub('{format}','json')
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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 = nil
70
-
63
+ post_body = @api_client.object_to_http_body(body)
71
64
  auth_names = []
72
- data, status_code, headers = @api_client.call_api(:GET, path,
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 => 'ListCustomersResponse')
71
+ :return_type => 'CreateCustomerResponse')
79
72
  if @api_client.config.debugging
80
- @api_client.config.logger.debug "API called: CustomerApi#list_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
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
- # CreateCustomer
86
- # Creates a new customer for the business, which can have associated cards on file.
87
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
88
- # @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
81
+ # @param customer_id The ID of the customer to delete.
89
82
  # @param [Hash] opts the optional parameters
90
- # @return [CreateCustomerResponse]
91
- def create_customer(authorization, body, opts = {})
92
- data, status_code, headers = create_customer_with_http_info(authorization, body, opts)
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
- # CreateCustomer
97
- # Creates a new customer for the business, which can have associated cards on file.
98
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
99
- # @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
92
+ # @param customer_id The ID of the customer to delete.
100
93
  # @param [Hash] opts the optional parameters
101
- # @return [Array<(CreateCustomerResponse, Fixnum, Hash)>] CreateCustomerResponse data, response status code and response headers
102
- def create_customer_with_http_info(authorization, body, opts = {})
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#create_customer ..."
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 create_customer" if authorization.nil?
109
-
110
- # verify the required parameter 'body' is set
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
- path = "/v2/customers".sub('{format}','json')
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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 = @api_client.object_to_http_body(body)
136
-
121
+ post_body = nil
137
122
  auth_names = []
138
- data, status_code, headers = @api_client.call_api(:POST, path,
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 => 'CreateCustomerResponse')
129
+ :return_type => 'DeleteCustomerResponse')
145
130
  if @api_client.config.debugging
146
- @api_client.config.logger.debug "API called: CustomerApi#create_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
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
- # RetrieveCustomer
152
- # Returns details for a single customer.
153
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
155
139
  # @param [Hash] opts the optional parameters
156
- # @return [RetrieveCustomerResponse]
157
- def retrieve_customer(authorization, customer_id, opts = {})
158
- data, status_code, headers = retrieve_customer_with_http_info(authorization, customer_id, opts)
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
- # RetrieveCustomer
163
- # Returns details for a single customer.
164
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
165
- # @param customer_id
147
+ # ListCustomers
148
+ # Lists a business&#39;s customers.
149
+ # @param authorization The value to provide in the Authorization header of your request. This value should follow the format &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
166
150
  # @param [Hash] opts the optional parameters
167
- # @return [Array<(RetrieveCustomerResponse, Fixnum, Hash)>] RetrieveCustomerResponse data, response status code and response headers
168
- def retrieve_customer_with_http_info(authorization, customer_id, opts = {})
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#retrieve_customer ..."
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 retrieve_customer" if authorization.nil?
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
- path = "/v2/customers/{customer_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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, path,
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 => 'RetrieveCustomerResponse')
186
+ :return_type => 'ListCustomersResponse')
211
187
  if @api_client.config.debugging
212
- @api_client.config.logger.debug "API called: CustomerApi#retrieve_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
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
- # UpdateCustomer
218
- # Updates the details of an existing customer.
219
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
220
- # @param customer_id The customer to update.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
196
+ # @param customer_id The ID of the customer to retrieve.
222
197
  # @param [Hash] opts the optional parameters
223
- # @return [UpdateCustomerResponse]
224
- def update_customer(authorization, customer_id, body, opts = {})
225
- data, status_code, headers = update_customer_with_http_info(authorization, customer_id, body, opts)
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
- # UpdateCustomer
230
- # Updates the details of an existing customer.
231
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
232
- # @param customer_id The customer to update.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
207
+ # @param customer_id The ID of the customer to retrieve.
234
208
  # @param [Hash] opts the optional parameters
235
- # @return [Array<(UpdateCustomerResponse, Fixnum, Hash)>] UpdateCustomerResponse data, response status code and response headers
236
- def update_customer_with_http_info(authorization, customer_id, body, opts = {})
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#update_customer ..."
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 update_customer" if authorization.nil?
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 update_customer" if customer_id.nil?
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
- path = "/v2/customers/{customer_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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 = @api_client.object_to_http_body(body)
273
-
236
+ post_body = nil
274
237
  auth_names = []
275
- data, status_code, headers = @api_client.call_api(:PUT, path,
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 => 'UpdateCustomerResponse')
244
+ :return_type => 'RetrieveCustomerResponse')
282
245
  if @api_client.config.debugging
283
- @api_client.config.logger.debug "API called: CustomerApi#update_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
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
- # DeleteCustomer
289
- # Deletes a customer from a business.
290
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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 [DeleteCustomerResponse]
294
- def delete_customer(authorization, customer_id, opts = {})
295
- data, status_code, headers = delete_customer_with_http_info(authorization, customer_id, opts)
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
- # DeleteCustomer
300
- # Deletes a customer from a business.
301
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
302
- # @param customer_id
263
+ # UpdateCustomer
264
+ # Updates the details of an existing customer. You cannot edit a customer&#39;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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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<(DeleteCustomerResponse, Fixnum, Hash)>] DeleteCustomerResponse data, response status code and response headers
305
- def delete_customer_with_http_info(authorization, customer_id, opts = {})
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#delete_customer ..."
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 delete_customer" if authorization.nil?
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 delete_customer" if customer_id.nil?
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
- path = "/v2/customers/{customer_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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 = nil
339
-
298
+ post_body = @api_client.object_to_http_body(body)
340
299
  auth_names = []
341
- data, status_code, headers = @api_client.call_api(:DELETE, path,
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 => 'DeleteCustomerResponse')
306
+ :return_type => 'UpdateCustomerResponse')
348
307
  if @api_client.config.debugging
349
- @api_client.config.logger.debug "API called: CustomerApi#delete_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
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