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.
- checksums.yaml +4 -4
- data/LICENSE +10 -28
- data/README.md +281 -17235
- data/lib/square/api/apple_pay_api.rb +55 -54
- data/lib/square/api/base_api.rb +45 -45
- data/lib/square/api/catalog_api.rb +461 -460
- data/lib/square/api/checkout_api.rb +54 -54
- data/lib/square/api/customers_api.rb +335 -334
- data/lib/square/api/employees_api.rb +91 -91
- data/lib/square/api/inventory_api.rb +300 -298
- data/lib/square/api/labor_api.rb +558 -558
- data/lib/square/api/locations_api.rb +45 -45
- data/lib/square/api/mobile_authorization_api.rb +56 -56
- data/lib/square/api/o_auth_api.rb +168 -164
- data/lib/square/api/orders_api.rb +269 -151
- data/lib/square/api/payments_api.rb +282 -0
- data/lib/square/api/refunds_api.rb +149 -0
- data/lib/square/api/reporting_api.rb +143 -139
- data/lib/square/api/transactions_api.rb +379 -360
- data/lib/square/api/v1_employees_api.rb +720 -720
- data/lib/square/api/v1_items_api.rb +1651 -1651
- data/lib/square/api/v1_locations_api.rb +67 -67
- data/lib/square/api/v1_locations_api.rbe +67 -0
- data/lib/square/api/v1_transactions_api.rb +574 -574
- data/lib/square/api_helper.rb +281 -277
- data/lib/square/client.rb +139 -127
- data/lib/square/configuration.rb +88 -85
- data/lib/square/exceptions/api_exception.rb +20 -20
- data/lib/square/http/api_response.rb +50 -50
- data/lib/square/http/auth/o_auth2.rb +17 -17
- data/lib/square/http/faraday_client.rb +64 -64
- data/lib/square/http/http_call_back.rb +24 -24
- data/lib/square/http/http_client.rb +104 -104
- data/lib/square/http/http_method_enum.rb +13 -13
- data/lib/square/http/http_request.rb +50 -50
- data/lib/square/http/http_response.rb +29 -29
- data/lib/square.rb +52 -50
- data/spec/user_journey_spec.rb +4 -1
- data/test/api/api_test_base.rb +2 -1
- data/test/api/test_catalog_api.rb +59 -0
- data/test/api/test_employees_api.rb +36 -0
- data/test/api/test_locations_api.rb +35 -0
- data/test/api/test_payments_api.rb +42 -0
- data/test/api/test_refunds_api.rb +41 -0
- 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)
|
35
|
-
#
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
_query_builder =
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
'
|
53
|
-
'
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
# @param [String]
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
_query_builder = APIHelper.
|
112
|
-
_query_builder,
|
113
|
-
'
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
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
|