Class: SpotRate::GoogleCurrencyConverter
- Inherits:
-
Object
- Object
- SpotRate::GoogleCurrencyConverter
- Defined in:
- lib/spot_rate/google_currency_converter.rb
Constant Summary collapse
- GOOGLE_CURRENCY_URI =
'http://www.google.com/ig/calculator?hl=en&q=1%s=?%s'
Instance Attribute Summary collapse
-
#from_currency ⇒ Object
Returns the value of attribute from_currency.
-
#to_currency ⇒ Object
Returns the value of attribute to_currency.
Instance Method Summary collapse
-
#initialize(from_currency, to_currency) ⇒ GoogleCurrencyConverter
constructor
A new instance of GoogleCurrencyConverter.
- #spot_rate ⇒ Object
Constructor Details
#initialize(from_currency, to_currency) ⇒ GoogleCurrencyConverter
Returns a new instance of GoogleCurrencyConverter.
9 10 11 12 |
# File 'lib/spot_rate/google_currency_converter.rb', line 9 def initialize from_currency, to_currency @from_currency = from_currency @to_currency = to_currency end |
Instance Attribute Details
#from_currency ⇒ Object
Returns the value of attribute from_currency.
7 8 9 |
# File 'lib/spot_rate/google_currency_converter.rb', line 7 def from_currency @from_currency end |
#to_currency ⇒ Object
Returns the value of attribute to_currency.
7 8 9 |
# File 'lib/spot_rate/google_currency_converter.rb', line 7 def to_currency @to_currency end |
Instance Method Details
#spot_rate ⇒ Object
14 15 16 17 |
# File 'lib/spot_rate/google_currency_converter.rb', line 14 def spot_rate @response = Net::HTTP.get ccy_api_uri validate_converter_response! and pluck_spot_rate_from_converter_response end |