Class: OandaRubyClient::RatesRequest
- Inherits:
-
Object
- Object
- OandaRubyClient::RatesRequest
- Defined in:
- lib/oanda_ruby_client/rates_request.rb
Instance Attribute Summary collapse
-
#base_currency ⇒ Object
Returns the value of attribute base_currency.
-
#query_params ⇒ Object
Returns the value of attribute query_params.
Instance Method Summary collapse
-
#initialize(base_currency, query_params = {}) ⇒ RatesRequest
constructor
A new instance of RatesRequest.
-
#query_string ⇒ String
The query string that will be passed to the API.
Constructor Details
#initialize(base_currency, query_params = {}) ⇒ RatesRequest
Returns a new instance of RatesRequest.
12 13 14 |
# 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 |
Instance Attribute Details
#base_currency ⇒ Object
Returns the value of attribute base_currency.
8 9 10 |
# File 'lib/oanda_ruby_client/rates_request.rb', line 8 def base_currency @base_currency end |
#query_params ⇒ Object
Returns the value of attribute query_params.
8 9 10 |
# File 'lib/oanda_ruby_client/rates_request.rb', line 8 def query_params @query_params end |
Instance Method Details
#query_string ⇒ String
Returns the query string that will be passed to the API.
17 18 19 20 21 22 23 24 25 26 |
# 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 |