Class: Airwallex::Conversion

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List, APIOperations::Retrieve
Defined in:
lib/airwallex/resources/conversion.rb

Overview

Conversion resource for currency exchange

Execute currency conversions with locked quotes or at market rates. Conversions move funds between currency balances in your account.

Examples:

Convert with locked quote

quote = Airwallex::Quote.create(
  buy_currency: 'EUR',
  sell_currency: 'USD',
  sell_amount: 1000.00
)
conversion = Airwallex::Conversion.create(
  quote_id: quote.id,
  request_id: "conv_#{Time.now.to_i}"
)

Convert at market rate

conversion = Airwallex::Conversion.create(
  buy_currency: 'EUR',
  sell_currency: 'USD',
  sell_amount: 500.00,
  request_id: "conv_#{Time.now.to_i}"
)

List conversion history

conversions = Airwallex::Conversion.list(
  sell_currency: 'USD',
  status: 'COMPLETED'
)

Instance Attribute Summary

Attributes inherited from APIResource

#attributes, #id

Class Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::Retrieve

retrieve

Methods included from APIOperations::List

list

Methods inherited from APIResource

#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, #to_hash, #to_json, #to_s

Constructor Details

This class inherits a constructor from Airwallex::APIResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Airwallex::APIResource

Class Method Details

.resource_pathObject



39
40
41
# File 'lib/airwallex/resources/conversion.rb', line 39

def self.resource_path
  "/api/v1/conversions"
end