Skip to content

Commit

Permalink
fixed BROU change, bumped up version
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbalarini committed Jul 27, 2015
1 parent 11ca284 commit 208b1cb
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ script: 'bundle exec rake'
notifications:
email:
recipients:
- jpbalarini@email.com
- jpbalarini@gmail.com
on_failure: change
on_success: never
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Usage is simple, just call the exchange_rates method with a valid key:

UruguayanExchangeRates.exchange_rates(:UYU_USD)

It should return an array with two elements, buy and sell values respectively:
It should return a hash with two elements, buy and sell values respectively:

[25.95, 26.75]
{:buy=>28.0, :sell=>28.8}

Supported keys are:

Expand Down
7 changes: 1 addition & 6 deletions lib/uruguayan_exchange_rates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
require 'uruguayan_exchange_rates/error'
require 'uruguayan_exchange_rates/util'

# TODO: remove nokogiri and add a regular expression
# TODO: compare in lowercase
# TODO: add version numbers to gem dependencies
# TODO: pass multiple currencies to lower server requests

module UruguayanExchangeRates
SERVICE_HOST = 'http://www.bancorepublica.com.uy'
SERVICE_PATH = '/web/guest/institucional/cotizaciones'
SERVICE_PATH = '/c/portal/render_portlet?p_l_id=123137&p_p_id=ExchangeLarge_WAR_ExchangeRate5121_INSTANCE_P2Af'

def self.exchange_rates(currency)
currency_raw = Constants[currency]
Expand Down
1 change: 1 addition & 0 deletions lib/uruguayan_exchange_rates/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def extract_values(currency_data)
# Remove spaces
values.gsub!(/(?:\n\r?|\r\n?)/, ' ').strip!
buy, sell = values.split(/\s+/).map{ |v| v.to_f }
{ buy: buy, sell: sell }
end
end
end
2 changes: 1 addition & 1 deletion lib/uruguayan_exchange_rates/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module UruguayanExchangeRates
VERSION = "0.0.1"
VERSION = "1.0.0"
end
4 changes: 2 additions & 2 deletions spec/exchange_rates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
context 'with valid params' do
it 'should return 2 parameters' do
UruguayanExchangeRates::Constants.keys.each do |key|
expect(UruguayanExchangeRates::exchange_rates(key)[0]).to be > 0.0
expect(UruguayanExchangeRates::exchange_rates(key)[1]).to be > 0.0
expect(UruguayanExchangeRates::exchange_rates(key)[:buy]).to be > 0.0
expect(UruguayanExchangeRates::exchange_rates(key)[:sell]).to be > 0.0
expect(UruguayanExchangeRates::exchange_rates(key).count).to eq(2)
end
end
Expand Down

0 comments on commit 208b1cb

Please sign in to comment.