nordea-rb 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -2,7 +2,7 @@ module Nordea
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join(".")
8
8
  end
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{10})"/)[1]
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.0"
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-10}
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
- should "raise call the secutiry commando on OS X to retreive the password" do
54
- #Nordea.expects(:`).returns(<<-EOF)
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
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
- Nordea.expects(:`).with(anything).returns(return_value)
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
- Nordea.new(:keychain)
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.0
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-10 00:00:00 +01:00
12
+ date: 2009-11-29 00:00:00 +01:00
13
13
  default_executable: nordea
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency