square.rb 5.3.0.20200528 → 6.4.0.20200923

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +317 -285
  3. data/lib/square.rb +4 -2
  4. data/lib/square/api/base_api.rb +2 -2
  5. data/lib/square/api/catalog_api.rb +76 -57
  6. data/lib/square/api/disputes_api.rb +3 -26
  7. data/lib/square/api/employees_api.rb +3 -2
  8. data/lib/square/api/inventory_api.rb +5 -4
  9. data/lib/square/api/invoices_api.rb +343 -0
  10. data/lib/square/api/labor_api.rb +77 -0
  11. data/lib/square/api/locations_api.rb +7 -2
  12. data/lib/square/api/merchants_api.rb +2 -1
  13. data/lib/square/api/orders_api.rb +59 -85
  14. data/lib/square/api/payments_api.rb +15 -24
  15. data/lib/square/api/refunds_api.rb +12 -7
  16. data/lib/square/api/subscriptions_api.rb +251 -0
  17. data/lib/square/api/team_api.rb +326 -0
  18. data/lib/square/api/transactions_api.rb +0 -71
  19. data/lib/square/api/v1_employees_api.rb +3 -76
  20. data/lib/square/api/v1_items_api.rb +0 -360
  21. data/lib/square/api/v1_locations_api.rb +0 -18
  22. data/lib/square/api/v1_transactions_api.rb +1 -19
  23. data/lib/square/client.rb +29 -16
  24. data/lib/square/configuration.rb +12 -4
  25. data/test/api/api_test_base.rb +1 -6
  26. data/test/api/test_catalog_api.rb +1 -4
  27. data/test/api/test_customers_api.rb +1 -4
  28. data/test/api/test_employees_api.rb +1 -4
  29. data/test/api/test_labor_api.rb +2 -6
  30. data/test/api/test_locations_api.rb +21 -32
  31. data/test/api/test_merchants_api.rb +1 -4
  32. data/test/api/test_payments_api.rb +3 -6
  33. data/test/api/test_refunds_api.rb +3 -6
  34. data/test/http_response_catcher.rb +0 -5
  35. data/test/test_helper.rb +0 -5
  36. metadata +33 -13
  37. data/lib/square/api/reporting_api.rb +0 -138
@@ -6,15 +6,6 @@ module Square
6
6
  end
7
7
 
8
8
  # Get the general information for a business.
9
- # ---
10
- # - __Deprecation date__: 2019-11-20
11
- # - [__Retirement
12
- # date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
13
- # recated): 2020-11-18
14
- # - [Migration
15
- # guide](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-locat
16
- # ions)
17
- # ---
18
9
  # @return [V1Merchant Hash] response from the API call
19
10
  def retrieve_business
20
11
  warn 'Endpoint retrieve_business in V1LocationsApi is deprecated'
@@ -44,15 +35,6 @@ module Square
44
35
 
45
36
  # Provides details for all business locations associated with a Square
46
37
  # account, including the Square-assigned object ID for the location.
47
- # ---
48
- # - __Deprecation date__: 2019-11-20
49
- # - [__Retirement
50
- # date__](https://developer.squareup.com/docs/build-basics/api-lifecycle#dep
51
- # recated): 2020-11-18
52
- # - [Migration
53
- # guide](https://developer.squareup.com/docs/migrate-from-v1/guides/v1-locat
54
- # ions)
55
- # ---
56
38
  # @return [List of V1Merchant Hash] response from the API call
57
39
  def list_locations
58
40
  warn 'Endpoint list_locations in V1LocationsApi is deprecated'
@@ -8,15 +8,6 @@ module Square
8
8
  # Provides non-confidential details for all of a location's associated bank
9
9
  # accounts. This endpoint does not provide full bank account numbers, and
10
10
  # there is no way to obtain a full bank account number with the Connect API.
11
- # ---
12
- # - __Deprecation date__: 2020-02-26
13
- # - [__Retirement
14
- # date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
15
- # e#deprecated): 2021-02-26
16
- # - [Migration
17
- # guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
18
- # bankaccounts)
19
- # ---
20
11
  # @param [String] location_id Required parameter: The ID of the location to
21
12
  # list bank accounts for.
22
13
  # @return [List of V1BankAccount Hash] response from the API call
@@ -53,15 +44,6 @@ module Square
53
44
  # Provides non-confidential details for a merchant's associated bank
54
45
  # account. This endpoint does not provide full bank account numbers, and
55
46
  # there is no way to obtain a full bank account number with the Connect API.
56
- # ---
57
- # - __Deprecation date__: 2020-02-26
58
- # - [__Retirement
59
- # date__](https://developer.squareup.com/docs/docs/build-basics/api-lifecycl
60
- # e#deprecated): 2021-02-26
61
- # - [Migration
62
- # guide](https://developer.squareup.com/docs/docs/migrate-from-v1/guides/v1-
63
- # bankaccounts)
64
- # ---
65
47
  # @param [String] location_id Required parameter: The ID of the bank
66
48
  # account's associated location.
67
49
  # @param [String] bank_account_id Required parameter: The bank account's
@@ -272,7 +254,7 @@ module Square
272
254
  end_time: nil,
273
255
  limit: nil,
274
256
  batch_token: nil,
275
- include_partial: nil)
257
+ include_partial: false)
276
258
  # Prepare query url.
277
259
  _query_builder = config.get_base_uri
278
260
  _query_builder << '/v1/{location_id}/payments'
@@ -4,11 +4,11 @@ module Square
4
4
  attr_reader :config
5
5
 
6
6
  def sdk_version
7
- '5.3.0.20200528'
7
+ '6.4.0.20200923'
8
8
  end
9
9
 
10
10
  def square_version
11
- '2020-05-28'
11
+ config.square_version
12
12
  end
13
13
 
14
14
  # Access to mobile_authorization controller.
@@ -113,6 +113,12 @@ module Square
113
113
  @inventory ||= InventoryApi.new config
114
114
  end
115
115
 
116
+ # Access to invoices controller.
117
+ # @return [InvoicesApi] Returns the controller instance.
118
+ def invoices
119
+ @invoices ||= InvoicesApi.new config
120
+ end
121
+
116
122
  # Access to labor controller.
117
123
  # @return [LaborApi] Returns the controller instance.
118
124
  def labor
@@ -125,24 +131,12 @@ module Square
125
131
  @locations ||= LocationsApi.new config
126
132
  end
127
133
 
128
- # Access to reporting controller.
129
- # @return [ReportingApi] Returns the controller instance.
130
- def reporting
131
- @reporting ||= ReportingApi.new config
132
- end
133
-
134
134
  # Access to checkout controller.
135
135
  # @return [CheckoutApi] Returns the controller instance.
136
136
  def checkout
137
137
  @checkout ||= CheckoutApi.new config
138
138
  end
139
139
 
140
- # Access to orders controller.
141
- # @return [OrdersApi] Returns the controller instance.
142
- def orders
143
- @orders ||= OrdersApi.new config
144
- end
145
-
146
140
  # Access to transactions controller.
147
141
  # @return [TransactionsApi] Returns the controller instance.
148
142
  def transactions
@@ -161,6 +155,12 @@ module Square
161
155
  @merchants ||= MerchantsApi.new config
162
156
  end
163
157
 
158
+ # Access to orders controller.
159
+ # @return [OrdersApi] Returns the controller instance.
160
+ def orders
161
+ @orders ||= OrdersApi.new config
162
+ end
163
+
164
164
  # Access to payments controller.
165
165
  # @return [PaymentsApi] Returns the controller instance.
166
166
  def payments
@@ -173,6 +173,18 @@ module Square
173
173
  @refunds ||= RefundsApi.new config
174
174
  end
175
175
 
176
+ # Access to subscriptions controller.
177
+ # @return [SubscriptionsApi] Returns the controller instance.
178
+ def subscriptions
179
+ @subscriptions ||= SubscriptionsApi.new config
180
+ end
181
+
182
+ # Access to team controller.
183
+ # @return [TeamApi] Returns the controller instance.
184
+ def team
185
+ @team ||= TeamApi.new config
186
+ end
187
+
176
188
  # Access to terminal controller.
177
189
  # @return [TerminalApi] Returns the controller instance.
178
190
  def terminal
@@ -181,13 +193,14 @@ module Square
181
193
 
182
194
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
183
195
  backoff_factor: 1, environment: 'production',
184
- access_token: 'TODO: Replace', additional_headers: {},
185
- config: nil)
196
+ square_version: '2020-09-23', access_token: 'TODO: Replace',
197
+ additional_headers: {}, config: nil)
186
198
  @config = if config.nil?
187
199
  Configuration.new(timeout: timeout, max_retries: max_retries,
188
200
  retry_interval: retry_interval,
189
201
  backoff_factor: backoff_factor,
190
202
  environment: environment,
203
+ square_version: square_version,
191
204
  access_token: access_token,
192
205
  additional_headers: additional_headers)
193
206
  else
@@ -9,6 +9,7 @@ module Square
9
9
  attr_reader :retry_interval
10
10
  attr_reader :backoff_factor
11
11
  attr_reader :environment
12
+ attr_reader :square_version
12
13
  attr_reader :access_token
13
14
 
14
15
  def additional_headers
@@ -21,7 +22,8 @@ module Square
21
22
 
22
23
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
23
24
  backoff_factor: 1, environment: 'production',
24
- access_token: 'TODO: Replace', additional_headers: {})
25
+ square_version: '2020-09-23', access_token: 'TODO: Replace',
26
+ additional_headers: {})
25
27
  # The value to use for connection timeout
26
28
  @timeout = timeout
27
29
 
@@ -38,6 +40,9 @@ module Square
38
40
  # Current API environment
39
41
  @environment = String(environment)
40
42
 
43
+ # Square Connect API versions
44
+ @square_version = square_version
45
+
41
46
  # OAuth 2.0 Access Token
42
47
  @access_token = access_token
43
48
 
@@ -49,20 +54,23 @@ module Square
49
54
  end
50
55
 
51
56
  def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
52
- backoff_factor: nil, environment: nil, access_token: nil,
53
- additional_headers: nil)
57
+ backoff_factor: nil, environment: nil, square_version: nil,
58
+ access_token: nil, additional_headers: nil)
54
59
  timeout ||= self.timeout
55
60
  max_retries ||= self.max_retries
56
61
  retry_interval ||= self.retry_interval
57
62
  backoff_factor ||= self.backoff_factor
58
63
  environment ||= self.environment
64
+ square_version ||= self.square_version
59
65
  access_token ||= self.access_token
60
66
  additional_headers ||= self.additional_headers
61
67
 
62
68
  Configuration.new(timeout: timeout, max_retries: max_retries,
63
69
  retry_interval: retry_interval,
64
70
  backoff_factor: backoff_factor,
65
- environment: environment, access_token: access_token,
71
+ environment: environment,
72
+ square_version: square_version,
73
+ access_token: access_token,
66
74
  additional_headers: additional_headers)
67
75
  end
68
76
 
@@ -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 'json'
7
2
  require 'minitest/autorun'
8
3
  require 'minitest/hell'
@@ -19,6 +14,6 @@ class ApiTestBase < Minitest::Test
19
14
  # Create configuration and set any test parameters
20
15
  CONFIG = Configuration.new(
21
16
  access_token: ENV.fetch('SQUARE_SANDBOX_TOKEN', 'AccessToken'),
22
- environment: "sandbox"
17
+ environment: 'sandbox'
23
18
  )
24
19
  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
 
@@ -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
 
@@ -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
12
  #Most other Connect API endpoints have a required `location_id` path 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: 5.3.0.20200528
4
+ version: 6.4.0.20200923
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-05-28 00:00:00.000000000 Z
11
+ date: 2020-09-23 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
@@ -131,6 +149,7 @@ files:
131
149
  - lib/square/api/disputes_api.rb
132
150
  - lib/square/api/employees_api.rb
133
151
  - lib/square/api/inventory_api.rb
152
+ - lib/square/api/invoices_api.rb
134
153
  - lib/square/api/labor_api.rb
135
154
  - lib/square/api/locations_api.rb
136
155
  - lib/square/api/loyalty_api.rb
@@ -140,7 +159,8 @@ files:
140
159
  - lib/square/api/orders_api.rb
141
160
  - lib/square/api/payments_api.rb
142
161
  - lib/square/api/refunds_api.rb
143
- - lib/square/api/reporting_api.rb
162
+ - lib/square/api/subscriptions_api.rb
163
+ - lib/square/api/team_api.rb
144
164
  - lib/square/api/terminal_api.rb
145
165
  - lib/square/api/transactions_api.rb
146
166
  - lib/square/api/v1_employees_api.rb