class OandaRubyClient::RatesRequest
Attributes
base_currency[RW]
query_params[RW]
Public Class Methods
new(base_currency, query_params = {})
click to toggle source
@param base_currency
[String] Currency code for the base currency @param query_params
[Hash] Optional query parameters
# File lib/oanda_ruby_client/rates_request.rb, line 12 def initialize(base_currency, query_params = {}) @base_currency, @query_params = base_currency.to_s.upcase, query_params end
Public Instance Methods
query_string()
click to toggle source
@return [String] the query string that will be passed to the API
# File lib/oanda_ruby_client/rates_request.rb, line 17 def query_string [ :date, :start, :end ].each do |date_key| if query_params[date_key] && query_params[date_key].is_a?(Date) query_params[date_key] = query_params[date_key].iso8601 end end uri = Addressable::URI.new uri.query_values = query_params uri.query end