square.rb 3.20190814.0 → 3.20190925.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -2
  3. data/lib/square.rb +53 -52
  4. data/lib/square/api/apple_pay_api.rb +55 -55
  5. data/lib/square/api/base_api.rb +48 -45
  6. data/lib/square/api/catalog_api.rb +461 -461
  7. data/lib/square/api/checkout_api.rb +54 -54
  8. data/lib/square/api/customers_api.rb +335 -335
  9. data/lib/square/api/employees_api.rb +91 -91
  10. data/lib/square/api/inventory_api.rb +300 -300
  11. data/lib/square/api/labor_api.rb +558 -558
  12. data/lib/square/api/locations_api.rb +117 -45
  13. data/lib/square/api/merchants_api.rb +46 -0
  14. data/lib/square/api/mobile_authorization_api.rb +56 -56
  15. data/lib/square/api/o_auth_api.rb +168 -168
  16. data/lib/square/api/orders_api.rb +271 -269
  17. data/lib/square/api/payments_api.rb +282 -282
  18. data/lib/square/api/refunds_api.rb +149 -149
  19. data/lib/square/api/reporting_api.rb +145 -143
  20. data/lib/square/api/transactions_api.rb +379 -379
  21. data/lib/square/api/v1_employees_api.rb +720 -720
  22. data/lib/square/api/v1_items_api.rb +1651 -1651
  23. data/lib/square/api/v1_locations_api.rb +67 -67
  24. data/lib/square/api/v1_transactions_api.rb +574 -574
  25. data/lib/square/api_helper.rb +281 -281
  26. data/lib/square/client.rb +155 -139
  27. data/lib/square/configuration.rb +98 -88
  28. data/lib/square/exceptions/api_exception.rb +20 -20
  29. data/lib/square/http/api_response.rb +50 -50
  30. data/lib/square/http/auth/o_auth2.rb +17 -17
  31. data/lib/square/http/faraday_client.rb +64 -64
  32. data/lib/square/http/http_call_back.rb +24 -24
  33. data/lib/square/http/http_client.rb +104 -104
  34. data/lib/square/http/http_method_enum.rb +13 -13
  35. data/lib/square/http/http_request.rb +50 -50
  36. data/lib/square/http/http_response.rb +29 -29
  37. data/test/api/test_labor_api.rb +74 -0
  38. metadata +4 -3
  39. data/lib/square/api/v1_locations_api.rbe +0 -67
@@ -1,13 +1,13 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # HTTP Methods Enumeration.
8
- class HttpMethodEnum
9
- HTTPMETHODENUM = [GET = 'GET'.freeze, POST = 'POST'.freeze,
10
- PUT = 'PUT'.freeze, PATCH = 'PATCH'.freeze,
11
- DELETE = 'DELETE'.freeze, HEAD = 'HEAD'.freeze].freeze
12
- end
13
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum
9
+ HTTPMETHODENUM = [GET = 'GET'.freeze, POST = 'POST'.freeze,
10
+ PUT = 'PUT'.freeze, PATCH = 'PATCH'.freeze,
11
+ DELETE = 'DELETE'.freeze, HEAD = 'HEAD'.freeze].freeze
12
+ end
13
+ end
@@ -1,50 +1,50 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # Represents a single Http Request.
8
- class HttpRequest
9
- attr_accessor :http_method, :query_url, :headers,
10
- :parameters, :username, :password
11
-
12
- # The constructor.
13
- # @param [HttpMethodEnum] The HTTP method.
14
- # @param [String] The URL to send the request to.
15
- # @param [Hash, Optional] The headers for the HTTP Request.
16
- # @param [Hash, Optional] The parameters for the HTTP Request.
17
- def initialize(http_method,
18
- query_url,
19
- headers: {},
20
- parameters: {})
21
- @http_method = http_method
22
- @query_url = query_url
23
- @headers = headers
24
- @parameters = parameters
25
- end
26
-
27
- # Add a header to the HttpRequest.
28
- # @param [String] The name of the header.
29
- # @param [String] The value of the header.
30
- def add_header(name, value)
31
- @headers[name] = value
32
- end
33
-
34
- # Add a parameter to the HttpRequest.
35
- # @param [String] The name of the parameter.
36
- # @param [String] The value of the parameter.
37
- def add_parameter(name, value)
38
- @parameters[name] = value
39
- end
40
-
41
- # Add a query parameter to the HttpRequest.
42
- # @param [String] The name of the query parameter.
43
- # @param [String] The value of the query parameter.
44
- def add_query_parameter(name, value)
45
- @query_url = APIHelper.append_url_with_query_parameters(@query_url,
46
- name => value)
47
- @query_url = APIHelper.clean_url(@query_url)
48
- end
49
- end
50
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # Represents a single Http Request.
8
+ class HttpRequest
9
+ attr_accessor :http_method, :query_url, :headers,
10
+ :parameters, :username, :password
11
+
12
+ # The constructor.
13
+ # @param [HttpMethodEnum] The HTTP method.
14
+ # @param [String] The URL to send the request to.
15
+ # @param [Hash, Optional] The headers for the HTTP Request.
16
+ # @param [Hash, Optional] The parameters for the HTTP Request.
17
+ def initialize(http_method,
18
+ query_url,
19
+ headers: {},
20
+ parameters: {})
21
+ @http_method = http_method
22
+ @query_url = query_url
23
+ @headers = headers
24
+ @parameters = parameters
25
+ end
26
+
27
+ # Add a header to the HttpRequest.
28
+ # @param [String] The name of the header.
29
+ # @param [String] The value of the header.
30
+ def add_header(name, value)
31
+ @headers[name] = value
32
+ end
33
+
34
+ # Add a parameter to the HttpRequest.
35
+ # @param [String] The name of the parameter.
36
+ # @param [String] The value of the parameter.
37
+ def add_parameter(name, value)
38
+ @parameters[name] = value
39
+ end
40
+
41
+ # Add a query parameter to the HttpRequest.
42
+ # @param [String] The name of the query parameter.
43
+ # @param [String] The value of the query parameter.
44
+ def add_query_parameter(name, value)
45
+ @query_url = APIHelper.append_url_with_query_parameters(@query_url,
46
+ name => value)
47
+ @query_url = APIHelper.clean_url(@query_url)
48
+ end
49
+ end
50
+ end
@@ -1,29 +1,29 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # Http response received.
8
- class HttpResponse
9
- attr_reader :status_code, :reason_phrase, :headers, :raw_body, :request
10
-
11
- # The constructor
12
- # @param [Integer] The status code returned by the server.
13
- # @param [String] The reason phrase returned by the server.
14
- # @param [Hash] The headers sent by the server in the response.
15
- # @param [String] The raw body of the response.
16
- # @param [HttpRequest] The request that resulted in this response.
17
- def initialize(status_code,
18
- reason_phrase,
19
- headers,
20
- raw_body,
21
- request)
22
- @status_code = status_code
23
- @reason_phrase = reason_phrase
24
- @headers = headers
25
- @raw_body = raw_body
26
- @request = request
27
- end
28
- end
29
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # Http response received.
8
+ class HttpResponse
9
+ attr_reader :status_code, :reason_phrase, :headers, :raw_body, :request
10
+
11
+ # The constructor
12
+ # @param [Integer] The status code returned by the server.
13
+ # @param [String] The reason phrase returned by the server.
14
+ # @param [Hash] The headers sent by the server in the response.
15
+ # @param [String] The raw body of the response.
16
+ # @param [HttpRequest] The request that resulted in this response.
17
+ def initialize(status_code,
18
+ reason_phrase,
19
+ headers,
20
+ raw_body,
21
+ request)
22
+ @status_code = status_code
23
+ @reason_phrase = reason_phrase
24
+ @headers = headers
25
+ @raw_body = raw_body
26
+ @request = request
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,74 @@
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 LaborApiTests < ApiTestBase
9
+ # Called only once for the class before any test has executed
10
+ def setup
11
+ @response_catcher = HttpResponseCatcher.new
12
+ @controller = LaborApi.new CONFIG, http_call_back: @response_catcher
13
+ end
14
+
15
+ # Returns a paginated list of `BreakType` instances for a business.
16
+ def test_list_break_types()
17
+ # Parameters for the API call
18
+ location_id = nil
19
+ limit = nil
20
+ cursor = nil
21
+
22
+ # Perform the API call through the SDK function
23
+ result = @controller.list_break_types(location_id: location_id, limit: limit, cursor: cursor)
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
+ # Returns a paginated list of `EmployeeWage` instances for a business.
36
+ def test_list_employee_wages()
37
+ # Parameters for the API call
38
+ employee_id = nil
39
+ limit = nil
40
+ cursor = nil
41
+
42
+ # Perform the API call through the SDK function
43
+ result = @controller.list_employee_wages(employee_id: employee_id, limit: limit, cursor: cursor)
44
+
45
+ # Test response code
46
+ assert_equal(200, @response_catcher.response.status_code)
47
+
48
+ # Test headers
49
+ expected_headers = {}
50
+ expected_headers['content-type'] = 'application/json'
51
+
52
+ assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))
53
+ end
54
+
55
+ # Returns a list of `WorkweekConfig` instances for a business.
56
+ def test_list_workweek_configs()
57
+ # Parameters for the API call
58
+ limit = nil
59
+ cursor = nil
60
+
61
+ # Perform the API call through the SDK function
62
+ result = @controller.list_workweek_configs(limit: limit, cursor: cursor)
63
+
64
+ # Test response code
65
+ assert_equal(200, @response_catcher.response.status_code)
66
+
67
+ # Test headers
68
+ expected_headers = {}
69
+ expected_headers['content-type'] = 'application/json'
70
+
71
+ assert(TestHelper.match_headers(expected_headers, @response_catcher.response.headers))
72
+ end
73
+
74
+ end
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: 3.20190814.0
4
+ version: 3.20190925.0
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: 2019-08-15 00:00:00.000000000 Z
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -127,6 +127,7 @@ files:
127
127
  - lib/square/api/inventory_api.rb
128
128
  - lib/square/api/labor_api.rb
129
129
  - lib/square/api/locations_api.rb
130
+ - lib/square/api/merchants_api.rb
130
131
  - lib/square/api/mobile_authorization_api.rb
131
132
  - lib/square/api/o_auth_api.rb
132
133
  - lib/square/api/orders_api.rb
@@ -137,7 +138,6 @@ files:
137
138
  - lib/square/api/v1_employees_api.rb
138
139
  - lib/square/api/v1_items_api.rb
139
140
  - lib/square/api/v1_locations_api.rb
140
- - lib/square/api/v1_locations_api.rbe
141
141
  - lib/square/api/v1_transactions_api.rb
142
142
  - lib/square/api_helper.rb
143
143
  - lib/square/client.rb
@@ -156,6 +156,7 @@ files:
156
156
  - test/api/test_catalog_api.rb
157
157
  - test/api/test_customers_api.rb
158
158
  - test/api/test_employees_api.rb
159
+ - test/api/test_labor_api.rb
159
160
  - test/api/test_locations_api.rb
160
161
  - test/api/test_payments_api.rb
161
162
  - test/api/test_refunds_api.rb
@@ -1,67 +0,0 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # V1LocationsApi
8
- class V1LocationsApi < BaseApi
9
- def initialize(config, http_call_back: nil)
10
- super(config, http_call_back: http_call_back)
11
- end
12
-
13
- # Get a business's information.
14
- # @return [V1Merchant Hash] response from the API call
15
- def retrieve_business
16
- # Prepare query url.
17
- _query_builder = config.get_base_uri
18
- _query_builder << '/v1/me'
19
- _query_url = APIHelper.clean_url _query_builder
20
-
21
- # Prepare headers.
22
- _headers = {
23
- 'accept' => 'application/json'
24
- }
25
-
26
- # Prepare and execute HttpRequest.
27
- _request = config.http_client.get(
28
- _query_url,
29
- headers: _headers
30
- )
31
- OAuth2.apply(config, _request)
32
- _response = execute_request(_request)
33
-
34
- # Return appropriate response type.
35
- decoded = APIHelper.json_deserialize(_response.raw_body)
36
- _errors = APIHelper.map_response(decoded, ['errors'])
37
- ApiResponse.new(_response, data: decoded, errors: _errors)
38
- end
39
-
40
- # Provides details for a business's locations, including their IDs.
41
- # @return [List of V1Merchant Hash] response from the API call
42
- def list_locations
43
- # Prepare query url.
44
- _query_builder = config.get_base_uri
45
- _query_builder << '/v1/me/locations'
46
- _query_url = APIHelper.clean_url _query_builder
47
-
48
- # Prepare headers.
49
- _headers = {
50
- 'accept' => 'application/json'
51
- }
52
-
53
- # Prepare and execute HttpRequest.
54
- _request = config.http_client.get(
55
- _query_url,
56
- headers: _headers
57
- )
58
- OAuth2.apply(config, _request)
59
- _response = execute_request(_request)
60
-
61
- # Return appropriate response type.
62
- decoded = APIHelper.json_deserialize(_response.raw_body)
63
- _errors = APIHelper.map_response(decoded, ['errors'])
64
- ApiResponse.new(_response, data: decoded, errors: _errors)
65
- end
66
- end
67
- end