ofx 0.2.9 → 0.3.4

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.
@@ -13,7 +13,7 @@ describe OFX::Transaction do
13
13
  end
14
14
 
15
15
  it "should set amount" do
16
- @transaction.amount.should == -35.34
16
+ @transaction.amount.should == BigDecimal('-35.34')
17
17
  end
18
18
 
19
19
  it "should cast amount to BigDecimal" do
@@ -37,12 +37,20 @@ describe OFX::Transaction do
37
37
  end
38
38
 
39
39
  it "should have date" do
40
- @transaction.posted_at.should == Time.parse("2009-10-09 08:00:00")
40
+ @transaction.posted_at.should == Time.parse("2009-10-09 08:00:00 +0000")
41
+ end
42
+
43
+ it 'should have user date' do
44
+ @transaction.occurred_at.should == Time.parse("2009-09-09 08:00:00 +0000")
41
45
  end
42
46
 
43
47
  it "should have type" do
44
48
  @transaction.type.should == :debit
45
49
  end
50
+
51
+ it "should have sic" do
52
+ @transaction.sic.should == '5072'
53
+ end
46
54
  end
47
55
 
48
56
  context "credit" do
@@ -51,7 +59,7 @@ describe OFX::Transaction do
51
59
  end
52
60
 
53
61
  it "should set amount" do
54
- @transaction.amount.should == 60.39
62
+ @transaction.amount.should == BigDecimal('60.39')
55
63
  end
56
64
 
57
65
  it "should set amount in pennies" do
@@ -71,12 +79,20 @@ describe OFX::Transaction do
71
79
  end
72
80
 
73
81
  it "should have date" do
74
- @transaction.posted_at.should == Time.parse("2009-10-16 08:00:00")
82
+ @transaction.posted_at.should == Time.parse("2009-10-16 08:00:00 +0000")
83
+ end
84
+
85
+ it "should have user date" do
86
+ @transaction.occurred_at.should == Time.parse("2009-09-16 08:00:00 +0000")
75
87
  end
76
88
 
77
89
  it "should have type" do
78
90
  @transaction.type.should == :credit
79
91
  end
92
+
93
+ it "should have empty sic" do
94
+ @transaction.sic.should == ''
95
+ end
80
96
  end
81
97
 
82
98
  context "with more info" do
@@ -93,7 +109,11 @@ describe OFX::Transaction do
93
109
  end
94
110
 
95
111
  it "should have date" do
96
- @transaction.posted_at.should == Time.parse("2009-10-19 12:00:00")
112
+ @transaction.posted_at.should == Time.parse("2009-10-19 12:00:00 -0300")
113
+ end
114
+
115
+ it "should have user date" do
116
+ @transaction.occurred_at.should == Time.parse("2009-10-17 12:00:00 -0300")
97
117
  end
98
118
 
99
119
  it "should have type" do
@@ -105,8 +125,17 @@ describe OFX::Transaction do
105
125
  end
106
126
  end
107
127
 
108
- context "with other types" do
128
+ context "with name" do
129
+ before do
130
+ @transaction = @account.transactions[3]
131
+ end
132
+
133
+ it "should set name" do
134
+ @transaction.name.should == "Pagto conta telefone"
135
+ end
136
+ end
109
137
 
138
+ context "with other types" do
110
139
  before do
111
140
  @ofx = OFX::Parser::Base.new("spec/fixtures/bb.ofx")
112
141
  @parser = @ofx.parser
@@ -132,7 +161,41 @@ describe OFX::Transaction do
132
161
  @transaction = @account.transactions[0]
133
162
  @transaction.type.should == :check
134
163
  end
135
-
136
164
  end
137
165
 
166
+ context "decimal values using a comma" do
167
+ before do
168
+ @ofx = OFX::Parser::Base.new("spec/fixtures/santander.ofx")
169
+ @parser = @ofx.parser
170
+ @account = @parser.account
171
+ end
172
+
173
+ context "debit" do
174
+ before do
175
+ @transaction = @account.transactions[0]
176
+ end
177
+
178
+ it "should set amount" do
179
+ @transaction.amount.should == BigDecimal('-11.76')
180
+ end
181
+
182
+ it "should set amount in pennies" do
183
+ @transaction.amount_in_pennies.should == -1176
184
+ end
185
+ end
186
+
187
+ context "credit" do
188
+ before do
189
+ @transaction = @account.transactions[3]
190
+ end
191
+
192
+ it "should set amount" do
193
+ @transaction.amount.should == BigDecimal('47.01')
194
+ end
195
+
196
+ it "should set amount in pennies" do
197
+ @transaction.amount_in_pennies.should == 4701
198
+ end
199
+ end
200
+ end
138
201
  end
metadata CHANGED
@@ -1,72 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ofx
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 9
9
- version: 0.2.9
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.4
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Nando Vieira
13
- autorequire:
8
+ - Anna Cruz
9
+ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2010-11-10 00:00:00 -02:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2022-02-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: nokogiri
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 1.13.1
31
21
  type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: rspec
35
22
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 2
43
- - 0
44
- - 0
45
- version: 2.0.0
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 1.13.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: byebug
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 11.1.3
46
35
  type: :development
47
- version_requirements: *id002
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 11.1.3
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 13.0.6
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 13.0.6
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.10'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.10'
48
70
  description: |
49
71
  A simple OFX (Open Financial Exchange) parser built on top of Nokogiri.
50
- Currently supports OFX 1.0.2.
51
-
72
+ Currently supports OFX 102, 200 and 211.
73
+
52
74
  Usage:
53
-
54
- OFX("sample.ofx") do |ofx|
75
+
76
+ OFX('sample.ofx') do |ofx|
55
77
  p ofx
56
78
  end
57
-
58
- email:
79
+ email:
59
80
  - fnando.vieira@gmail.com
81
+ - anna.cruz@gmail.com
60
82
  executables: []
61
-
62
83
  extensions: []
63
-
64
84
  extra_rdoc_files: []
65
-
66
- files:
67
- - .gitignore
68
- - Gemfile
69
- - Gemfile.lock
85
+ files:
70
86
  - README.rdoc
71
87
  - Rakefile
72
88
  - lib/ofx.rb
@@ -76,61 +92,46 @@ files:
76
92
  - lib/ofx/foundation.rb
77
93
  - lib/ofx/parser.rb
78
94
  - lib/ofx/parser/ofx102.rb
95
+ - lib/ofx/parser/ofx103.rb
96
+ - lib/ofx/parser/ofx211.rb
97
+ - lib/ofx/sign_on.rb
98
+ - lib/ofx/statement.rb
99
+ - lib/ofx/status.rb
79
100
  - lib/ofx/transaction.rb
80
101
  - lib/ofx/version.rb
81
- - ofx.gemspec
82
- - spec/fixtures/avatar.gif
83
- - spec/fixtures/bb.ofx
84
- - spec/fixtures/invalid_version.ofx
85
- - spec/fixtures/sample.ofx
86
- - spec/fixtures/utf8.ofx
87
102
  - spec/ofx/account_spec.rb
88
103
  - spec/ofx/ofx102_spec.rb
104
+ - spec/ofx/ofx103_spec.rb
105
+ - spec/ofx/ofx211_spec.rb
89
106
  - spec/ofx/ofx_parser_spec.rb
90
107
  - spec/ofx/ofx_spec.rb
108
+ - spec/ofx/sign_on_spec.rb
109
+ - spec/ofx/statement_spec.rb
110
+ - spec/ofx/status_spec.rb
91
111
  - spec/ofx/transaction_spec.rb
92
112
  - spec/spec_helper.rb
93
- has_rdoc: true
94
113
  homepage: http://rubygems.org/gems/ofx
95
- licenses: []
96
-
97
- post_install_message:
114
+ licenses:
115
+ - MIT
116
+ metadata: {}
117
+ post_install_message:
98
118
  rdoc_options: []
99
-
100
- require_paths:
119
+ require_paths:
101
120
  - lib
102
- required_ruby_version: !ruby/object:Gem::Requirement
103
- none: false
104
- requirements:
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
105
123
  - - ">="
106
- - !ruby/object:Gem::Version
107
- segments:
108
- - 0
109
- version: "0"
110
- required_rubygems_version: !ruby/object:Gem::Requirement
111
- none: false
112
- requirements:
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
113
128
  - - ">="
114
- - !ruby/object:Gem::Version
115
- segments:
116
- - 0
117
- version: "0"
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
118
131
  requirements: []
119
-
120
- rubyforge_project:
121
- rubygems_version: 1.3.7
122
- signing_key:
123
- specification_version: 3
124
- summary: A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2.
125
- test_files:
126
- - spec/fixtures/avatar.gif
127
- - spec/fixtures/bb.ofx
128
- - spec/fixtures/invalid_version.ofx
129
- - spec/fixtures/sample.ofx
130
- - spec/fixtures/utf8.ofx
131
- - spec/ofx/account_spec.rb
132
- - spec/ofx/ofx102_spec.rb
133
- - spec/ofx/ofx_parser_spec.rb
134
- - spec/ofx/ofx_spec.rb
135
- - spec/ofx/transaction_spec.rb
136
- - spec/spec_helper.rb
132
+ rubygems_version: 3.3.3
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently
136
+ supports OFX 102, 200 and 211.
137
+ test_files: []
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- .DS_Store
2
- *.gem
3
- pkg
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in /tmp/sample.gemspec
4
- gemspec
data/Gemfile.lock DELETED
@@ -1,29 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- ofx (0.2.8)
5
- nokogiri
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- diff-lcs (1.1.2)
11
- nokogiri (1.4.3.1)
12
- rspec (2.0.0)
13
- rspec-core (= 2.0.0)
14
- rspec-expectations (= 2.0.0)
15
- rspec-mocks (= 2.0.0)
16
- rspec-core (2.0.0)
17
- rspec-expectations (2.0.0)
18
- diff-lcs (>= 1.1.2)
19
- rspec-mocks (2.0.0)
20
- rspec-core (= 2.0.0)
21
- rspec-expectations (= 2.0.0)
22
-
23
- PLATFORMS
24
- ruby
25
-
26
- DEPENDENCIES
27
- nokogiri
28
- ofx!
29
- rspec (>= 2.0.0)
data/ofx.gemspec DELETED
@@ -1,31 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "ofx/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "ofx"
7
- s.version = OFX::Version::STRING
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Nando Vieira"]
10
- s.email = ["fnando.vieira@gmail.com"]
11
- s.homepage = "http://rubygems.org/gems/ofx"
12
- s.summary = "A simple OFX (Open Financial Exchange) parser built on top of Nokogiri. Currently supports OFX 1.0.2."
13
- s.description = <<-TXT
14
- A simple OFX (Open Financial Exchange) parser built on top of Nokogiri.
15
- Currently supports OFX 1.0.2.
16
-
17
- Usage:
18
-
19
- OFX("sample.ofx") do |ofx|
20
- p ofx
21
- end
22
- TXT
23
-
24
- s.files = `git ls-files`.split("\n")
25
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
27
- s.require_paths = ["lib"]
28
-
29
- s.add_dependency "nokogiri"
30
- s.add_development_dependency "rspec", ">= 2.0.0"
31
- end
Binary file