fxpotato 0.1.4 → 0.2.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 +4 -4
- data/Dockerfile +2 -2
- data/Rakefile +7 -2
- data/fxpotato.gemspec +2 -0
- data/lib/fxpotato/rate_calculator.rb +7 -0
- data/lib/fxpotato/rate_store.rb +15 -0
- data/lib/fxpotato/version.rb +1 -1
- data/lib/fxpotato.rb +5 -0
- data/shippable.yml +8 -0
- metadata +18 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31a78bc0584864acd3b1f2c006bf9c9479a1db7f
|
4
|
+
data.tar.gz: 09772d1ab1bd769040464dedc738c2e3a70bb78c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab10371c5b6c5b84fc14244aa0bf533731887a4b4c2851800365ffa0e52e8b1d7b546b0ec6975d10e142d5d8decb35d4d8410a04846957b949e710136b819fdb
|
7
|
+
data.tar.gz: 3a6b5c3ca08d75358bdeab6742b32312c5d0f7d6c5eb5963a0d71b3e66b6f971493d71689e238803b6a51df1db86019eb7822f5d46e3160c0b19b471080441d6
|
data/Dockerfile
CHANGED
data/Rakefile
CHANGED
@@ -7,14 +7,19 @@ Rake::TestTask.new(:test) do |t|
|
|
7
7
|
t.test_files = FileList['test/**/*_test.rb']
|
8
8
|
end
|
9
9
|
|
10
|
+
desc "Bump version and release gem"
|
11
|
+
task :bump_release do
|
12
|
+
sh %{ gem bump && rake release }
|
13
|
+
end
|
14
|
+
|
10
15
|
desc "Build and test in a container"
|
11
16
|
task :docker_test do
|
12
|
-
sh %{ docker build --force-rm -t fx-potato . && docker run
|
17
|
+
sh %{ docker build --force-rm -t fx-potato . && docker run --rm fx-potato }
|
13
18
|
end
|
14
19
|
|
15
20
|
desc "Build, test, bump version, and release in a container"
|
16
21
|
task :docker_release do
|
17
|
-
sh %{ docker build --force-rm -t fx-potato . && docker run
|
22
|
+
sh %{ docker build --force-rm -t fx-potato . && docker run --rm fx-potato rake test && gem bump && rake release }
|
18
23
|
end
|
19
24
|
|
20
25
|
task :default => :test
|
data/fxpotato.gemspec
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module FxPotato
|
4
|
+
class RateStore
|
5
|
+
def initialize(xml_data)
|
6
|
+
@data = Nokogiri::XML(xml_data)
|
7
|
+
@data.remove_namespaces!
|
8
|
+
end
|
9
|
+
|
10
|
+
def get(date, currency)
|
11
|
+
query = "//Cube[@time=\'#{date.to_s}\']//Cube[@currency=\'#{currency}\']"
|
12
|
+
@data.at_xpath(query)["rate"].to_f
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/fxpotato/version.rb
CHANGED
data/lib/fxpotato.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'fxpotato/version'
|
2
|
+
require 'fxpotato/rate_calculator'
|
3
|
+
require 'fxpotato/rate_store'
|
2
4
|
|
3
5
|
module FxPotato
|
4
6
|
def self.at(date, from_currency, to_currency)
|
7
|
+
raise "Must specify date" if date.nil?
|
8
|
+
raise "Must specify from_currency" if from_currency.nil?
|
9
|
+
raise "Must specify to_currency" if to_currency.nil?
|
5
10
|
true
|
6
11
|
end
|
7
12
|
end
|
data/shippable.yml
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fxpotato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liam Stupid Name Humphreys
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.6'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.6'
|
69
83
|
description: Uses last daily feed from European Central Bank website, and exposes
|
70
84
|
a simple interface to get the conversion rates for one currency to another on a
|
71
85
|
given day.
|
@@ -87,7 +101,10 @@ files:
|
|
87
101
|
- bin/setup
|
88
102
|
- fxpotato.gemspec
|
89
103
|
- lib/fxpotato.rb
|
104
|
+
- lib/fxpotato/rate_calculator.rb
|
105
|
+
- lib/fxpotato/rate_store.rb
|
90
106
|
- lib/fxpotato/version.rb
|
107
|
+
- shippable.yml
|
91
108
|
homepage: https://github.com/Angry-Potato/fxpotato
|
92
109
|
licenses:
|
93
110
|
- MIT
|