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.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/square.rb +53 -52
- data/lib/square/api/apple_pay_api.rb +55 -55
- data/lib/square/api/base_api.rb +48 -45
- data/lib/square/api/catalog_api.rb +461 -461
- data/lib/square/api/checkout_api.rb +54 -54
- data/lib/square/api/customers_api.rb +335 -335
- data/lib/square/api/employees_api.rb +91 -91
- data/lib/square/api/inventory_api.rb +300 -300
- data/lib/square/api/labor_api.rb +558 -558
- data/lib/square/api/locations_api.rb +117 -45
- data/lib/square/api/merchants_api.rb +46 -0
- data/lib/square/api/mobile_authorization_api.rb +56 -56
- data/lib/square/api/o_auth_api.rb +168 -168
- data/lib/square/api/orders_api.rb +271 -269
- data/lib/square/api/payments_api.rb +282 -282
- data/lib/square/api/refunds_api.rb +149 -149
- data/lib/square/api/reporting_api.rb +145 -143
- data/lib/square/api/transactions_api.rb +379 -379
- 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_transactions_api.rb +574 -574
- data/lib/square/api_helper.rb +281 -281
- data/lib/square/client.rb +155 -139
- data/lib/square/configuration.rb +98 -88
- 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/test/api/test_labor_api.rb +74 -0
- metadata +4 -3
- data/lib/square/api/v1_locations_api.rbe +0 -67
@@ -1,149 +1,149 @@
|
|
1
|
-
# square
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v2.0
|
4
|
-
# ( https://apimatic.io ).
|
5
|
-
|
6
|
-
module Square
|
7
|
-
# RefundsApi
|
8
|
-
class RefundsApi < BaseApi
|
9
|
-
def initialize(config, http_call_back: nil)
|
10
|
-
super(config, http_call_back: http_call_back)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Retrieves a list of refunds for the account making the request.
|
14
|
-
# Max results per page: 100
|
15
|
-
# @param [String] begin_time Optional parameter: Timestamp for the beginning
|
16
|
-
# of the requested reporting period, in RFC 3339 format. Default: The
|
17
|
-
# current time minus one year.
|
18
|
-
# @param [String] end_time Optional parameter: Timestamp for the end of the
|
19
|
-
# requested reporting period, in RFC 3339 format. Default: The current
|
20
|
-
# time.
|
21
|
-
# @param [String] sort_order Optional parameter: The order in which results
|
22
|
-
# are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest
|
23
|
-
# (default).
|
24
|
-
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
25
|
-
# a previous call to this endpoint. Provide this to retrieve the next set of
|
26
|
-
# results for the original query. See
|
27
|
-
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
28
|
-
# for more information.
|
29
|
-
# @param [String] location_id Optional parameter: ID of location associated
|
30
|
-
# with payment.
|
31
|
-
# @param [String] status Optional parameter: If provided, only refunds with
|
32
|
-
# the given status are returned. For a list of refund status values, see
|
33
|
-
# [PaymentRefund](#type-paymentrefund). Default: If omitted refunds are
|
34
|
-
# returned regardless of status.
|
35
|
-
# @param [String] source_type Optional parameter: If provided, only refunds
|
36
|
-
# with the given source type are returned. - `CARD` - List refunds only for
|
37
|
-
# payments where card was specified as payment source. Default: If omitted
|
38
|
-
# refunds are returned regardless of source type.
|
39
|
-
# @return [ListPaymentRefundsResponse Hash] response from the API call
|
40
|
-
def list_payment_refunds(begin_time: nil,
|
41
|
-
end_time: nil,
|
42
|
-
sort_order: nil,
|
43
|
-
cursor: nil,
|
44
|
-
location_id: nil,
|
45
|
-
status: nil,
|
46
|
-
source_type: nil)
|
47
|
-
# Prepare query url.
|
48
|
-
_query_builder = config.get_base_uri
|
49
|
-
_query_builder << '/v2/refunds'
|
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
|
-
'location_id' => location_id,
|
57
|
-
'status' => status,
|
58
|
-
'source_type' => source_type
|
59
|
-
)
|
60
|
-
_query_url = APIHelper.clean_url _query_builder
|
61
|
-
|
62
|
-
# Prepare headers.
|
63
|
-
_headers = {
|
64
|
-
'accept' => 'application/json'
|
65
|
-
}
|
66
|
-
|
67
|
-
# Prepare and execute HttpRequest.
|
68
|
-
_request = config.http_client.get(
|
69
|
-
_query_url,
|
70
|
-
headers: _headers
|
71
|
-
)
|
72
|
-
OAuth2.apply(config, _request)
|
73
|
-
_response = execute_request(_request)
|
74
|
-
|
75
|
-
# Return appropriate response type.
|
76
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
77
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
78
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
79
|
-
end
|
80
|
-
|
81
|
-
# Refunds a payment. You can refund the entire payment amount or a
|
82
|
-
# portion of it. For more information, see
|
83
|
-
# [Payments and Refunds
|
84
|
-
# Overview](https://developer.squareup.com/docs/payments-api/overview).
|
85
|
-
# @param [RefundPaymentRequest] body Required parameter: An object
|
86
|
-
# containing the fields to POST for the request. See the corresponding
|
87
|
-
# object definition for field details.
|
88
|
-
# @return [RefundPaymentResponse Hash] response from the API call
|
89
|
-
def refund_payment(body:)
|
90
|
-
# Prepare query url.
|
91
|
-
_query_builder = config.get_base_uri
|
92
|
-
_query_builder << '/v2/refunds'
|
93
|
-
_query_url = APIHelper.clean_url _query_builder
|
94
|
-
|
95
|
-
# Prepare headers.
|
96
|
-
_headers = {
|
97
|
-
'accept' => 'application/json',
|
98
|
-
'content-type' => 'application/json; charset=utf-8'
|
99
|
-
}
|
100
|
-
|
101
|
-
# Prepare and execute HttpRequest.
|
102
|
-
_request = config.http_client.post(
|
103
|
-
_query_url,
|
104
|
-
headers: _headers,
|
105
|
-
parameters: body.to_json
|
106
|
-
)
|
107
|
-
OAuth2.apply(config, _request)
|
108
|
-
_response = execute_request(_request)
|
109
|
-
|
110
|
-
# Return appropriate response type.
|
111
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
112
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
113
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
114
|
-
end
|
115
|
-
|
116
|
-
# Retrieves a specific `Refund` using the `refund_id`.
|
117
|
-
# @param [String] refund_id Required parameter: Unique ID for the desired
|
118
|
-
# `PaymentRefund`.
|
119
|
-
# @return [GetPaymentRefundResponse Hash] response from the API call
|
120
|
-
def get_payment_refund(refund_id:)
|
121
|
-
# Prepare query url.
|
122
|
-
_query_builder = config.get_base_uri
|
123
|
-
_query_builder << '/v2/refunds/{refund_id}'
|
124
|
-
_query_builder = APIHelper.append_url_with_template_parameters(
|
125
|
-
_query_builder,
|
126
|
-
'refund_id' => refund_id
|
127
|
-
)
|
128
|
-
_query_url = APIHelper.clean_url _query_builder
|
129
|
-
|
130
|
-
# Prepare headers.
|
131
|
-
_headers = {
|
132
|
-
'accept' => 'application/json'
|
133
|
-
}
|
134
|
-
|
135
|
-
# Prepare and execute HttpRequest.
|
136
|
-
_request = config.http_client.get(
|
137
|
-
_query_url,
|
138
|
-
headers: _headers
|
139
|
-
)
|
140
|
-
OAuth2.apply(config, _request)
|
141
|
-
_response = execute_request(_request)
|
142
|
-
|
143
|
-
# Return appropriate response type.
|
144
|
-
decoded = APIHelper.json_deserialize(_response.raw_body)
|
145
|
-
_errors = APIHelper.map_response(decoded, ['errors'])
|
146
|
-
ApiResponse.new(_response, data: decoded, errors: _errors)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
1
|
+
# square
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Square
|
7
|
+
# RefundsApi
|
8
|
+
class RefundsApi < BaseApi
|
9
|
+
def initialize(config, http_call_back: nil)
|
10
|
+
super(config, http_call_back: http_call_back)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Retrieves a list of refunds for the account making the request.
|
14
|
+
# Max results per page: 100
|
15
|
+
# @param [String] begin_time Optional parameter: Timestamp for the beginning
|
16
|
+
# of the requested reporting period, in RFC 3339 format. Default: The
|
17
|
+
# current time minus one year.
|
18
|
+
# @param [String] end_time Optional parameter: Timestamp for the end of the
|
19
|
+
# requested reporting period, in RFC 3339 format. Default: The current
|
20
|
+
# time.
|
21
|
+
# @param [String] sort_order Optional parameter: The order in which results
|
22
|
+
# are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest
|
23
|
+
# (default).
|
24
|
+
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
25
|
+
# a previous call to this endpoint. Provide this to retrieve the next set of
|
26
|
+
# results for the original query. See
|
27
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
28
|
+
# for more information.
|
29
|
+
# @param [String] location_id Optional parameter: ID of location associated
|
30
|
+
# with payment.
|
31
|
+
# @param [String] status Optional parameter: If provided, only refunds with
|
32
|
+
# the given status are returned. For a list of refund status values, see
|
33
|
+
# [PaymentRefund](#type-paymentrefund). Default: If omitted refunds are
|
34
|
+
# returned regardless of status.
|
35
|
+
# @param [String] source_type Optional parameter: If provided, only refunds
|
36
|
+
# with the given source type are returned. - `CARD` - List refunds only for
|
37
|
+
# payments where card was specified as payment source. Default: If omitted
|
38
|
+
# refunds are returned regardless of source type.
|
39
|
+
# @return [ListPaymentRefundsResponse Hash] response from the API call
|
40
|
+
def list_payment_refunds(begin_time: nil,
|
41
|
+
end_time: nil,
|
42
|
+
sort_order: nil,
|
43
|
+
cursor: nil,
|
44
|
+
location_id: nil,
|
45
|
+
status: nil,
|
46
|
+
source_type: nil)
|
47
|
+
# Prepare query url.
|
48
|
+
_query_builder = config.get_base_uri
|
49
|
+
_query_builder << '/v2/refunds'
|
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
|
+
'location_id' => location_id,
|
57
|
+
'status' => status,
|
58
|
+
'source_type' => source_type
|
59
|
+
)
|
60
|
+
_query_url = APIHelper.clean_url _query_builder
|
61
|
+
|
62
|
+
# Prepare headers.
|
63
|
+
_headers = {
|
64
|
+
'accept' => 'application/json'
|
65
|
+
}
|
66
|
+
|
67
|
+
# Prepare and execute HttpRequest.
|
68
|
+
_request = config.http_client.get(
|
69
|
+
_query_url,
|
70
|
+
headers: _headers
|
71
|
+
)
|
72
|
+
OAuth2.apply(config, _request)
|
73
|
+
_response = execute_request(_request)
|
74
|
+
|
75
|
+
# Return appropriate response type.
|
76
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
77
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
78
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Refunds a payment. You can refund the entire payment amount or a
|
82
|
+
# portion of it. For more information, see
|
83
|
+
# [Payments and Refunds
|
84
|
+
# Overview](https://developer.squareup.com/docs/payments-api/overview).
|
85
|
+
# @param [RefundPaymentRequest] body Required parameter: An object
|
86
|
+
# containing the fields to POST for the request. See the corresponding
|
87
|
+
# object definition for field details.
|
88
|
+
# @return [RefundPaymentResponse Hash] response from the API call
|
89
|
+
def refund_payment(body:)
|
90
|
+
# Prepare query url.
|
91
|
+
_query_builder = config.get_base_uri
|
92
|
+
_query_builder << '/v2/refunds'
|
93
|
+
_query_url = APIHelper.clean_url _query_builder
|
94
|
+
|
95
|
+
# Prepare headers.
|
96
|
+
_headers = {
|
97
|
+
'accept' => 'application/json',
|
98
|
+
'content-type' => 'application/json; charset=utf-8'
|
99
|
+
}
|
100
|
+
|
101
|
+
# Prepare and execute HttpRequest.
|
102
|
+
_request = config.http_client.post(
|
103
|
+
_query_url,
|
104
|
+
headers: _headers,
|
105
|
+
parameters: body.to_json
|
106
|
+
)
|
107
|
+
OAuth2.apply(config, _request)
|
108
|
+
_response = execute_request(_request)
|
109
|
+
|
110
|
+
# Return appropriate response type.
|
111
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
112
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
113
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Retrieves a specific `Refund` using the `refund_id`.
|
117
|
+
# @param [String] refund_id Required parameter: Unique ID for the desired
|
118
|
+
# `PaymentRefund`.
|
119
|
+
# @return [GetPaymentRefundResponse Hash] response from the API call
|
120
|
+
def get_payment_refund(refund_id:)
|
121
|
+
# Prepare query url.
|
122
|
+
_query_builder = config.get_base_uri
|
123
|
+
_query_builder << '/v2/refunds/{refund_id}'
|
124
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
125
|
+
_query_builder,
|
126
|
+
'refund_id' => refund_id
|
127
|
+
)
|
128
|
+
_query_url = APIHelper.clean_url _query_builder
|
129
|
+
|
130
|
+
# Prepare headers.
|
131
|
+
_headers = {
|
132
|
+
'accept' => 'application/json'
|
133
|
+
}
|
134
|
+
|
135
|
+
# Prepare and execute HttpRequest.
|
136
|
+
_request = config.http_client.get(
|
137
|
+
_query_url,
|
138
|
+
headers: _headers
|
139
|
+
)
|
140
|
+
OAuth2.apply(config, _request)
|
141
|
+
_response = execute_request(_request)
|
142
|
+
|
143
|
+
# Return appropriate response type.
|
144
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
145
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
146
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -1,143 +1,145 @@
|
|
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
|
43
|
-
|
44
|
-
|
45
|
-
_query_builder
|
46
|
-
_query_builder
|
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
|
-
#
|
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 =
|
112
|
-
|
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
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
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 Reporting'\
|
43
|
+
'Api is deprecated'
|
44
|
+
# Prepare query url.
|
45
|
+
_query_builder = config.get_base_uri
|
46
|
+
_query_builder << '/v2/locations/{location_id}/additional-recipient-receivable-refunds'
|
47
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
48
|
+
_query_builder,
|
49
|
+
'location_id' => location_id
|
50
|
+
)
|
51
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
52
|
+
_query_builder,
|
53
|
+
'begin_time' => begin_time,
|
54
|
+
'end_time' => end_time,
|
55
|
+
'sort_order' => sort_order,
|
56
|
+
'cursor' => cursor
|
57
|
+
)
|
58
|
+
_query_url = APIHelper.clean_url _query_builder
|
59
|
+
|
60
|
+
# Prepare headers.
|
61
|
+
_headers = {
|
62
|
+
'accept' => 'application/json'
|
63
|
+
}
|
64
|
+
|
65
|
+
# Prepare and execute HttpRequest.
|
66
|
+
_request = config.http_client.get(
|
67
|
+
_query_url,
|
68
|
+
headers: _headers
|
69
|
+
)
|
70
|
+
OAuth2.apply(config, _request)
|
71
|
+
_response = execute_request(_request)
|
72
|
+
|
73
|
+
# Return appropriate response type.
|
74
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
75
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
76
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Returns a list of receivables (across all possible sending locations)
|
80
|
+
# representing monies credited
|
81
|
+
# to the provided location ID by another Square account using the
|
82
|
+
# `additional_recipients` field in a transaction.
|
83
|
+
# Max results per [page](#paginatingresults): 50
|
84
|
+
# @param [String] location_id Required parameter: The ID of the location to
|
85
|
+
# list AdditionalRecipientReceivables for.
|
86
|
+
# @param [String] begin_time Optional parameter: The beginning of the
|
87
|
+
# requested reporting period, in RFC 3339 format. See [Date
|
88
|
+
# ranges](#dateranges) for details on date inclusivity/exclusivity. Default
|
89
|
+
# value: The current time minus one year.
|
90
|
+
# @param [String] end_time Optional parameter: The end of the requested
|
91
|
+
# reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for
|
92
|
+
# details on date inclusivity/exclusivity. Default value: The current
|
93
|
+
# time.
|
94
|
+
# @param [SortOrder] sort_order Optional parameter: The order in which
|
95
|
+
# results are listed in the response (`ASC` for oldest first, `DESC` for
|
96
|
+
# newest first). Default value: `DESC`
|
97
|
+
# @param [String] cursor Optional parameter: A pagination cursor returned by
|
98
|
+
# a previous call to this endpoint. Provide this to retrieve the next set of
|
99
|
+
# results for your original query. See
|
100
|
+
# [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)
|
101
|
+
# for more information.
|
102
|
+
# @return [ListAdditionalRecipientReceivablesResponse Hash] response from the API call
|
103
|
+
def list_additional_recipient_receivables(location_id:,
|
104
|
+
begin_time: nil,
|
105
|
+
end_time: nil,
|
106
|
+
sort_order: nil,
|
107
|
+
cursor: nil)
|
108
|
+
warn 'Endpoint list_additional_recipient_receivables in ReportingApi is '\
|
109
|
+
'deprecated'
|
110
|
+
# Prepare query url.
|
111
|
+
_query_builder = config.get_base_uri
|
112
|
+
_query_builder << '/v2/locations/{location_id}/additional-recipient-receivables'
|
113
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
114
|
+
_query_builder,
|
115
|
+
'location_id' => location_id
|
116
|
+
)
|
117
|
+
_query_builder = APIHelper.append_url_with_query_parameters(
|
118
|
+
_query_builder,
|
119
|
+
'begin_time' => begin_time,
|
120
|
+
'end_time' => end_time,
|
121
|
+
'sort_order' => sort_order,
|
122
|
+
'cursor' => cursor
|
123
|
+
)
|
124
|
+
_query_url = APIHelper.clean_url _query_builder
|
125
|
+
|
126
|
+
# Prepare headers.
|
127
|
+
_headers = {
|
128
|
+
'accept' => 'application/json'
|
129
|
+
}
|
130
|
+
|
131
|
+
# Prepare and execute HttpRequest.
|
132
|
+
_request = config.http_client.get(
|
133
|
+
_query_url,
|
134
|
+
headers: _headers
|
135
|
+
)
|
136
|
+
OAuth2.apply(config, _request)
|
137
|
+
_response = execute_request(_request)
|
138
|
+
|
139
|
+
# Return appropriate response type.
|
140
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
141
|
+
_errors = APIHelper.map_response(decoded, ['errors'])
|
142
|
+
ApiResponse.new(_response, data: decoded, errors: _errors)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|