Class: Square::PayoutsApi
- Defined in:
- lib/square/api/payouts_api.rb
Overview
PayoutsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#get_payout(payout_id:) ⇒ GetPayoutResponse Hash
Retrieves details of a specific payout identified by a payout ID.
-
#initialize(config, http_call_back: nil) ⇒ PayoutsApi
constructor
A new instance of PayoutsApi.
-
#list_payout_entries(payout_id:, sort_order: nil, cursor: nil, limit: nil) ⇒ ListPayoutEntriesResponse Hash
Retrieves a list of all payout entries for a specific payout.
-
#list_payouts(location_id: nil, status: nil, begin_time: nil, end_time: nil, sort_order: nil, cursor: nil, limit: nil) ⇒ ListPayoutsResponse Hash
Retrieves a list of all payouts for the default location.
Methods inherited from BaseApi
#execute_request, #get_user_agent, #validate_parameters, #validate_parameters_types
Constructor Details
#initialize(config, http_call_back: nil) ⇒ PayoutsApi
Returns a new instance of PayoutsApi.
4 5 6 |
# File 'lib/square/api/payouts_api.rb', line 4 def initialize(config, http_call_back: nil) super(config, http_call_back: http_call_back) end |
Instance Method Details
#get_payout(payout_id:) ⇒ GetPayoutResponse Hash
Retrieves details of a specific payout identified by a payout ID. To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. retrieve the information for.
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 112 113 |
# File 'lib/square/api/payouts_api.rb', line 84 def get_payout(payout_id:) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/payouts/{payout_id}' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'payout_id' => { 'value' => payout_id, 'encode' => true } ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#list_payout_entries(payout_id:, sort_order: nil, cursor: nil, limit: nil) ⇒ ListPayoutEntriesResponse Hash
Retrieves a list of all payout entries for a specific payout. To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. retrieve the information for. payout entries are listed. a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. For more information, see [Pagination](developer.squareup.com/docs/basics/api101/pagination) . If request parameters change between requests, subsequent results may contain duplicates or missing records. to be returned in a single page. It is possible to receive fewer results than the specified limit on a given page. The default value of 100 is also the maximum allowed value. If the provided value is greater than 100, it is ignored and the default value is used instead. Default: `100`
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/square/api/payouts_api.rb', line 133 def list_payout_entries(payout_id:, sort_order: nil, cursor: nil, limit: nil) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/payouts/{payout_id}/payout-entries' _query_builder = APIHelper.append_url_with_template_parameters( _query_builder, 'payout_id' => { 'value' => payout_id, 'encode' => true } ) _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'sort_order' => sort_order, 'cursor' => cursor, 'limit' => limit ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |
#list_payouts(location_id: nil, status: nil, begin_time: nil, end_time: nil, sort_order: nil, cursor: nil, limit: nil) ⇒ ListPayoutsResponse Hash
Retrieves a list of all payouts for the default location. You can filter payouts by location ID, status, time range, and order them in ascending or descending order. To call this endpoint, set `PAYOUTS_READ` for the OAuth scope. which to list the payouts. By default, payouts are returned for the default (main) location associated with the seller. with the given status are returned. beginning of the payout creation time, in RFC 3339 format. Inclusive. Default: The current time minus one year. the payout creation time, in RFC 3339 format. Default: The current time. payouts are listed. a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. For more information, see [Pagination](developer.squareup.com/docs/basics/api101/pagination) . If request parameters change between requests, subsequent results may contain duplicates or missing records. to be returned in a single page. It is possible to receive fewer results than the specified limit on a given page. The default value of 100 is also the maximum allowed value. If the provided value is greater than 100, it is ignored and the default value is used instead. Default: `100`
36 37 38 39 40 41 42 43 44 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 |
# File 'lib/square/api/payouts_api.rb', line 36 def list_payouts(location_id: nil, status: nil, begin_time: nil, end_time: nil, sort_order: nil, cursor: nil, limit: nil) # Prepare query url. _query_builder = config.get_base_uri _query_builder << '/v2/payouts' _query_builder = APIHelper.append_url_with_query_parameters( _query_builder, 'location_id' => location_id, 'status' => status, 'begin_time' => begin_time, 'end_time' => end_time, 'sort_order' => sort_order, 'cursor' => cursor, 'limit' => limit ) _query_url = APIHelper.clean_url _query_builder # Prepare headers. _headers = { 'accept' => 'application/json' } # Prepare and execute HttpRequest. _request = config.http_client.get( _query_url, headers: _headers ) OAuth2.apply(config, _request) _response = execute_request(_request) # Return appropriate response type. decoded = APIHelper.json_deserialize(_response.raw_body) _errors = APIHelper.map_response(decoded, ['errors']) ApiResponse.new( _response, data: decoded, errors: _errors ) end |