square.rb 3.20190624.0 → 3.20190814.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +10 -28
  3. data/README.md +281 -17235
  4. data/lib/square/api/apple_pay_api.rb +55 -54
  5. data/lib/square/api/base_api.rb +45 -45
  6. data/lib/square/api/catalog_api.rb +461 -460
  7. data/lib/square/api/checkout_api.rb +54 -54
  8. data/lib/square/api/customers_api.rb +335 -334
  9. data/lib/square/api/employees_api.rb +91 -91
  10. data/lib/square/api/inventory_api.rb +300 -298
  11. data/lib/square/api/labor_api.rb +558 -558
  12. data/lib/square/api/locations_api.rb +45 -45
  13. data/lib/square/api/mobile_authorization_api.rb +56 -56
  14. data/lib/square/api/o_auth_api.rb +168 -164
  15. data/lib/square/api/orders_api.rb +269 -151
  16. data/lib/square/api/payments_api.rb +282 -0
  17. data/lib/square/api/refunds_api.rb +149 -0
  18. data/lib/square/api/reporting_api.rb +143 -139
  19. data/lib/square/api/transactions_api.rb +379 -360
  20. data/lib/square/api/v1_employees_api.rb +720 -720
  21. data/lib/square/api/v1_items_api.rb +1651 -1651
  22. data/lib/square/api/v1_locations_api.rb +67 -67
  23. data/lib/square/api/v1_locations_api.rbe +67 -0
  24. data/lib/square/api/v1_transactions_api.rb +574 -574
  25. data/lib/square/api_helper.rb +281 -277
  26. data/lib/square/client.rb +139 -127
  27. data/lib/square/configuration.rb +88 -85
  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/lib/square.rb +52 -50
  38. data/spec/user_journey_spec.rb +4 -1
  39. data/test/api/api_test_base.rb +2 -1
  40. data/test/api/test_catalog_api.rb +59 -0
  41. data/test/api/test_employees_api.rb +36 -0
  42. data/test/api/test_locations_api.rb +35 -0
  43. data/test/api/test_payments_api.rb +42 -0
  44. data/test/api/test_refunds_api.rb +41 -0
  45. metadata +19 -11
@@ -1,54 +1,55 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # ApplePayApi
8
- class ApplePayApi < BaseApi
9
- def initialize(config, http_call_back: nil)
10
- super(config, http_call_back: http_call_back)
11
- end
12
-
13
- # Activates a domain for use with Web Apple Pay and Square. A validation
14
- # will be performed on this domain by Apple to ensure is it properly set up
15
- # as
16
- # an Apple Pay enabled domain.
17
- # This endpoint provides an easy way for platform developers to bulk
18
- # activate
19
- # Web Apple Pay with Square for merchants using their platform.
20
- # To learn more about Apple Pay on Web see the Apple Pay section in the
21
- # [Embedding the Square Payment
22
- # Form](/payment-form/add-digital-wallets/apple-pay) guide.
23
- # @param [RegisterDomainRequest] body Required parameter: An object
24
- # containing the fields to POST for the request. See the corresponding
25
- # object definition for field details.
26
- # @return [RegisterDomainResponse Hash] response from the API call
27
- def register_domain(body:)
28
- # Prepare query url.
29
- _query_builder = config.get_base_uri
30
- _query_builder << '/v2/apple-pay/domains'
31
- _query_url = APIHelper.clean_url _query_builder
32
-
33
- # Prepare headers.
34
- _headers = {
35
- 'accept' => 'application/json',
36
- 'content-type' => 'application/json; charset=utf-8'
37
- }
38
-
39
- # Prepare and execute HttpRequest.
40
- _request = config.http_client.post(
41
- _query_url,
42
- headers: _headers,
43
- parameters: body.to_json
44
- )
45
- OAuth2.apply(config, _request)
46
- _response = execute_request(_request)
47
-
48
- # Return appropriate response type.
49
- decoded = APIHelper.json_deserialize(_response.raw_body)
50
- _errors = APIHelper.map_response(decoded, ['errors'])
51
- ApiResponse.new(_response, data: decoded, errors: _errors)
52
- end
53
- end
54
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # ApplePayApi
8
+ class ApplePayApi < BaseApi
9
+ def initialize(config, http_call_back: nil)
10
+ super(config, http_call_back: http_call_back)
11
+ end
12
+
13
+ # Activates a domain for use with Web Apple Pay and Square. A validation
14
+ # will be performed on this domain by Apple to ensure is it properly set up
15
+ # as
16
+ # an Apple Pay enabled domain.
17
+ # This endpoint provides an easy way for platform developers to bulk
18
+ # activate
19
+ # Web Apple Pay with Square for merchants using their platform.
20
+ # To learn more about Apple Pay on Web see the Apple Pay section in the
21
+ # [Embedding the Square Payment
22
+ # Form](https://developer.squareup.com/docs/payment-form/add-digital-wallets
23
+ # /apple-pay) guide.
24
+ # @param [RegisterDomainRequest] body Required parameter: An object
25
+ # containing the fields to POST for the request. See the corresponding
26
+ # object definition for field details.
27
+ # @return [RegisterDomainResponse Hash] response from the API call
28
+ def register_domain(body:)
29
+ # Prepare query url.
30
+ _query_builder = config.get_base_uri
31
+ _query_builder << '/v2/apple-pay/domains'
32
+ _query_url = APIHelper.clean_url _query_builder
33
+
34
+ # Prepare headers.
35
+ _headers = {
36
+ 'accept' => 'application/json',
37
+ 'content-type' => 'application/json; charset=utf-8'
38
+ }
39
+
40
+ # Prepare and execute HttpRequest.
41
+ _request = config.http_client.post(
42
+ _query_url,
43
+ headers: _headers,
44
+ parameters: body.to_json
45
+ )
46
+ OAuth2.apply(config, _request)
47
+ _response = execute_request(_request)
48
+
49
+ # Return appropriate response type.
50
+ decoded = APIHelper.json_deserialize(_response.raw_body)
51
+ _errors = APIHelper.map_response(decoded, ['errors'])
52
+ ApiResponse.new(_response, data: decoded, errors: _errors)
53
+ end
54
+ end
55
+ end
@@ -1,45 +1,45 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # BaseApi.
8
- class BaseApi
9
- attr_accessor :config, :http_call_back
10
-
11
- def initialize(config, http_call_back: nil)
12
- @config = config
13
- @http_call_back = http_call_back
14
-
15
- @global_headers = {
16
- 'user-agent' => 'Square-Connect-Ruby-BETA/3.20190624.0',
17
- 'Square-Version' => '2019-06-12'
18
- }
19
- end
20
-
21
- def validate_parameters(args)
22
- args.each do |_name, value|
23
- if value.nil?
24
- raise ArgumentError, "Required parameter #{_name} cannot be nil."
25
- end
26
- end
27
- end
28
-
29
- def execute_request(request, binary: false)
30
- @http_call_back.on_before_request(request) if @http_call_back
31
-
32
- APIHelper.clean_hash(request.headers)
33
- request.headers = @global_headers.clone.merge(request.headers)
34
-
35
- response = if binary
36
- config.http_client.execute_as_binary(request)
37
- else
38
- config.http_client.execute_as_string(request)
39
- end
40
- @http_call_back.on_after_response(response) if @http_call_back
41
-
42
- response
43
- end
44
- end
45
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # BaseApi.
8
+ class BaseApi
9
+ attr_accessor :config, :http_call_back
10
+
11
+ def initialize(config, http_call_back: nil)
12
+ @config = config
13
+ @http_call_back = http_call_back
14
+
15
+ @global_headers = {
16
+ 'user-agent' => 'Square-Connect-Ruby-3.20190814.0',
17
+ 'Square-Version' => '2019-08-14'
18
+ }
19
+ end
20
+
21
+ def validate_parameters(args)
22
+ args.each do |_name, value|
23
+ if value.nil?
24
+ raise ArgumentError, "Required parameter #{_name} cannot be nil."
25
+ end
26
+ end
27
+ end
28
+
29
+ def execute_request(request, binary: false)
30
+ @http_call_back.on_before_request(request) if @http_call_back
31
+
32
+ APIHelper.clean_hash(request.headers)
33
+ request.headers = @global_headers.clone.merge(request.headers)
34
+
35
+ response = if binary
36
+ config.http_client.execute_as_binary(request)
37
+ else
38
+ config.http_client.execute_as_string(request)
39
+ end
40
+ @http_call_back.on_after_response(response) if @http_call_back
41
+
42
+ response
43
+ end
44
+ end
45
+ end