square.rb 6.2.0.20200812 → 8.0.0.20201216

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -33
  3. data/lib/square.rb +61 -62
  4. data/lib/square/api/apple_pay_api.rb +5 -3
  5. data/lib/square/api/bank_accounts_api.rb +16 -19
  6. data/lib/square/api/base_api.rb +1 -1
  7. data/lib/square/api/bookings_api.rb +308 -0
  8. data/lib/square/api/cash_drawers_api.rb +13 -6
  9. data/lib/square/api/catalog_api.rb +68 -32
  10. data/lib/square/api/checkout_api.rb +4 -2
  11. data/lib/square/api/customer_groups_api.rb +18 -8
  12. data/lib/square/api/customer_segments_api.rb +9 -5
  13. data/lib/square/api/customers_api.rb +47 -27
  14. data/lib/square/api/devices_api.rb +17 -6
  15. data/lib/square/api/disputes_api.rb +71 -68
  16. data/lib/square/api/employees_api.rb +10 -5
  17. data/lib/square/api/inventory_api.rb +30 -15
  18. data/lib/square/api/invoices_api.rb +42 -38
  19. data/lib/square/api/labor_api.rb +131 -22
  20. data/lib/square/api/locations_api.rb +16 -13
  21. data/lib/square/api/loyalty_api.rb +60 -66
  22. data/lib/square/api/merchants_api.rb +7 -3
  23. data/lib/square/api/mobile_authorization_api.rb +5 -3
  24. data/lib/square/api/o_auth_api.rb +11 -8
  25. data/lib/square/api/orders_api.rb +111 -90
  26. data/lib/square/api/payments_api.rb +75 -65
  27. data/lib/square/api/refunds_api.rb +37 -27
  28. data/lib/square/api/subscriptions_api.rb +29 -28
  29. data/lib/square/api/team_api.rb +46 -30
  30. data/lib/square/api/terminal_api.rb +156 -7
  31. data/lib/square/api/transactions_api.rb +32 -18
  32. data/lib/square/api/v1_employees_api.rb +59 -31
  33. data/lib/square/api/v1_items_api.rb +195 -115
  34. data/lib/square/api/v1_transactions_api.rb +49 -27
  35. data/lib/square/api_helper.rb +14 -9
  36. data/lib/square/client.rb +14 -20
  37. data/lib/square/configuration.rb +2 -2
  38. data/lib/square/http/api_response.rb +2 -0
  39. data/lib/square/http/faraday_client.rb +9 -2
  40. data/spec/user_journey_spec.rb +2 -5
  41. data/test/api/api_test_base.rb +1 -6
  42. data/test/api/test_catalog_api.rb +1 -4
  43. data/test/api/test_customers_api.rb +1 -4
  44. data/test/api/test_employees_api.rb +1 -4
  45. data/test/api/test_labor_api.rb +2 -6
  46. data/test/api/test_locations_api.rb +22 -33
  47. data/test/api/test_merchants_api.rb +1 -4
  48. data/test/api/test_payments_api.rb +3 -6
  49. data/test/api/test_refunds_api.rb +3 -6
  50. data/test/http_response_catcher.rb +0 -5
  51. data/test/test_helper.rb +0 -5
  52. metadata +33 -16
  53. data/lib/square/api/reporting_api.rb +0 -138
  54. data/lib/square/api/v1_locations_api.rb +0 -65
@@ -1,7 +1,4 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
1
+
5
2
 
6
3
  require_relative 'api_test_base'
7
4
 
@@ -35,12 +32,11 @@ class LaborApiTests < ApiTestBase
35
32
  # Returns a paginated list of `EmployeeWage` instances for a business.
36
33
  def test_list_employee_wages()
37
34
  # Parameters for the API call
38
- employee_id = nil
39
35
  limit = nil
40
36
  cursor = nil
41
37
 
42
38
  # Perform the API call through the SDK function
43
- result = @controller.list_employee_wages(employee_id: employee_id, limit: limit, cursor: cursor)
39
+ result = @controller.list_employee_wages(limit: limit, cursor: cursor)
44
40
 
45
41
  # Test response code
46
42
  assert_equal(200, @response_catcher.response.status_code)
@@ -1,35 +1,24 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- require_relative 'api_test_base'
7
-
8
- class LocationsApiTests < ApiTestBase
9
- # Called only once for the class before any test has executed
10
- def setup
11
- @response_catcher = HttpResponseCatcher.new
12
- @controller = LocationsApi.new CONFIG, http_call_back: @response_catcher
13
- end
14
-
15
- # Provides the details for all of a business's locations.
1
+ require_relative 'api_test_base'
2
+
3
+ class LocationsApiTests < ApiTestBase
4
+ # Called only once for the class before any test has executed
5
+ def setup
6
+ @response_catcher = HttpResponseCatcher.new
7
+ @controller = LocationsApi.new CONFIG, http_call_back: @response_catcher
8
+ end
9
+
10
+ # Provides information of all locations of a business.
16
11
  #
17
- #Most other Connect API endpoints have a required `location_id` path parameter.
12
+ #Many Square API endpoints require a `location_id` parameter.
18
13
  #The `id` field of the [`Location`](#type-location) objects returned by this
19
- #endpoint correspond to that `location_id` parameter.
20
- def test_test_list_locations()
21
-
22
- # Perform the API call through the SDK function
23
- result = @controller.list_locations()
24
-
25
- # Test response code
26
- assert_equal(200, @response_catcher.response.status_code)
27
-
28
- # Test headers
29
- expected_headers = {}
30
- expected_headers['content-type'] = 'application/json'
31
-
32
- assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))
33
- end
34
-
35
- end
14
+ #endpoint correspond to that `location_id` parameter.
15
+ def test_list_locations()
16
+
17
+ # Perform the API call through the SDK function
18
+ result = @controller.list_locations()
19
+
20
+ # Test response code
21
+ assert_equal(200, @response_catcher.response.status_code)
22
+ end
23
+
24
+ end
@@ -1,7 +1,4 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
1
+
5
2
 
6
3
  require_relative 'api_test_base'
7
4
 
@@ -1,7 +1,4 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
1
+
5
2
 
6
3
  require_relative 'api_test_base'
7
4
 
@@ -12,8 +9,8 @@ class PaymentsApiTests < ApiTestBase
12
9
  @controller = PaymentsApi.new CONFIG, http_call_back: @response_catcher
13
10
  end
14
11
 
15
- # Retrieves a list of payments taken by the account making the request.
16
- #
12
+ # Retrieves a list of payments taken by the account making the request.
13
+ #
17
14
  #Max results per page: 100
18
15
  def test_test_list_payments()
19
16
  # Parameters for the API call
@@ -1,7 +1,4 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
1
+
5
2
 
6
3
  require_relative 'api_test_base'
7
4
 
@@ -12,8 +9,8 @@ class RefundsApiTests < ApiTestBase
12
9
  @controller = RefundsApi.new CONFIG, http_call_back: @response_catcher
13
10
  end
14
11
 
15
- # Retrieves a list of refunds for the account making the request.
16
- #
12
+ # Retrieves a list of refunds for the account making the request.
13
+ #
17
14
  #Max results per page: 100
18
15
  def test_test_list_payment_refunds()
19
16
  # Parameters for the API call
@@ -1,8 +1,3 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
1
  class HttpResponseCatcher < Square::HttpCallBack
7
2
  attr_accessor :response
8
3
 
@@ -1,8 +1,3 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
1
  require 'tempfile'
7
2
  require 'open-uri'
8
3
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: square.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0.20200812
4
+ version: 8.0.0.20201216
5
5
  platform: ruby
6
6
  authors:
7
7
  - Square Developer Platform
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-12 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -16,42 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.2'
19
+ version: '2.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.2'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.15'
33
+ version: '1.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.0.1
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: '0.15'
43
+ version: '1.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.1
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: faraday_middleware
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '0.13'
53
+ version: '1.0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '0.13'
60
+ version: '1.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: certifi
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +65,9 @@ dependencies:
59
65
  - - "~>"
60
66
  - !ruby/object:Gem::Version
61
67
  version: '2018.1'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 2018.01.18
62
71
  type: :runtime
63
72
  prerelease: false
64
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,34 +75,43 @@ dependencies:
66
75
  - - "~>"
67
76
  - !ruby/object:Gem::Version
68
77
  version: '2018.1'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 2018.01.18
69
81
  - !ruby/object:Gem::Dependency
70
82
  name: faraday-http-cache
71
83
  requirement: !ruby/object:Gem::Requirement
72
84
  requirements:
73
85
  - - "~>"
74
86
  - !ruby/object:Gem::Version
75
- version: '2.0'
87
+ version: '2.2'
76
88
  type: :runtime
77
89
  prerelease: false
78
90
  version_requirements: !ruby/object:Gem::Requirement
79
91
  requirements:
80
92
  - - "~>"
81
93
  - !ruby/object:Gem::Version
82
- version: '2.0'
94
+ version: '2.2'
83
95
  - !ruby/object:Gem::Dependency
84
96
  name: minitest
85
97
  requirement: !ruby/object:Gem::Requirement
86
98
  requirements:
87
99
  - - "~>"
88
100
  - !ruby/object:Gem::Version
89
- version: '5.0'
101
+ version: '5.14'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 5.14.1
90
105
  type: :development
91
106
  prerelease: false
92
107
  version_requirements: !ruby/object:Gem::Requirement
93
108
  requirements:
94
109
  - - "~>"
95
110
  - !ruby/object:Gem::Version
96
- version: '5.0'
111
+ version: '5.14'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 5.14.1
97
115
  - !ruby/object:Gem::Dependency
98
116
  name: minitest-proveit
99
117
  requirement: !ruby/object:Gem::Requirement
@@ -121,6 +139,7 @@ files:
121
139
  - lib/square/api/apple_pay_api.rb
122
140
  - lib/square/api/bank_accounts_api.rb
123
141
  - lib/square/api/base_api.rb
142
+ - lib/square/api/bookings_api.rb
124
143
  - lib/square/api/cash_drawers_api.rb
125
144
  - lib/square/api/catalog_api.rb
126
145
  - lib/square/api/checkout_api.rb
@@ -141,14 +160,12 @@ files:
141
160
  - lib/square/api/orders_api.rb
142
161
  - lib/square/api/payments_api.rb
143
162
  - lib/square/api/refunds_api.rb
144
- - lib/square/api/reporting_api.rb
145
163
  - lib/square/api/subscriptions_api.rb
146
164
  - lib/square/api/team_api.rb
147
165
  - lib/square/api/terminal_api.rb
148
166
  - lib/square/api/transactions_api.rb
149
167
  - lib/square/api/v1_employees_api.rb
150
168
  - lib/square/api/v1_items_api.rb
151
- - lib/square/api/v1_locations_api.rb
152
169
  - lib/square/api/v1_transactions_api.rb
153
170
  - lib/square/api_helper.rb
154
171
  - lib/square/client.rb
@@ -185,7 +202,7 @@ require_paths:
185
202
  - lib
186
203
  required_ruby_version: !ruby/object:Gem::Requirement
187
204
  requirements:
188
- - - "~>"
205
+ - - ">="
189
206
  - !ruby/object:Gem::Version
190
207
  version: '2.0'
191
208
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -194,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
211
  - !ruby/object:Gem::Version
195
212
  version: '0'
196
213
  requirements: []
197
- rubygems_version: 3.0.8
214
+ rubygems_version: 3.1.4
198
215
  signing_key:
199
216
  specification_version: 4
200
217
  summary: square
@@ -1,138 +0,0 @@
1
- module Square
2
- # ReportingApi
3
- class ReportingApi < BaseApi
4
- def initialize(config, http_call_back: nil)
5
- super(config, http_call_back: http_call_back)
6
- end
7
-
8
- # Returns a list of refunded transactions (across all possible originating
9
- # locations) relating to monies
10
- # credited to the provided location ID by another Square account using the
11
- # `additional_recipients` field in a transaction.
12
- # Max results per [page](#paginatingresults): 50
13
- # @param [String] location_id Required parameter: The ID of the location to
14
- # list AdditionalRecipientReceivableRefunds for.
15
- # @param [String] begin_time Optional parameter: The beginning of the
16
- # requested reporting period, in RFC 3339 format. See [Date
17
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
18
- # value: The current time minus one year.
19
- # @param [String] end_time Optional parameter: The end of the requested
20
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
21
- # details on date inclusivity/exclusivity. Default value: The current
22
- # time.
23
- # @param [SortOrder] sort_order Optional parameter: The order in which
24
- # results are listed in the response (`ASC` for oldest first, `DESC` for
25
- # newest first). Default value: `DESC`
26
- # @param [String] cursor Optional parameter: A pagination cursor returned by
27
- # a previous call to this endpoint. Provide this to retrieve the next set of
28
- # results for your original query. See [Paginating
29
- # results](#paginatingresults) for more information.
30
- # @return [ListAdditionalRecipientReceivableRefundsResponse Hash] response from the API call
31
- def list_additional_recipient_receivable_refunds(location_id:,
32
- begin_time: nil,
33
- end_time: nil,
34
- sort_order: nil,
35
- cursor: nil)
36
- warn 'Endpoint list_additional_recipient_receivable_refunds in Reporting'\
37
- 'Api is deprecated'
38
- # Prepare query url.
39
- _query_builder = config.get_base_uri
40
- _query_builder << '/v2/locations/{location_id}/additional-recipient-receivable-refunds'
41
- _query_builder = APIHelper.append_url_with_template_parameters(
42
- _query_builder,
43
- 'location_id' => location_id
44
- )
45
- _query_builder = APIHelper.append_url_with_query_parameters(
46
- _query_builder,
47
- 'begin_time' => begin_time,
48
- 'end_time' => end_time,
49
- 'sort_order' => sort_order,
50
- 'cursor' => cursor
51
- )
52
- _query_url = APIHelper.clean_url _query_builder
53
-
54
- # Prepare headers.
55
- _headers = {
56
- 'accept' => 'application/json'
57
- }
58
-
59
- # Prepare and execute HttpRequest.
60
- _request = config.http_client.get(
61
- _query_url,
62
- headers: _headers
63
- )
64
- OAuth2.apply(config, _request)
65
- _response = execute_request(_request)
66
-
67
- # Return appropriate response type.
68
- decoded = APIHelper.json_deserialize(_response.raw_body)
69
- _errors = APIHelper.map_response(decoded, ['errors'])
70
- ApiResponse.new(_response, data: decoded, errors: _errors)
71
- end
72
-
73
- # Returns a list of receivables (across all possible sending locations)
74
- # representing monies credited
75
- # to the provided location ID by another Square account using the
76
- # `additional_recipients` field in a transaction.
77
- # Max results per [page](#paginatingresults): 50
78
- # @param [String] location_id Required parameter: The ID of the location to
79
- # list AdditionalRecipientReceivables for.
80
- # @param [String] begin_time Optional parameter: The beginning of the
81
- # requested reporting period, in RFC 3339 format. See [Date
82
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
83
- # value: The current time minus one year.
84
- # @param [String] end_time Optional parameter: The end of the requested
85
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
86
- # details on date inclusivity/exclusivity. Default value: The current
87
- # time.
88
- # @param [SortOrder] sort_order Optional parameter: The order in which
89
- # results are listed in the response (`ASC` for oldest first, `DESC` for
90
- # newest first). Default value: `DESC`
91
- # @param [String] cursor Optional parameter: A pagination cursor returned by
92
- # a previous call to this endpoint. Provide this to retrieve the next set of
93
- # results for your original query. See [Paginating
94
- # results](#paginatingresults) for more information.
95
- # @return [ListAdditionalRecipientReceivablesResponse Hash] response from the API call
96
- def list_additional_recipient_receivables(location_id:,
97
- begin_time: nil,
98
- end_time: nil,
99
- sort_order: nil,
100
- cursor: nil)
101
- warn 'Endpoint list_additional_recipient_receivables in ReportingApi is '\
102
- 'deprecated'
103
- # Prepare query url.
104
- _query_builder = config.get_base_uri
105
- _query_builder << '/v2/locations/{location_id}/additional-recipient-receivables'
106
- _query_builder = APIHelper.append_url_with_template_parameters(
107
- _query_builder,
108
- 'location_id' => location_id
109
- )
110
- _query_builder = APIHelper.append_url_with_query_parameters(
111
- _query_builder,
112
- 'begin_time' => begin_time,
113
- 'end_time' => end_time,
114
- 'sort_order' => sort_order,
115
- 'cursor' => cursor
116
- )
117
- _query_url = APIHelper.clean_url _query_builder
118
-
119
- # Prepare headers.
120
- _headers = {
121
- 'accept' => 'application/json'
122
- }
123
-
124
- # Prepare and execute HttpRequest.
125
- _request = config.http_client.get(
126
- _query_url,
127
- headers: _headers
128
- )
129
- OAuth2.apply(config, _request)
130
- _response = execute_request(_request)
131
-
132
- # Return appropriate response type.
133
- decoded = APIHelper.json_deserialize(_response.raw_body)
134
- _errors = APIHelper.map_response(decoded, ['errors'])
135
- ApiResponse.new(_response, data: decoded, errors: _errors)
136
- end
137
- end
138
- end