uruguayan_exchange_rates 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb93362ca62e2dfe9ac27897819487d1d89ea939
4
- data.tar.gz: da06a9b4763d3a5fc1f18ac992c346ba677ac15b
3
+ metadata.gz: ea5129e3eaf6671dbf696ce2ef87be008fe10224
4
+ data.tar.gz: 6e1c62ebedfa4e40bf62883e26854e8ea503314d
5
5
  SHA512:
6
- metadata.gz: b62337d1cb332ddb558f8b59475fd131f40e8d59b6d850662fa8da2bea60a1ec3dc535ff1aaefa655f62dbd4781cd275f7ed52dd5c2af140379268b874de6e10
7
- data.tar.gz: 72431aa54a422986cd544ed96d769c83888f088494ba1a27cccc7de69846809c324bbfb61b424d43343019bf13d36f6e2c1127396ad2552b716808410a3fb8a2
6
+ metadata.gz: 34fb69c04dd4c50dc783bc42032e76dd7e396c2ccf91ee989b3ebe5819ea0415996e8a9102f417eb36ef75cf05993e1777da6c6e1b4081ba0cd57793ece9a54f
7
+ data.tar.gz: 5e4d8a80e048659b3976533cd440aa4b2fe6aad3216df6b19dc42831a01d55789ff59e1259297f06324bad4840c07dfd2720ac1a4ac42a4cb112f5550b4b24f2
data/.travis.yml CHANGED
@@ -10,6 +10,6 @@ script: 'bundle exec rake'
10
10
  notifications:
11
11
  email:
12
12
  recipients:
13
- - jpbalarini@email.com
13
+ - jpbalarini@gmail.com
14
14
  on_failure: change
15
15
  on_success: never
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Code Climate](https://codeclimate.com/github/jpbalarini/uruguayan_exchange_rates/badges/gpa.svg)](https://codeclimate.com/github/jpbalarini/uruguayan_exchange_rates)
4
4
  [![Build Status](https://travis-ci.org/jpbalarini/uruguayan_exchange_rates.svg?branch=master)](https://travis-ci.org/jpbalarini/uruguayan_exchange_rates)
5
5
 
6
- With this gem you can get the official Uruguayan exchange rates (buy and sell) for multiple currencies. Data is taken from Banco República.
6
+ With this gem you can get the official Uruguayan exchange rates (buy and sell values) for multiple currencies. Data is taken from Banco República.
7
7
  This gem was designed for a project where I needed to update the price of some elements daily, using the official Uruguayan exchange rates.
8
8
 
9
9
  ## Installation
@@ -26,9 +26,9 @@ Usage is simple, just call the exchange_rates method with a valid key:
26
26
 
27
27
  UruguayanExchangeRates.exchange_rates(:UYU_USD)
28
28
 
29
- It should return an array with two elements, buy and sell values respectively:
29
+ It should return a hash with two elements, buy and sell values respectively:
30
30
 
31
- [25.95, 26.75]
31
+ {:buy=>28.0, :sell=>28.8}
32
32
 
33
33
  Supported keys are:
34
34
 
@@ -33,6 +33,7 @@ module UruguayanExchangeRates
33
33
  # Remove spaces
34
34
  values.gsub!(/(?:\n\r?|\r\n?)/, ' ').strip!
35
35
  buy, sell = values.split(/\s+/).map{ |v| v.to_f }
36
+ { buy: buy, sell: sell }
36
37
  end
37
38
  end
38
39
  end
@@ -1,3 +1,3 @@
1
1
  module UruguayanExchangeRates
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -3,12 +3,9 @@ require 'uruguayan_exchange_rates/constants'
3
3
  require 'uruguayan_exchange_rates/error'
4
4
  require 'uruguayan_exchange_rates/util'
5
5
 
6
- # TODO: remove nokogiri and add a regular expression
7
- # TODO: compare in lowercase
8
-
9
6
  module UruguayanExchangeRates
10
7
  SERVICE_HOST = 'http://www.bancorepublica.com.uy'
11
- SERVICE_PATH = '/web/guest/institucional/cotizaciones'
8
+ SERVICE_PATH = '/c/portal/render_portlet?p_l_id=123137&p_p_id=ExchangeLarge_WAR_ExchangeRate5121_INSTANCE_P2Af'
12
9
 
13
10
  def self.exchange_rates(currency)
14
11
  currency_raw = Constants[currency]
@@ -5,8 +5,8 @@ describe UruguayanExchangeRates do
5
5
  context 'with valid params' do
6
6
  it 'should return 2 parameters' do
7
7
  UruguayanExchangeRates::Constants.keys.each do |key|
8
- expect(UruguayanExchangeRates::exchange_rates(key)[0]).to be > 0.0
9
- expect(UruguayanExchangeRates::exchange_rates(key)[1]).to be > 0.0
8
+ expect(UruguayanExchangeRates::exchange_rates(key)[:buy]).to be > 0.0
9
+ expect(UruguayanExchangeRates::exchange_rates(key)[:sell]).to be > 0.0
10
10
  expect(UruguayanExchangeRates::exchange_rates(key).count).to eq(2)
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uruguayan_exchange_rates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Pablo Balarini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 2.4.4
112
+ rubygems_version: 2.2.2
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Uruguayan exchange rates.