ofx 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color --format documentation
data/Gemfile CHANGED
@@ -1,4 +1,2 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in /tmp/sample.gemspec
1
+ source "http://gems.simplesideias.com.br"
4
2
  gemspec
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ofx (0.2.9)
4
+ ofx (0.3.1)
5
5
  nokogiri
6
6
 
7
7
  GEM
8
- remote: http://rubygems.org/
8
+ remote: http://gems.simplesideias.com.br/
9
9
  specs:
10
10
  archive-tar-minitar (0.5.2)
11
11
  columnize (0.3.2)
@@ -13,14 +13,14 @@ GEM
13
13
  linecache19 (0.5.11)
14
14
  ruby_core_source (>= 0.1.4)
15
15
  nokogiri (1.4.4)
16
- rspec (2.4.0)
17
- rspec-core (~> 2.4.0)
18
- rspec-expectations (~> 2.4.0)
19
- rspec-mocks (~> 2.4.0)
20
- rspec-core (2.4.0)
21
- rspec-expectations (2.4.0)
16
+ rspec (2.6.0)
17
+ rspec-core (~> 2.6.0)
18
+ rspec-expectations (~> 2.6.0)
19
+ rspec-mocks (~> 2.6.0)
20
+ rspec-core (2.6.0)
21
+ rspec-expectations (2.6.0)
22
22
  diff-lcs (~> 1.1.2)
23
- rspec-mocks (2.4.0)
23
+ rspec-mocks (2.6.0)
24
24
  ruby-debug-base19 (0.11.24)
25
25
  columnize (>= 0.3.1)
26
26
  linecache19 (>= 0.5.11)
@@ -37,5 +37,5 @@ PLATFORMS
37
37
 
38
38
  DEPENDENCIES
39
39
  ofx!
40
- rspec (~> 2.0)
40
+ rspec (~> 2.6)
41
41
  ruby-debug19
@@ -6,16 +6,11 @@ module OFX
6
6
  ACCOUNT_TYPES = {
7
7
  "CHECKING" => :checking
8
8
  }
9
-
10
- TRANSACTION_TYPES = {
11
- "CREDIT" => :credit,
12
- "DEBIT" => :debit,
13
- "OTHER" => :other,
14
- "DEP" => :dep,
15
- "XFER" => :xfer,
16
- "CASH" => :cash,
17
- "CHECK" => :check
18
- }
9
+
10
+ TRANSACTION_TYPES = [
11
+ 'ATM', 'CASH', 'CHECK', 'CREDIT', 'DEBIT', 'DEP', 'DIRECTDEBIT', 'DIRECTDEP', 'DIV',
12
+ 'FEE', 'INT', 'OTHER', 'PAYMENT', 'POS', 'REPEATPMT', 'SRVCHG', 'XFER'
13
+ ].inject({}) { |hash, tran_type| hash[tran_type] = tran_type.downcase.to_sym; hash }
19
14
 
20
15
  attr_reader :headers
21
16
  attr_reader :body
@@ -54,7 +49,7 @@ module OFX
54
49
  OFX::Account.new({
55
50
  :bank_id => html.search("bankacctfrom > bankid").inner_text,
56
51
  :id => html.search("bankacctfrom > acctid").inner_text,
57
- :type => ACCOUNT_TYPES[html.search("bankacctfrom > accttype").inner_text],
52
+ :type => ACCOUNT_TYPES[html.search("bankacctfrom > accttype").inner_text.to_s.upcase],
58
53
  :transactions => build_transactions,
59
54
  :balance => build_balance,
60
55
  :currency => html.search("bankmsgsrsv1 > stmttrnrs > stmtrs > curdef").inner_text
@@ -83,7 +78,7 @@ module OFX
83
78
  end
84
79
 
85
80
  def build_type(element)
86
- TRANSACTION_TYPES[element.search("trntype").inner_text]
81
+ TRANSACTION_TYPES[element.search("trntype").inner_text.to_s.upcase]
87
82
  end
88
83
 
89
84
  def build_amount(element)
@@ -2,7 +2,7 @@ module OFX
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -27,6 +27,6 @@ TXT
27
27
  s.require_paths = ["lib"]
28
28
 
29
29
  s.add_dependency "nokogiri"
30
- s.add_development_dependency "rspec", "~> 2.0"
30
+ s.add_development_dependency "rspec", "~> 2.6"
31
31
  s.add_development_dependency "ruby-debug19"
32
32
  end
@@ -26,4 +26,17 @@ describe OFX::Parser::OFX102 do
26
26
  it "should set account" do
27
27
  @parser.account.should be_a_kind_of(OFX::Account)
28
28
  end
29
+
30
+ it "should know about all transaction types" do
31
+ valid_types = [
32
+ 'CREDIT', 'DEBIT', 'INT', 'DIV', 'FEE', 'SRVCHG', 'DEP', 'ATM', 'POS', 'XFER',
33
+ 'CHECK', 'PAYMENT', 'CASH', 'DIRECTDEP', 'DIRECTDEBIT', 'REPEATPMT', 'OTHER'
34
+ ]
35
+ valid_types.sort.should == OFX::Parser::OFX102::TRANSACTION_TYPES.keys.sort
36
+
37
+ valid_types.each do |transaction_type|
38
+ transaction_type.downcase.to_sym.should equal OFX::Parser::OFX102::TRANSACTION_TYPES[transaction_type]
39
+ end
40
+ end
41
+
29
42
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ofx
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 3
8
- - 0
9
- version: 0.3.0
4
+ prerelease:
5
+ version: 0.3.1
10
6
  platform: ruby
11
7
  authors:
12
8
  - Nando Vieira
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-25 00:00:00 -02:00
18
- default_executable:
13
+ date: 2011-05-16 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: nokogiri
@@ -25,8 +20,6 @@ dependencies:
25
20
  requirements:
26
21
  - - ">="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
23
  version: "0"
31
24
  type: :runtime
32
25
  version_requirements: *id001
@@ -38,10 +31,7 @@ dependencies:
38
31
  requirements:
39
32
  - - ~>
40
33
  - !ruby/object:Gem::Version
41
- segments:
42
- - 2
43
- - 0
44
- version: "2.0"
34
+ version: "2.6"
45
35
  type: :development
46
36
  version_requirements: *id002
47
37
  - !ruby/object:Gem::Dependency
@@ -52,8 +42,6 @@ dependencies:
52
42
  requirements:
53
43
  - - ">="
54
44
  - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
45
  version: "0"
58
46
  type: :development
59
47
  version_requirements: *id003
@@ -77,6 +65,7 @@ extra_rdoc_files: []
77
65
 
78
66
  files:
79
67
  - .gitignore
68
+ - .rspec
80
69
  - Gemfile
81
70
  - Gemfile.lock
82
71
  - README.rdoc
@@ -105,7 +94,6 @@ files:
105
94
  - spec/ofx/ofx_spec.rb
106
95
  - spec/ofx/transaction_spec.rb
107
96
  - spec/spec_helper.rb
108
- has_rdoc: true
109
97
  homepage: http://rubygems.org/gems/ofx
110
98
  licenses: []
111
99
 
@@ -119,21 +107,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
107
  requirements:
120
108
  - - ">="
121
109
  - !ruby/object:Gem::Version
122
- segments:
123
- - 0
124
110
  version: "0"
125
111
  required_rubygems_version: !ruby/object:Gem::Requirement
126
112
  none: false
127
113
  requirements:
128
114
  - - ">="
129
115
  - !ruby/object:Gem::Version
130
- segments:
131
- - 0
132
116
  version: "0"
133
117
  requirements: []
134
118
 
135
119
  rubyforge_project:
136
- rubygems_version: 1.3.7
120
+ rubygems_version: 1.8.1
137
121
  signing_key:
138
122
  specification_version: 3
139
123
  summary: A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 102, 200 and 211.