Class: Straddle::Resources::CapabilityRequests

Inherits:
Object
  • Object
show all
Defined in:
lib/straddle/resources/capability_requests.rb,
sig/straddle/resources/capability_requests.rbs

Overview

Capability requests change the payment, customer, and consent types available to an account.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CapabilityRequests

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CapabilityRequests.

Parameters:



112
113
114
# File 'lib/straddle/resources/capability_requests.rb', line 112

def initialize(client:)
  @client = client
end

Instance Method Details

#create(account_id, businesses: nil, charges: nil, individuals: nil, internet: nil, payouts: nil, signed_agreement: nil, correlation_id: nil, idempotency_key: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::CapabilityRequestList

Some parameter documentations has been truncated, see Models::CapabilityRequestCreateParams for more details.

Creates one or more capability requests for an account and returns the resulting requests.

Parameters:

Returns:

See Also:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/straddle/resources/capability_requests.rb', line 41

def create(, params = {})
  parsed, options = Straddle::CapabilityRequestCreateParams.dump_request(params)
  header_params = {
    correlation_id: "correlation-id",
    idempotency_key: "idempotency-key",
    request_id: "request-id"
  }
  @client.request(
    method: :post,
    path: ["v1/accounts/%1$s/capability_requests", ],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Straddle::CapabilityRequestList,
    options: options
  )
end

#list(account_id, category: nil, page_number: nil, page_size: nil, sort_by: nil, sort_order: nil, status: nil, type: nil, correlation_id: nil, request_id: nil, request_options: {}) ⇒ Straddle::Models::CapabilityRequestList

Some parameter documentations has been truncated, see Models::CapabilityRequestListParams for more details.

Returns a paginated list of capability requests for an account. Filter the list by capability type, category, or status.

Parameters:

Returns:

See Also:



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/straddle/resources/capability_requests.rb', line 91

def list(, params = {})
  query_params = i[category page_number page_size sort_by sort_order status type]
  parsed, options = Straddle::CapabilityRequestListParams.dump_request(params)
  query = Straddle::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["v1/accounts/%1$s/capability_requests", ],
    query: query,
    headers:
      parsed.except(*query_params).transform_keys(
        correlation_id: "correlation-id",
        request_id: "request-id"
      ),
    model: Straddle::CapabilityRequestList,
    options: options
  )
end