nordea-rb 0.3.0 → 0.3.1
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/VERSION +1 -1
- data/lib/nordea/version.rb +1 -1
- data/lib/nordea.rb +1 -1
- data/nordea-rb.gemspec +2 -2
- data/test/test_nordea.rb +39 -26
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/nordea/version.rb
CHANGED
data/lib/nordea.rb
CHANGED
@@ -71,7 +71,7 @@ module Nordea
|
|
71
71
|
command << " #{options[:keychain_file].inspect}" if options[:keychain_file]
|
72
72
|
command << " 2>&1"
|
73
73
|
output = `#{command}`
|
74
|
-
pnr = output.match(/"acct"<blob>="(\d
|
74
|
+
pnr = output.match(/"acct"<blob>="([\d \-]+)"/)[1].gsub(/\D/, '')
|
75
75
|
pin = output.match(/password: "(\d{4})"/)[1]
|
76
76
|
[pnr, pin]
|
77
77
|
end
|
data/nordea-rb.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{nordea-rb}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Martin Str\303\266m"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-29}
|
13
13
|
s.default_executable = %q{nordea}
|
14
14
|
s.description = %q{Ruby library for accessing your Nordea Bank account and transferring money between your own accounts.}
|
15
15
|
s.email = %q{name@my-domain.se}
|
data/test/test_nordea.rb
CHANGED
@@ -50,34 +50,47 @@ class TestNordea < Test::Unit::TestCase
|
|
50
50
|
assert_raise(ArgumentError) { Nordea.new(:foo) }
|
51
51
|
end
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
keychain: "/Users/me/Library/Keychains/login.keychain"
|
57
|
-
class: "genp"
|
58
|
-
attributes:
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
password: "1337"
|
76
|
-
|
53
|
+
context "getting the account details from the OS X Keychain" do
|
54
|
+
setup do
|
55
|
+
@return_value = <<-EOF
|
56
|
+
keychain: "/Users/me/Library/Keychains/login.keychain"
|
57
|
+
class: "genp"
|
58
|
+
attributes:
|
59
|
+
0x00000001 <blob>="Nordea"
|
60
|
+
0x00000002 <blob>=<NULL>
|
61
|
+
"acct"<blob>="1234567890"
|
62
|
+
"cdat"<timedate>=0x11111111111111111111111111111111 "111111111111111\000"
|
63
|
+
"crtr"<uint32>=<NULL>
|
64
|
+
"cusi"<sint32>=<NULL>
|
65
|
+
"desc"<blob>=<NULL>
|
66
|
+
"gena"<blob>=<NULL>
|
67
|
+
"icmt"<blob>=<NULL>
|
68
|
+
"invi"<sint32>=<NULL>
|
69
|
+
"mdat"<timedate>=0x22222222222222222222222222222222 "222222222222222\000"
|
70
|
+
"nega"<sint32>=<NULL>
|
71
|
+
"prot"<blob>=<NULL>
|
72
|
+
"scrp"<sint32>=<NULL>
|
73
|
+
"svce"<blob>="Nordea"
|
74
|
+
"type"<uint32>=<NULL>
|
75
|
+
password: "1337"
|
76
|
+
EOF
|
77
|
+
Nordea.stubs(:`).with(anything).returns(@return_value)
|
78
|
+
end
|
77
79
|
|
78
|
-
|
80
|
+
should "call the security commando on OS X to retreive the password" do
|
81
|
+
Nordea.expects(:`).with(anything).returns(@return_value)
|
82
|
+
Nordea.new(:keychain)
|
83
|
+
end
|
79
84
|
|
80
|
-
|
85
|
+
should "find pnr with dashes" do
|
86
|
+
@return_value.gsub!('"acct"<blob>="1234567890"', '"acct"<blob>="123456-7890"')
|
87
|
+
assert_equal "1234567890", Nordea.new(:keychain).pnr
|
88
|
+
end
|
89
|
+
|
90
|
+
should "find pnr with spaces" do
|
91
|
+
@return_value.gsub!('"acct"<blob>="1234567890"', '"acct"<blob>=" 123456 7890"')
|
92
|
+
assert_equal "1234567890", Nordea.new(:keychain).pnr
|
93
|
+
end
|
81
94
|
end
|
82
95
|
end
|
83
96
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nordea-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Martin Str\xC3\xB6m"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-29 00:00:00 +01:00
|
13
13
|
default_executable: nordea
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|