yahoofx 0.1.1 → 0.1.2
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.
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +16 -0
- data/README.md +3 -0
- data/lib/yahoofx/converter.rb +1 -1
- data/test/unit/converter_test.rb +4 -0
- data/yahoofx.gemspec +1 -1
- metadata +5 -2
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
## Foreign exchange (forex) rate scraper
|
4
4
|
|
5
|
+
[](https://travis-ci.org/lau/yahoofx) [](https://codeclimate.com/github/lau/yahoofx)
|
7
|
+
|
5
8
|
Gets foreign currency exchange rates from Yahoo Finance.
|
6
9
|
|
7
10
|
### Installation
|
data/lib/yahoofx/converter.rb
CHANGED
@@ -22,7 +22,7 @@ module Yahoofx
|
|
22
22
|
|
23
23
|
# Example parameter: "100 EUR in USD"
|
24
24
|
def parse(input_string)
|
25
|
-
/([\d]+)[\p{Space}]*(.*)in(.*)/ =~ input_string
|
25
|
+
/([\d\.]+)[\p{Space}]*(.*)in(.*)/ =~ input_string
|
26
26
|
{ :from_amount => $1.to_f,
|
27
27
|
:from_currency => $2.strip,
|
28
28
|
:to_currency => $3.strip }
|
data/test/unit/converter_test.rb
CHANGED
@@ -25,5 +25,9 @@ describe Yahoofx::Converter do
|
|
25
25
|
it "should show currency rate when two valid currency codes are provided" do
|
26
26
|
assert_equal 7.4556, @converter.answer("EURDKK").to_f
|
27
27
|
end
|
28
|
+
|
29
|
+
it "should work with decimal in amount" do
|
30
|
+
assert_equal 11.92896, @converter.answer("1.6EUR in DKK").to_f
|
31
|
+
end
|
28
32
|
end
|
29
33
|
end
|
data/yahoofx.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'yahoofx'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.2'
|
4
4
|
s.executables << 'yahoofx'
|
5
5
|
s.summary = "Gets currency rates from Yahoo Finance"
|
6
6
|
s.description = "The gem scrapes Yahoo Finance and returns foreign exchange rates. Also comes with a shell command."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yahoofx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: webmock
|
@@ -36,6 +36,9 @@ extensions: []
|
|
36
36
|
extra_rdoc_files: []
|
37
37
|
files:
|
38
38
|
- .gitignore
|
39
|
+
- .travis.yml
|
40
|
+
- Gemfile
|
41
|
+
- Gemfile.lock
|
39
42
|
- README.md
|
40
43
|
- Rakefile
|
41
44
|
- bin/yahoofx
|