Class: BankOfThailand::AverageExchangeRate
- Defined in:
- lib/bank_of_thailand/resources/average_exchange_rate.rb
Overview
Average Exchange Rate - THB / Foreign Currency resource
This resource provides access to daily average exchange rates between Thai Baht and 19 foreign currencies from commercial banks in Thailand.
Constant Summary collapse
- BASE_URL =
"https://gateway.api.bot.or.th/Stat-ExchangeRate/v2"
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#annual(start_period:, end_period:, currency: nil) ⇒ Hash
Get annual average exchange rates.
-
#daily(start_period:, end_period:, currency: nil) ⇒ Hash
Get daily average exchange rates.
-
#monthly(start_period:, end_period:, currency: nil) ⇒ Hash
Get monthly average exchange rates.
-
#quarterly(start_period:, end_period:, currency: nil) ⇒ Hash
Get quarterly average exchange rates.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from BankOfThailand::Resource
Instance Method Details
#annual(start_period:, end_period:, currency: nil) ⇒ Hash
Get annual average exchange rates
68 69 70 71 72 73 |
# File 'lib/bank_of_thailand/resources/average_exchange_rate.rb', line 68 def annual(start_period:, end_period:, currency: nil) params = { start_period: start_period, end_period: end_period } params[:currency] = currency if currency get_with_base_url("/ANNUAL_AVG_EXG_RATE/", params) end |
#daily(start_period:, end_period:, currency: nil) ⇒ Hash
Get daily average exchange rates
26 27 28 29 30 31 |
# File 'lib/bank_of_thailand/resources/average_exchange_rate.rb', line 26 def daily(start_period:, end_period:, currency: nil) params = { start_period: start_period, end_period: end_period } params[:currency] = currency if currency get_with_base_url("/DAILY_AVG_EXG_RATE/", params) end |
#monthly(start_period:, end_period:, currency: nil) ⇒ Hash
Get monthly average exchange rates
40 41 42 43 44 45 |
# File 'lib/bank_of_thailand/resources/average_exchange_rate.rb', line 40 def monthly(start_period:, end_period:, currency: nil) params = { start_period: start_period, end_period: end_period } params[:currency] = currency if currency get_with_base_url("/MONTHLY_AVG_EXG_RATE/", params) end |
#quarterly(start_period:, end_period:, currency: nil) ⇒ Hash
Get quarterly average exchange rates
54 55 56 57 58 59 |
# File 'lib/bank_of_thailand/resources/average_exchange_rate.rb', line 54 def quarterly(start_period:, end_period:, currency: nil) params = { start_period: start_period, end_period: end_period } params[:currency] = currency if currency get_with_base_url("/QUARTERLY_AVG_EXG_RATE/", params) end |