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,91 +1,91 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # EmployeesApi
8
- class EmployeesApi < BaseApi
9
- def initialize(config, http_call_back: nil)
10
- super(config, http_call_back: http_call_back)
11
- end
12
-
13
- # Gets a list of `Employee` objects for a business.
14
- # @param [String] location_id Optional parameter: Filter employees returned
15
- # to only those that are associated with the specified location.
16
- # @param [EmployeeStatus] status Optional parameter: Specifies the
17
- # EmployeeStatus to filter the employee by.
18
- # @param [Integer] limit Optional parameter: The number of employees to be
19
- # returned on each page.
20
- # @param [String] cursor Optional parameter: The token required to retrieve
21
- # the specified page of results.
22
- # @return [ListEmployeesResponse Hash] response from the API call
23
- def list_employees(location_id: nil,
24
- status: nil,
25
- limit: nil,
26
- cursor: nil)
27
- # Prepare query url.
28
- _query_builder = config.get_base_uri
29
- _query_builder << '/v2/employees'
30
- _query_builder = APIHelper.append_url_with_query_parameters(
31
- _query_builder,
32
- 'location_id' => location_id,
33
- 'status' => status,
34
- 'limit' => limit,
35
- 'cursor' => cursor
36
- )
37
- _query_url = APIHelper.clean_url _query_builder
38
-
39
- # Prepare headers.
40
- _headers = {
41
- 'accept' => 'application/json'
42
- }
43
-
44
- # Prepare and execute HttpRequest.
45
- _request = config.http_client.get(
46
- _query_url,
47
- headers: _headers
48
- )
49
- OAuth2.apply(config, _request)
50
- _response = execute_request(_request)
51
-
52
- # Return appropriate response type.
53
- decoded = APIHelper.json_deserialize(_response.raw_body)
54
- _errors = APIHelper.map_response(decoded, ['errors'])
55
- ApiResponse.new(_response, data: decoded, errors: _errors)
56
- end
57
-
58
- # Gets an `Employee` by Square-assigned employee `ID` (UUID)
59
- # @param [String] id Required parameter: UUID for the employee that was
60
- # requested.
61
- # @return [RetrieveEmployeeResponse Hash] response from the API call
62
- def retrieve_employee(id:)
63
- # Prepare query url.
64
- _query_builder = config.get_base_uri
65
- _query_builder << '/v2/employees/{id}'
66
- _query_builder = APIHelper.append_url_with_template_parameters(
67
- _query_builder,
68
- 'id' => id
69
- )
70
- _query_url = APIHelper.clean_url _query_builder
71
-
72
- # Prepare headers.
73
- _headers = {
74
- 'accept' => 'application/json'
75
- }
76
-
77
- # Prepare and execute HttpRequest.
78
- _request = config.http_client.get(
79
- _query_url,
80
- headers: _headers
81
- )
82
- OAuth2.apply(config, _request)
83
- _response = execute_request(_request)
84
-
85
- # Return appropriate response type.
86
- decoded = APIHelper.json_deserialize(_response.raw_body)
87
- _errors = APIHelper.map_response(decoded, ['errors'])
88
- ApiResponse.new(_response, data: decoded, errors: _errors)
89
- end
90
- end
91
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # EmployeesApi
8
+ class EmployeesApi < BaseApi
9
+ def initialize(config, http_call_back: nil)
10
+ super(config, http_call_back: http_call_back)
11
+ end
12
+
13
+ # Gets a list of `Employee` objects for a business.
14
+ # @param [String] location_id Optional parameter: Filter employees returned
15
+ # to only those that are associated with the specified location.
16
+ # @param [EmployeeStatus] status Optional parameter: Specifies the
17
+ # EmployeeStatus to filter the employee by.
18
+ # @param [Integer] limit Optional parameter: The number of employees to be
19
+ # returned on each page.
20
+ # @param [String] cursor Optional parameter: The token required to retrieve
21
+ # the specified page of results.
22
+ # @return [ListEmployeesResponse Hash] response from the API call
23
+ def list_employees(location_id: nil,
24
+ status: nil,
25
+ limit: nil,
26
+ cursor: nil)
27
+ # Prepare query url.
28
+ _query_builder = config.get_base_uri
29
+ _query_builder << '/v2/employees'
30
+ _query_builder = APIHelper.append_url_with_query_parameters(
31
+ _query_builder,
32
+ 'location_id' => location_id,
33
+ 'status' => status,
34
+ 'limit' => limit,
35
+ 'cursor' => cursor
36
+ )
37
+ _query_url = APIHelper.clean_url _query_builder
38
+
39
+ # Prepare headers.
40
+ _headers = {
41
+ 'accept' => 'application/json'
42
+ }
43
+
44
+ # Prepare and execute HttpRequest.
45
+ _request = config.http_client.get(
46
+ _query_url,
47
+ headers: _headers
48
+ )
49
+ OAuth2.apply(config, _request)
50
+ _response = execute_request(_request)
51
+
52
+ # Return appropriate response type.
53
+ decoded = APIHelper.json_deserialize(_response.raw_body)
54
+ _errors = APIHelper.map_response(decoded, ['errors'])
55
+ ApiResponse.new(_response, data: decoded, errors: _errors)
56
+ end
57
+
58
+ # Gets an `Employee` by Square-assigned employee `ID` (UUID)
59
+ # @param [String] id Required parameter: UUID for the employee that was
60
+ # requested.
61
+ # @return [RetrieveEmployeeResponse Hash] response from the API call
62
+ def retrieve_employee(id:)
63
+ # Prepare query url.
64
+ _query_builder = config.get_base_uri
65
+ _query_builder << '/v2/employees/{id}'
66
+ _query_builder = APIHelper.append_url_with_template_parameters(
67
+ _query_builder,
68
+ 'id' => id
69
+ )
70
+ _query_url = APIHelper.clean_url _query_builder
71
+
72
+ # Prepare headers.
73
+ _headers = {
74
+ 'accept' => 'application/json'
75
+ }
76
+
77
+ # Prepare and execute HttpRequest.
78
+ _request = config.http_client.get(
79
+ _query_url,
80
+ headers: _headers
81
+ )
82
+ OAuth2.apply(config, _request)
83
+ _response = execute_request(_request)
84
+
85
+ # Return appropriate response type.
86
+ decoded = APIHelper.json_deserialize(_response.raw_body)
87
+ _errors = APIHelper.map_response(decoded, ['errors'])
88
+ ApiResponse.new(_response, data: decoded, errors: _errors)
89
+ end
90
+ end
91
+ end