Class: ModernTreasury::Resources::ForeignExchangeQuotes

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ForeignExchangeQuotes

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

Parameters:



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

def initialize(client:)
  @client = client
end

Instance Method Details

#create(internal_account_id: , target_currency: , base_amount: nil, base_currency: nil, effective_at: nil, target_amount: nil, request_options: {}) ⇒ ModernTreasury::Models::ForeignExchangeQuote

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

create foreign_exchange_quote

Parameters:

  • internal_account_id (String)

    The ID for the ‘InternalAccount` this quote is associated with.

  • target_currency (Symbol, ModernTreasury::Models::Currency)

    Currency to convert the ‘base_currency` to, often called the “buy” currency.

  • base_amount (Integer)

    Amount in the lowest denomination of the ‘base_currency` to convert, often calle

  • base_currency (Symbol, ModernTreasury::Models::Currency)

    Currency to convert, often called the “sell” currency.

  • effective_at (Time)

    The timestamp until when the quoted rate is valid.

  • target_amount (Integer)

    Amount in the lowest denomination of the ‘target_currency`, often called the “bu

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

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/modern_treasury/resources/foreign_exchange_quotes.rb', line 30

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

#list(after_cursor: nil, base_currency: nil, effective_at_end: nil, effective_at_start: nil, expires_at: nil, internal_account_id: nil, metadata: nil, per_page: nil, target_currency: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::ForeignExchangeQuote>

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

list foreign_exchange_quotes

Parameters:

  • after_cursor (String, nil)
  • base_currency (String)

    Currency to convert, often called the “sell” currency.

  • effective_at_end (Date)

    An inclusive upper bound for searching effective_at

  • effective_at_start (Date)

    An inclusive lower bound for searching effective_at

  • expires_at (Time)

    The timestamp until which the quote must be booked by.

  • internal_account_id (String)

    The ID for the ‘InternalAccount` this quote is associated with.

  • metadata (Hash{Symbol=>String})

    For example, if you want to query for records with metadata key ‘Type` and value

  • per_page (Integer)
  • target_currency (String)

    Currency to convert the ‘base_currency` to, often called the “buy” currency.

  • 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/foreign_exchange_quotes.rb', line 91

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

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

get foreign_exchange_quote

Parameters:

Returns:

See Also:



52
53
54
55
56
57
58
59
# File 'lib/modern_treasury/resources/foreign_exchange_quotes.rb', line 52

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