Class: ModernTreasury::Resources::Returns

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/resources/returns.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Returns

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 Returns.

Parameters:



106
107
108
# File 'lib/modern_treasury/resources/returns.rb', line 106

def initialize(client:)
  @client = client
end

Instance Method Details

#create(returnable_id: , returnable_type: , additional_information: nil, code: nil, corrections: nil, data: nil, date_of_death: nil, reason: nil, reconciliation_status: nil, request_options: {}) ⇒ ModernTreasury::Models::ReturnObject

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

Create a return.

Parameters:

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
# File 'lib/modern_treasury/resources/returns.rb', line 36

def create(params)
  parsed, options = ModernTreasury::ReturnCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/returns",
    body: parsed,
    model: ModernTreasury::ReturnObject,
    options: options
  )
end

#list(after_cursor: nil, counterparty_id: nil, internal_account_id: nil, per_page: nil, returnable_id: nil, returnable_type: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::ReturnObject>

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

Get a list of returns.

Parameters:

  • after_cursor (String, nil)
  • counterparty_id (String)

    Specify ‘counterparty_id` if you wish to see returns that occurred with a specif

  • internal_account_id (String)

    Specify ‘internal_account_id` if you wish to see returns to/from a specific acco

  • per_page (Integer)
  • returnable_id (String)

    The ID of a valid returnable. Must be accompanied by ‘returnable_type`.

  • returnable_type (Symbol, ModernTreasury::Models::ReturnListParams::ReturnableType)

    One of ‘payment_order`, `reversal`, or `incoming_payment_detail`. Must be accomp

  • request_options (ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



91
92
93
94
95
96
97
98
99
100
101
# File 'lib/modern_treasury/resources/returns.rb', line 91

def list(params = {})
  parsed, options = ModernTreasury::ReturnListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "api/returns",
    query: parsed,
    page: ModernTreasury::Internal::Page,
    model: ModernTreasury::ReturnObject,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ ModernTreasury::Models::ReturnObject

Get a single return.

Parameters:

Returns:

See Also:



58
59
60
61
62
63
64
65
# File 'lib/modern_treasury/resources/returns.rb', line 58

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["api/returns/%1$s", id],
    model: ModernTreasury::ReturnObject,
    options: params[:request_options]
  )
end