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,139 +1,143 @@
1
- # square
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Square
7
- # ReportingApi
8
- class ReportingApi < BaseApi
9
- def initialize(config, http_call_back: nil)
10
- super(config, http_call_back: http_call_back)
11
- end
12
-
13
- # Returns a list of refunded transactions (across all possible originating
14
- # locations) relating to monies
15
- # credited to the provided location ID by another Square account using the
16
- # `additional_recipients` field in a transaction.
17
- # Max results per [page](#paginatingresults): 50
18
- # @param [String] location_id Required parameter: The ID of the location to
19
- # list AdditionalRecipientReceivableRefunds for.
20
- # @param [String] begin_time Optional parameter: The beginning of the
21
- # requested reporting period, in RFC 3339 format. See [Date
22
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
23
- # value: The current time minus one year.
24
- # @param [String] end_time Optional parameter: The end of the requested
25
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
26
- # details on date inclusivity/exclusivity. Default value: The current
27
- # time.
28
- # @param [SortOrder] sort_order Optional parameter: The order in which
29
- # results are listed in the response (`ASC` for oldest first, `DESC` for
30
- # newest first). Default value: `DESC`
31
- # @param [String] cursor Optional parameter: A pagination cursor returned by
32
- # a previous call to this endpoint. Provide this to retrieve the next set of
33
- # results for your original query. See
34
- # [Pagination](/basics/api101/pagination) for more information.
35
- # @return [ListAdditionalRecipientReceivableRefundsResponse Hash] response from the API call
36
- def list_additional_recipient_receivable_refunds(location_id:,
37
- begin_time: nil,
38
- end_time: nil,
39
- sort_order: nil,
40
- cursor: nil)
41
- # Prepare query url.
42
- _query_builder = config.get_base_uri
43
- _query_builder << '/v2/locations/{location_id}/additional-recipient-receivable-refunds'
44
- _query_builder = APIHelper.append_url_with_template_parameters(
45
- _query_builder,
46
- 'location_id' => location_id
47
- )
48
- _query_builder = APIHelper.append_url_with_query_parameters(
49
- _query_builder,
50
- 'begin_time' => begin_time,
51
- 'end_time' => end_time,
52
- 'sort_order' => sort_order,
53
- 'cursor' => cursor
54
- )
55
- _query_url = APIHelper.clean_url _query_builder
56
-
57
- # Prepare headers.
58
- _headers = {
59
- 'accept' => 'application/json'
60
- }
61
-
62
- # Prepare and execute HttpRequest.
63
- _request = config.http_client.get(
64
- _query_url,
65
- headers: _headers
66
- )
67
- OAuth2.apply(config, _request)
68
- _response = execute_request(_request)
69
-
70
- # Return appropriate response type.
71
- decoded = APIHelper.json_deserialize(_response.raw_body)
72
- _errors = APIHelper.map_response(decoded, ['errors'])
73
- ApiResponse.new(_response, data: decoded, errors: _errors)
74
- end
75
-
76
- # Returns a list of receivables (across all possible sending locations)
77
- # representing monies credited
78
- # to the provided location ID by another Square account using the
79
- # `additional_recipients` field in a transaction.
80
- # Max results per [page](#paginatingresults): 50
81
- # @param [String] location_id Required parameter: The ID of the location to
82
- # list AdditionalRecipientReceivables for.
83
- # @param [String] begin_time Optional parameter: The beginning of the
84
- # requested reporting period, in RFC 3339 format. See [Date
85
- # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
86
- # value: The current time minus one year.
87
- # @param [String] end_time Optional parameter: The end of the requested
88
- # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
89
- # details on date inclusivity/exclusivity. Default value: The current
90
- # time.
91
- # @param [SortOrder] sort_order Optional parameter: The order in which
92
- # results are listed in the response (`ASC` for oldest first, `DESC` for
93
- # newest first). Default value: `DESC`
94
- # @param [String] cursor Optional parameter: A pagination cursor returned by
95
- # a previous call to this endpoint. Provide this to retrieve the next set of
96
- # results for your original query. See
97
- # [Pagination](/basics/api101/pagination) for more information.
98
- # @return [ListAdditionalRecipientReceivablesResponse Hash] response from the API call
99
- def list_additional_recipient_receivables(location_id:,
100
- begin_time: nil,
101
- end_time: nil,
102
- sort_order: nil,
103
- cursor: nil)
104
- # Prepare query url.
105
- _query_builder = config.get_base_uri
106
- _query_builder << '/v2/locations/{location_id}/additional-recipient-receivables'
107
- _query_builder = APIHelper.append_url_with_template_parameters(
108
- _query_builder,
109
- 'location_id' => location_id
110
- )
111
- _query_builder = APIHelper.append_url_with_query_parameters(
112
- _query_builder,
113
- 'begin_time' => begin_time,
114
- 'end_time' => end_time,
115
- 'sort_order' => sort_order,
116
- 'cursor' => cursor
117
- )
118
- _query_url = APIHelper.clean_url _query_builder
119
-
120
- # Prepare headers.
121
- _headers = {
122
- 'accept' => 'application/json'
123
- }
124
-
125
- # Prepare and execute HttpRequest.
126
- _request = config.http_client.get(
127
- _query_url,
128
- headers: _headers
129
- )
130
- OAuth2.apply(config, _request)
131
- _response = execute_request(_request)
132
-
133
- # Return appropriate response type.
134
- decoded = APIHelper.json_deserialize(_response.raw_body)
135
- _errors = APIHelper.map_response(decoded, ['errors'])
136
- ApiResponse.new(_response, data: decoded, errors: _errors)
137
- end
138
- end
139
- end
1
+ # square
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Square
7
+ # ReportingApi
8
+ class ReportingApi < BaseApi
9
+ def initialize(config, http_call_back: nil)
10
+ super(config, http_call_back: http_call_back)
11
+ end
12
+
13
+ # Returns a list of refunded transactions (across all possible originating
14
+ # locations) relating to monies
15
+ # credited to the provided location ID by another Square account using the
16
+ # `additional_recipients` field in a transaction.
17
+ # Max results per [page](#paginatingresults): 50
18
+ # @param [String] location_id Required parameter: The ID of the location to
19
+ # list AdditionalRecipientReceivableRefunds for.
20
+ # @param [String] begin_time Optional parameter: The beginning of the
21
+ # requested reporting period, in RFC 3339 format. See [Date
22
+ # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
23
+ # value: The current time minus one year.
24
+ # @param [String] end_time Optional parameter: The end of the requested
25
+ # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
26
+ # details on date inclusivity/exclusivity. Default value: The current
27
+ # time.
28
+ # @param [SortOrder] sort_order Optional parameter: The order in which
29
+ # results are listed in the response (`ASC` for oldest first, `DESC` for
30
+ # newest first). Default value: `DESC`
31
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
32
+ # a previous call to this endpoint. Provide this to retrieve the next set of
33
+ # results for your original query. See
34
+ # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
35
+ # for more information.
36
+ # @return [ListAdditionalRecipientReceivableRefundsResponse Hash] response from the API call
37
+ def list_additional_recipient_receivable_refunds(location_id:,
38
+ begin_time: nil,
39
+ end_time: nil,
40
+ sort_order: nil,
41
+ cursor: nil)
42
+ warn 'Endpoint list_additional_recipient_receivable_refunds in ReportingApi is deprecated'
43
+ # Prepare query url.
44
+ _query_builder = config.get_base_uri
45
+ _query_builder << '/v2/locations/{location_id}/additional-recipient-receivable-refunds'
46
+ _query_builder = APIHelper.append_url_with_template_parameters(
47
+ _query_builder,
48
+ 'location_id' => location_id
49
+ )
50
+ _query_builder = APIHelper.append_url_with_query_parameters(
51
+ _query_builder,
52
+ 'begin_time' => begin_time,
53
+ 'end_time' => end_time,
54
+ 'sort_order' => sort_order,
55
+ 'cursor' => cursor
56
+ )
57
+ _query_url = APIHelper.clean_url _query_builder
58
+
59
+ # Prepare headers.
60
+ _headers = {
61
+ 'accept' => 'application/json'
62
+ }
63
+
64
+ # Prepare and execute HttpRequest.
65
+ _request = config.http_client.get(
66
+ _query_url,
67
+ headers: _headers
68
+ )
69
+ OAuth2.apply(config, _request)
70
+ _response = execute_request(_request)
71
+
72
+ # Return appropriate response type.
73
+ decoded = APIHelper.json_deserialize(_response.raw_body)
74
+ _errors = APIHelper.map_response(decoded, ['errors'])
75
+ ApiResponse.new(_response, data: decoded, errors: _errors)
76
+ end
77
+
78
+ # Returns a list of receivables (across all possible sending locations)
79
+ # representing monies credited
80
+ # to the provided location ID by another Square account using the
81
+ # `additional_recipients` field in a transaction.
82
+ # Max results per [page](#paginatingresults): 50
83
+ # @param [String] location_id Required parameter: The ID of the location to
84
+ # list AdditionalRecipientReceivables for.
85
+ # @param [String] begin_time Optional parameter: The beginning of the
86
+ # requested reporting period, in RFC 3339 format. See [Date
87
+ # ranges](#dateranges) for details on date inclusivity/exclusivity. Default
88
+ # value: The current time minus one year.
89
+ # @param [String] end_time Optional parameter: The end of the requested
90
+ # reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
91
+ # details on date inclusivity/exclusivity. Default value: The current
92
+ # time.
93
+ # @param [SortOrder] sort_order Optional parameter: The order in which
94
+ # results are listed in the response (`ASC` for oldest first, `DESC` for
95
+ # newest first). Default value: `DESC`
96
+ # @param [String] cursor Optional parameter: A pagination cursor returned by
97
+ # a previous call to this endpoint. Provide this to retrieve the next set of
98
+ # results for your original query. See
99
+ # [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
100
+ # for more information.
101
+ # @return [ListAdditionalRecipientReceivablesResponse Hash] response from the API call
102
+ def list_additional_recipient_receivables(location_id:,
103
+ begin_time: nil,
104
+ end_time: nil,
105
+ sort_order: nil,
106
+ cursor: nil)
107
+ warn 'Endpoint list_additional_recipient_receivables in ReportingApi is deprecated'
108
+ # Prepare query url.
109
+ _query_builder = config.get_base_uri
110
+ _query_builder << '/v2/locations/{location_id}/additional-recipient-receivables'
111
+ _query_builder = APIHelper.append_url_with_template_parameters(
112
+ _query_builder,
113
+ 'location_id' => location_id
114
+ )
115
+ _query_builder = APIHelper.append_url_with_query_parameters(
116
+ _query_builder,
117
+ 'begin_time' => begin_time,
118
+ 'end_time' => end_time,
119
+ 'sort_order' => sort_order,
120
+ 'cursor' => cursor
121
+ )
122
+ _query_url = APIHelper.clean_url _query_builder
123
+
124
+ # Prepare headers.
125
+ _headers = {
126
+ 'accept' => 'application/json'
127
+ }
128
+
129
+ # Prepare and execute HttpRequest.
130
+ _request = config.http_client.get(
131
+ _query_url,
132
+ headers: _headers
133
+ )
134
+ OAuth2.apply(config, _request)
135
+ _response = execute_request(_request)
136
+
137
+ # Return appropriate response type.
138
+ decoded = APIHelper.json_deserialize(_response.raw_body)
139
+ _errors = APIHelper.map_response(decoded, ['errors'])
140
+ ApiResponse.new(_response, data: decoded, errors: _errors)
141
+ end
142
+ end
143
+ end