Class: Airwallex::Rate

Inherits:
APIResource show all
Extended by:
APIOperations::Retrieve
Defined in:
lib/airwallex/resources/rate.rb

Overview

Rate resource for real-time exchange rates

Get indicative exchange rates for currency pairs. Rates are real-time but not locked - use Quote for guaranteed rates.

There is no .list — /fx/rates/current always returns the rate for one specific currency pair, not a collection.

Examples:

Get current rate

rate = Airwallex::Rate.retrieve(buy_currency: 'EUR', sell_currency: 'USD')
puts "1 USD = #{rate.client_rate} EUR"

Instance Attribute Summary

Attributes inherited from APIResource

#attributes, #id

Class Method Summary collapse

Methods included from APIOperations::Retrieve

retrieve

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



18
19
20
# File 'lib/airwallex/resources/rate.rb', line 18

def self.resource_path
  "/api/v1/fx/rates/current"
end

.retrieve(params = {}) ⇒ Object

Override retrieve to handle query parameters instead of ID



23
24
25
26
# File 'lib/airwallex/resources/rate.rb', line 23

def self.retrieve(params = {})
  response = Airwallex.client.get(resource_path, params)
  new(response)
end