nordea 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -5
- data/CHANGELOG +4 -0
- data/LICENSE +1 -1
- data/README.md +4 -12
- data/lib/nordea/bank.rb +1 -1
- data/lib/nordea/version.rb +2 -2
- data/nordea.gemspec +6 -7
- data/spec/bank/bank_spec.rb +13 -10
- data/spec/exchange_rates/exchange_rates_spec.rb +22 -20
- metadata +70 -36
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
The Nordea Gem
|
2
2
|
==============
|
3
3
|
|
4
|
-
|
5
|
-
< Exchange rates from Nordea Bank >
|
6
|
-
---------------------------------
|
7
|
-
\ ^__^
|
8
|
-
\ (€€)\_______
|
9
|
-
(__)\ )\/\
|
10
|
-
||----w |
|
11
|
-
|| ||
|
12
|
-
|
4
|
+
Exchange rates from Nordea Bank.
|
13
5
|
|
14
6
|
Installation
|
15
7
|
------------
|
@@ -60,9 +52,9 @@ For more information, read the [documentation](http://rubydoc.info/gems/nordea).
|
|
60
52
|
Travis CI Build Status
|
61
53
|
----------------------
|
62
54
|
|
63
|
-
The gem should work with Ruby 1.
|
55
|
+
The gem should work with Ruby 1.9.3, Ruby 2.0.0, jRuby, and Rubinius (only Ruby 1.9 is actively targetted).
|
64
56
|
|
65
|
-
[![Build Status](
|
57
|
+
[![Build Status](https://travis-ci.org/matiaskorhonen/nordea.png?branch=master)](https://travis-ci.org/matiaskorhonen/nordea) [![Code Climate](https://codeclimate.com/github/k33l0r/nordea.png)](https://codeclimate.com/github/k33l0r/nordea)
|
66
58
|
|
67
59
|
|
68
60
|
About the data and data source
|
@@ -89,6 +81,6 @@ this gem entirely at **your own risk**.
|
|
89
81
|
License
|
90
82
|
-------
|
91
83
|
|
92
|
-
MIT License. Copyright 2011 Matias Korhonen.
|
84
|
+
MIT License. Copyright 2011-2013 Matias Korhonen.
|
93
85
|
|
94
86
|
See the LICENSE file for more details.
|
data/lib/nordea/bank.rb
CHANGED
@@ -82,7 +82,7 @@ module Nordea
|
|
82
82
|
#
|
83
83
|
# @return [Array<String>] ISO currency codes
|
84
84
|
def money_currencies
|
85
|
-
Money::Currency
|
85
|
+
Money::Currency.table.keys.map { |c| c.to_s.upcase }
|
86
86
|
end
|
87
87
|
|
88
88
|
# List currencies found in the Money gem *and* the Nordea currency data
|
data/lib/nordea/version.rb
CHANGED
data/nordea.gemspec
CHANGED
@@ -6,20 +6,19 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "nordea"
|
7
7
|
s.version = Nordea::VERSION
|
8
8
|
s.authors = ["Matias Korhonen"]
|
9
|
-
s.email = ["
|
10
|
-
s.homepage = "http://github.com/
|
9
|
+
s.email = ["me@matiaskorhonen.fi"]
|
10
|
+
s.homepage = "http://github.com/matiaskorhonen/nordea"
|
11
11
|
s.summary = %q{Exchange rates from Nordea Bank}
|
12
12
|
s.description = %q{A Money.gem compatible currency exchange rate implementation for Nordea Bank}
|
13
13
|
|
14
14
|
s.rubyforge_project = "nordea"
|
15
15
|
|
16
|
-
s.add_dependency "money", "~>
|
17
|
-
s.add_dependency "tzinfo", "~> 0.
|
16
|
+
s.add_dependency "money", "~> 5.1.1"
|
17
|
+
s.add_dependency "tzinfo", "~> 1.0.0"
|
18
18
|
|
19
19
|
s.add_development_dependency "awesome_print"
|
20
|
-
s.add_development_dependency "
|
21
|
-
s.add_development_dependency "
|
22
|
-
s.add_development_dependency "rspec", "~> 2.6.0"
|
20
|
+
s.add_development_dependency "rake"
|
21
|
+
s.add_development_dependency "rspec", "~> 2.14.1"
|
23
22
|
s.add_development_dependency "simplecov"
|
24
23
|
s.add_development_dependency "webmock"
|
25
24
|
s.add_development_dependency "yard"
|
data/spec/bank/bank_spec.rb
CHANGED
@@ -1,32 +1,35 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "Nordea::Bank" do
|
4
|
+
let(:bank) do
|
5
|
+
Nordea::Bank.new
|
6
|
+
end
|
7
|
+
|
4
8
|
before(:each) do
|
5
9
|
stub_request(:get, "http://service.nordea.com/nordea-openpages/fi/lists/currency/elelctronicExchangeFI.dat").
|
6
10
|
to_return(:status => 200, :body => SampleData.raw)
|
7
|
-
|
8
|
-
Money.default_bank = @bank
|
11
|
+
Money.default_bank = bank
|
9
12
|
end
|
10
13
|
|
11
|
-
|
14
|
+
describe "#exchange" do
|
12
15
|
it "returns the correct exchange rates" do
|
13
|
-
|
14
|
-
|
16
|
+
bank.known_currencies.each do |currency|
|
17
|
+
bank.exchange(100, "EUR", currency).cents.should == (SampleData.get_rate(currency) * 100).round
|
15
18
|
end
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
19
|
-
|
22
|
+
describe "#exchange_with" do
|
20
23
|
it "returns the correct exchange rates" do
|
21
|
-
|
22
|
-
|
24
|
+
bank.known_currencies.each do |currency|
|
25
|
+
bank.exchange_with(Money.new(100, "EUR"), currency).cents.should == (SampleData.get_rate(currency) * 100).round
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
27
|
-
|
30
|
+
describe "#exchange_rates" do
|
28
31
|
it "is an instance of Nordea::ExchangeRates" do
|
29
|
-
|
32
|
+
bank.exchange_rates.should be_an_instance_of(Nordea::ExchangeRates)
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
@@ -1,40 +1,43 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe "Nordea::ExchangeRates" do
|
4
|
+
let(:exchange_rates) do
|
5
|
+
Nordea::ExchangeRates.new
|
6
|
+
end
|
7
|
+
|
4
8
|
before(:each) do
|
5
9
|
stub_request(:get, "http://service.nordea.com/nordea-openpages/fi/lists/currency/elelctronicExchangeFI.dat").
|
6
10
|
to_return(:status => 200, :body => SampleData.raw)
|
7
|
-
@exchange_rates = Nordea::ExchangeRates.new
|
8
11
|
end
|
9
12
|
|
10
|
-
|
13
|
+
describe "#lines" do
|
11
14
|
it "returns the raw data as an array of lines" do
|
12
|
-
|
15
|
+
exchange_rates.send(:lines).should be_kind_of(Array)
|
13
16
|
end
|
14
17
|
|
15
18
|
it "returns the correct number of lines" do
|
16
|
-
|
19
|
+
exchange_rates.send(:lines).count.should == 221
|
17
20
|
end
|
18
21
|
end
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
describe "#records_array" do
|
24
|
+
let(:records) do
|
25
|
+
exchange_rates.send(:records_array)
|
23
26
|
end
|
24
27
|
|
25
28
|
it "returns an array of hashes" do
|
26
|
-
|
27
|
-
|
29
|
+
records.should be_kind_of(Array)
|
30
|
+
records.each do |record|
|
28
31
|
record.should be_kind_of(Hash)
|
29
32
|
end
|
30
33
|
end
|
31
34
|
|
32
35
|
it "has the correct number of records" do
|
33
|
-
|
36
|
+
records.length.should == SampleData.currencies.length
|
34
37
|
end
|
35
38
|
|
36
39
|
it "has the correct data" do
|
37
|
-
|
40
|
+
records.each do |record|
|
38
41
|
currency = record[:currency_iso_code]
|
39
42
|
sample = SampleData.currencies[currency]
|
40
43
|
|
@@ -45,32 +48,31 @@ describe "Nordea::ExchangeRates" do
|
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
+
describe "#headers" do
|
52
|
+
let(:headers) do
|
53
|
+
exchange_rates.headers
|
51
54
|
end
|
52
55
|
|
53
56
|
it "returns a hash" do
|
54
|
-
|
57
|
+
headers.should be_kind_of(Hash)
|
55
58
|
end
|
56
59
|
|
57
60
|
it "has the correct data" do
|
58
|
-
|
59
|
-
@headers.each_pair do |key,value|
|
61
|
+
headers.each_pair do |key,value|
|
60
62
|
value.should == SampleData.headers[key]
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
|
-
|
67
|
+
describe "#fetch_data" do
|
66
68
|
it "returns the raw data from the server if the request is successful" do
|
67
|
-
|
69
|
+
exchange_rates.send(:fetch_data).should == SampleData.raw.read
|
68
70
|
end
|
69
71
|
|
70
72
|
it "raises an exception if the request is not successful" do
|
71
73
|
stub_request(:get, "http://service.nordea.com/nordea-openpages/fi/lists/currency/elelctronicExchangeFI.dat").
|
72
74
|
to_return(:status => 404, :body => SampleData.raw)
|
73
|
-
expect {
|
75
|
+
expect { exchange_rates.send(:fetch_data) }.to raise_error Nordea::ServerError
|
74
76
|
end
|
75
77
|
end
|
76
78
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nordea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,34 +9,43 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2013-09-10 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: money
|
17
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
21
|
+
version: 5.1.1
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 5.1.1
|
26
30
|
- !ruby/object:Gem::Dependency
|
27
31
|
name: tzinfo
|
28
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
29
33
|
none: false
|
30
34
|
requirements:
|
31
35
|
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
37
|
+
version: 1.0.0
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.0
|
37
46
|
- !ruby/object:Gem::Dependency
|
38
47
|
name: awesome_print
|
39
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
40
49
|
none: false
|
41
50
|
requirements:
|
42
51
|
- - ! '>='
|
@@ -44,43 +53,47 @@ dependencies:
|
|
44
53
|
version: '0'
|
45
54
|
type: :development
|
46
55
|
prerelease: false
|
47
|
-
version_requirements:
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: bundler
|
50
|
-
requirement: &2152834600 !ruby/object:Gem::Requirement
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
none: false
|
52
58
|
requirements:
|
53
|
-
- -
|
59
|
+
- - ! '>='
|
54
60
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
56
|
-
type: :development
|
57
|
-
prerelease: false
|
58
|
-
version_requirements: *2152834600
|
61
|
+
version: '0'
|
59
62
|
- !ruby/object:Gem::Dependency
|
60
63
|
name: rake
|
61
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
62
65
|
none: false
|
63
66
|
requirements:
|
64
|
-
- -
|
67
|
+
- - ! '>='
|
65
68
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0
|
69
|
+
version: '0'
|
67
70
|
type: :development
|
68
71
|
prerelease: false
|
69
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
70
78
|
- !ruby/object:Gem::Dependency
|
71
79
|
name: rspec
|
72
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
73
81
|
none: false
|
74
82
|
requirements:
|
75
83
|
- - ~>
|
76
84
|
- !ruby/object:Gem::Version
|
77
|
-
version: 2.
|
85
|
+
version: 2.14.1
|
78
86
|
type: :development
|
79
87
|
prerelease: false
|
80
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.14.1
|
81
94
|
- !ruby/object:Gem::Dependency
|
82
95
|
name: simplecov
|
83
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
84
97
|
none: false
|
85
98
|
requirements:
|
86
99
|
- - ! '>='
|
@@ -88,10 +101,15 @@ dependencies:
|
|
88
101
|
version: '0'
|
89
102
|
type: :development
|
90
103
|
prerelease: false
|
91
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
92
110
|
- !ruby/object:Gem::Dependency
|
93
111
|
name: webmock
|
94
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
95
113
|
none: false
|
96
114
|
requirements:
|
97
115
|
- - ! '>='
|
@@ -99,10 +117,15 @@ dependencies:
|
|
99
117
|
version: '0'
|
100
118
|
type: :development
|
101
119
|
prerelease: false
|
102
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
103
126
|
- !ruby/object:Gem::Dependency
|
104
127
|
name: yard
|
105
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
106
129
|
none: false
|
107
130
|
requirements:
|
108
131
|
- - ! '>='
|
@@ -110,11 +133,16 @@ dependencies:
|
|
110
133
|
version: '0'
|
111
134
|
type: :development
|
112
135
|
prerelease: false
|
113
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
114
142
|
description: A Money.gem compatible currency exchange rate implementation for Nordea
|
115
143
|
Bank
|
116
144
|
email:
|
117
|
-
-
|
145
|
+
- me@matiaskorhonen.fi
|
118
146
|
executables: []
|
119
147
|
extensions: []
|
120
148
|
extra_rdoc_files: []
|
@@ -138,8 +166,7 @@ files:
|
|
138
166
|
- spec/support/sample_data.rb
|
139
167
|
- spec/support/sample_electronic.dat
|
140
168
|
- spec/support/sample_headers.marshal
|
141
|
-
|
142
|
-
homepage: http://github.com/k33l0r/nordea
|
169
|
+
homepage: http://github.com/matiaskorhonen/nordea
|
143
170
|
licenses: []
|
144
171
|
post_install_message:
|
145
172
|
rdoc_options: []
|
@@ -151,15 +178,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
178
|
- - ! '>='
|
152
179
|
- !ruby/object:Gem::Version
|
153
180
|
version: '0'
|
181
|
+
segments:
|
182
|
+
- 0
|
183
|
+
hash: 4024254409881704070
|
154
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
185
|
none: false
|
156
186
|
requirements:
|
157
187
|
- - ! '>='
|
158
188
|
- !ruby/object:Gem::Version
|
159
189
|
version: '0'
|
190
|
+
segments:
|
191
|
+
- 0
|
192
|
+
hash: 4024254409881704070
|
160
193
|
requirements: []
|
161
194
|
rubyforge_project: nordea
|
162
|
-
rubygems_version: 1.
|
195
|
+
rubygems_version: 1.8.25
|
163
196
|
signing_key:
|
164
197
|
specification_version: 3
|
165
198
|
summary: Exchange rates from Nordea Bank
|
@@ -171,3 +204,4 @@ test_files:
|
|
171
204
|
- spec/support/sample_data.rb
|
172
205
|
- spec/support/sample_electronic.dat
|
173
206
|
- spec/support/sample_headers.marshal
|
207
|
+
has_rdoc:
|