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
@@ -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\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
24
- # @param customer_id
25
- # @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
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, status_code, headers = create_customer_card_with_http_info(authorization, customer_id, body, opts)
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\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
36
- # @param customer_id
37
- # @param body An object containing the fields to POST for the request.\n\nSee the corresponding object definition for field details.
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#create_customer_card ..."
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
- path = "/v2/customers/{customer_id}/cards".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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, path,
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\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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, status_code, headers = delete_customer_card_with_http_info(authorization, customer_id, card_id, opts)
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\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
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#delete_customer_card ..."
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
- 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)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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, path,
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 summary information for all of a business&#39;s locations.
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`.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
24
23
  # @param [Hash] opts the optional parameters
25
24
  # @return [ListLocationsResponse]
26
25
  def list_locations(authorization, opts = {})
27
- data, status_code, headers = list_locations_with_http_info(authorization, opts)
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 summary information for all of a business&#39;s locations.
33
- # @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
+ # Provides the details for all of a business&#39;s locations. Most other Connect API endpoints have a required &#x60;location_id&#x60; path parameter. The &#x60;id&#x60; field of the [&#x60;Location&#x60;](#type-location) objects returned by this endpoint correspond to that &#x60;location_id&#x60; parameter.
32
+ # @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
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#list_locations ..."
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
- path = "/v2/locations".sub('{format}','json')
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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, path,
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
- # ListRefunds
22
- # Lists refunds for one of a business&#39;s locations.
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`.
24
- # @param location_id The ID of the location to list refunds for.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
23
+ # @param location_id The ID of the original transaction&#39;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
- # @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format.
27
- # @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format.
28
- # @option opts [String] :sort_order The order in which results are listed in the response.
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
- # ListRefunds
37
- # Lists refunds for one of a business&#39;s locations.
38
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
39
- # @param location_id The ID of the location to list refunds for.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
36
+ # @param location_id The ID of the original transaction&#39;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
- # @option opts [String] :begin_time The beginning of the requested reporting period, in RFC 3339 format.
42
- # @option opts [String] :end_time The end of the requested reporting period, in RFC 3339 format.
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#list_refunds ..."
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 list_refunds" if authorization.nil?
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 list_refunds" if location_id.nil?
56
-
57
- if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order'])
58
- fail 'invalid value for "sort_order", must be one of DESC, ASC'
59
- end
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
- path = "/v2/locations/{location_id}/refunds".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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 = nil
88
-
71
+ post_body = @api_client.object_to_http_body(body)
89
72
  auth_names = []
90
- data, status_code, headers = @api_client.call_api(:GET, path,
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 => 'ListRefundsResponse')
79
+ :return_type => 'CreateRefundResponse')
97
80
  if @api_client.config.debugging
98
- @api_client.config.logger.debug "API called: RefundApi#list_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
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
- # CreateRefund
104
- # Initiates a refund for a previously charged tender.
105
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
106
- # @param location_id The ID of the original transaction&#39;s associated location.
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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
89
+ # @param location_id The ID of the location to list refunds for.
109
90
  # @param [Hash] opts the optional parameters
110
- # @return [CreateRefundResponse]
111
- def create_refund(authorization, location_id, transaction_id, body, opts = {})
112
- data, status_code, headers = create_refund_with_http_info(authorization, location_id, transaction_id, body, opts)
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 (&#x60;ASC&#x60; for oldest first, &#x60;DESC&#x60; for newest first). Default value: &#x60;DESC&#x60;
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
- # CreateRefund
117
- # Initiates a refund for a previously charged tender.
118
- # @param authorization The value to provide in the Authorization header of\nyour request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`.
119
- # @param location_id The ID of the original transaction&#39;s associated location.
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&#39;s locations. Refunds with a &#x60;status&#x60; of &#x60;PENDING&#x60; are not currently included in this endpoint&#39;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 &#x60;Bearer YOUR_ACCESS_TOKEN_HERE&#x60;.
104
+ # @param location_id The ID of the location to list refunds for.
122
105
  # @param [Hash] opts the optional parameters
123
- # @return [Array<(CreateRefundResponse, Fixnum, Hash)>] CreateRefundResponse data, response status code and response headers
124
- def create_refund_with_http_info(authorization, location_id, transaction_id, body, opts = {})
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 (&#x60;ASC&#x60; for oldest first, &#x60;DESC&#x60; for newest first). Default value: &#x60;DESC&#x60;
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#create_refund ..."
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 create_refund" if authorization.nil?
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 create_refund" if location_id.nil?
134
-
135
- # verify the required parameter 'transaction_id' is set
136
- fail "Missing the required parameter 'transaction_id' when calling create_refund" if transaction_id.nil?
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
- 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)
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
- _header_accept = ['application/json']
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
- _header_content_type = ['application/json']
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 = @api_client.object_to_http_body(body)
164
-
144
+ post_body = nil
165
145
  auth_names = []
166
- data, status_code, headers = @api_client.call_api(:POST, path,
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 => 'CreateRefundResponse')
152
+ :return_type => 'ListRefundsResponse')
173
153
  if @api_client.config.debugging
174
- @api_client.config.logger.debug "API called: RefundApi#create_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
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