Class: Square::PayoutsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/square/api/payouts_api.rb

Overview

PayoutsApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Square::BaseApi

Instance Method Details

#get_payout(payout_id:) ⇒ ApiResponse

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.

Parameters:

  • payout_id (String)

    Required parameter: The ID of the payout to

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/square/api/payouts_api.rb', line 64

def get_payout(payout_id:)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/payouts/{payout_id}',
                                 'default')
               .template_param(new_parameter(payout_id, key: 'payout_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .convertor(ApiResponse.method(:create)))
    .execute
end

#list_payout_entries(payout_id:, sort_order: nil, cursor: nil, limit: nil) ⇒ ApiResponse

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/build-basics/common-api-p atterns/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`

Parameters:

  • payout_id (String)

    Required parameter: The ID of the payout to

  • sort_order (SortOrder) (defaults to: nil)

    Optional parameter: The order in which

  • cursor (String) (defaults to: nil)

    Optional parameter: A pagination cursor returned by

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of results

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/square/api/payouts_api.rb', line 98

def list_payout_entries(payout_id:,
                        sort_order: nil,
                        cursor: nil,
                        limit: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/payouts/{payout_id}/payout-entries',
                                 'default')
               .template_param(new_parameter(payout_id, key: 'payout_id')
                                .should_encode(true))
               .query_param(new_parameter(sort_order, key: 'sort_order'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .convertor(ApiResponse.method(:create)))
    .execute
end

#list_payouts(location_id: nil, status: nil, begin_time: nil, end_time: nil, sort_order: nil, cursor: nil, limit: nil) ⇒ ApiResponse

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/build-basics/common-api-p atterns/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`

Parameters:

  • location_id (String) (defaults to: nil)

    Optional parameter: The ID of the location for

  • status (PayoutStatus) (defaults to: nil)

    Optional parameter: If provided, only payouts

  • begin_time (String) (defaults to: nil)

    Optional parameter: The timestamp for the

  • end_time (String) (defaults to: nil)

    Optional parameter: The timestamp for the end of

  • sort_order (SortOrder) (defaults to: nil)

    Optional parameter: The order in which

  • cursor (String) (defaults to: nil)

    Optional parameter: A pagination cursor returned by

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of results

Returns:

  • (ApiResponse)

    the complete http response with raw body and status code.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/square/api/payouts_api.rb', line 32

def list_payouts(location_id: nil,
                 status: nil,
                 begin_time: nil,
                 end_time: nil,
                 sort_order: nil,
                 cursor: nil,
                 limit: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/payouts',
                                 'default')
               .query_param(new_parameter(location_id, key: 'location_id'))
               .query_param(new_parameter(status, key: 'status'))
               .query_param(new_parameter(begin_time, key: 'begin_time'))
               .query_param(new_parameter(end_time, key: 'end_time'))
               .query_param(new_parameter(sort_order, key: 'sort_order'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .query_param(new_parameter(limit, key: 'limit'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:json_deserialize))
                .is_api_response(true)
                .convertor(ApiResponse.method(:create)))
    .execute
end