Skip to content

Commit

Permalink
fix path
Browse files Browse the repository at this point in the history
  • Loading branch information
paulomcnally committed Jun 2, 2017
1 parent 66d88a7 commit 9b08c3f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
4 changes: 2 additions & 2 deletions lib/exchange_rates_ni.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require_relative 'exchange_rates_ni/bac'
require_relative 'exchange_rates_ni/bcn'
require 'exchange_rates_ni/bac'
require 'exchange_rates_ni/bcn'

class ExchangeRatesNi
# currency: USD|EUR
Expand Down
2 changes: 1 addition & 1 deletion lib/exchange_rates_ni/bac.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rest-client'
require 'json'
require_relative 'currency'
require 'currency'

# bank: Bac Credomatic
# web: https://www.baccredomatic.com/en
Expand Down
19 changes: 9 additions & 10 deletions lib/exchange_rates_ni/bcn.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'savon'
require_relative 'currency'
require 'currency'

# bank: Banco Central de Nicaragua
# web: http://www.bcn.gob.ni/
Expand All @@ -15,9 +15,9 @@ def initialize(currency)
# today
def today
request = @client.call(:recupera_tc_dia, message: {
Ano: Time.now.year,
Mes: Time.now.month,
Dia: Time.now.day
Ano: Time.now.year,
Mes: Time.now.month,
Dia: Time.now.day
})

request.body[:recupera_tc_dia_response][:recupera_tc_dia_result]
Expand All @@ -29,23 +29,22 @@ def today
# param: day
def by_date(year, month, day)
request = @client.call(:recupera_tc_dia, message: {
Ano: year,
Mes: month,
Dia: day
Ano: year,
Mes: month,
Dia: day
})

request.body[:recupera_tc_dia_response][:recupera_tc_dia_result]
end



# by_month
# param: year
# param: month
def by_month(year, month)
request = @client.call(:recupera_tc_mes, message: {
Ano: year,
Mes: month
Ano: year,
Mes: month
})

response = request.body[:recupera_tc_mes_response][:recupera_tc_mes_result][:detalle_tc][:tc]
Expand Down
15 changes: 2 additions & 13 deletions test/test_exchange_rates_ni.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,13 @@

class ExchangeRatesNiTest < Minitest::Test

def test_bac
rates = ExchangeRatesNi.new('USD')
assert_match(/\d+/, rates.bac.sale.to_s, 'Invalid response')
end


def test_bcn_today
rates = ExchangeRatesNi.new('USD')
puts rates.bcn.today.to_s
assert_match(/\d+/, rates.bcn.today.to_s, 'Invalid response')
end

def test_bcn_by_date
rates = ExchangeRatesNi.new('USD')
assert_match(/\d+/, rates.bcn.by_date(2017,3,1).to_s, 'Invalid response')
end

def test_bcn_by_month
rates = ExchangeRatesNi.new('USD')
assert_match(/\d+/, rates.bcn.by_month(2017,3).to_s, 'Invalid response')
end

end

0 comments on commit 9b08c3f

Please sign in to comment.