ofx_reader 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fb5c91a8308601dd54e47ad85d692f312e85aa09
4
- data.tar.gz: a5df28de0b2884d6b36890e9799cf86e0668ab8c
2
+ SHA256:
3
+ metadata.gz: 5b7c0af542e0bc3eac039e0be6951296fc4bec35a5788a1b57fef2a46a44464f
4
+ data.tar.gz: e6134bfd4110f53e6346df260ee2a132068c43ae4175030f79af2626932d3ebf
5
5
  SHA512:
6
- metadata.gz: 438d5f462835849481429ce9e74406e5809b6cddc0cb9796fada9f133e4b95d57cadc0511dc2b42558e6fd82d6b33ce4816afef417e491ab74e0af6b5ad5e178
7
- data.tar.gz: 04e9ea4d069e328eb6e5f424ebb519ed9f3f25ca64508e507a469aaae8c5b3d20ece688141112c636951638cd53e638076c5c8d6019587d17237def04a0ff3b0
6
+ metadata.gz: f53b13b9959a2753f60e27fdb398e46bf8cfaa683fbec3b77f0a86c697732f9bccbd14e682d0aeb47b2c2331d6058163e76e65250e4022b0172dc4adc6d680da
7
+ data.tar.gz: 209ab94d1feba0269ac670f557a69b8f8c6d3cd5466ff424606c50c2b33b9689e390936f7b56b1ed16b87b2f107cf0b79df7faa3b71dd87b68cf8c0a1c0b6924
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ofx_reader (0.1.0)
4
+ ofx_reader (0.1.1)
5
5
  nokogiri (~> 1.8)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # OfxReader
1
+ # OFXReader
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ofx_reader`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Simple OFX Reader
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,48 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ ```ruby
24
+ ofx = OFXReader::Parser::OFX102.new(ofx_text)
25
+ ```
26
+
27
+ #### Headers
28
+
29
+ ```ruby
30
+ ofx.headers
31
+ => {
32
+ 'OFXHEADER' => '100'
33
+ 'DATA' => 'OFXSGML'
34
+ 'VERSION' => '102'
35
+ 'SECURITY' => 'TYPE1'
36
+ 'ENCODING' => 'USASCII'
37
+ 'CHARSET' => '1252'
38
+ 'COMPRESSION' => 'NONE'
39
+ 'OLDFILEUID' => 'NONE'
40
+ 'NEWFILEUID' => 'NONE'
41
+ }
42
+ ```
43
+
44
+ #### Account
45
+
46
+ ```ruby
47
+ ofx.account
48
+ => { bank_id: '1', account_id: '1' }
49
+ ```
50
+
51
+ #### Transactions
52
+
53
+ Will return a hash with all fields on .OFX file, using original names, as symbols:
54
+
55
+ ```ruby
56
+ ofx.transactions
57
+ => [{
58
+ trntype: "DEBIT",
59
+ dtposted: '20171214000000[-3:EST]'),
60
+ trnamt: -99.99,
61
+ fitid: "00000000000000000000000000",
62
+ name: "TRANSACTION DESCRIPTION"
63
+ }, ... ]
64
+ ```
26
65
 
27
66
  ## Development
28
67
 
data/exe/ofx_reader ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ofx_reader"
5
+
6
+ # OFXReader::
7
+ puts 'asas1'
8
+ puts ARGV[0]
@@ -33,13 +33,9 @@ module OFXReader
33
33
  private
34
34
 
35
35
  def build_transaction(node)
36
- {
37
- type: node.search('TRNTYPE').text,
38
- time: Time.parse(node.search('DTPOSTED').text),
39
- amount: node.search('TRNAMT').text.to_f,
40
- fit_id: node.search('FITID').text,
41
- name: node.search('NAME').text
42
- }
36
+ node.children.map.with_object({}) do |field, hash|
37
+ hash[field.name.downcase.to_sym] = field.text
38
+ end
43
39
  end
44
40
  end
45
41
  end
@@ -1,3 +1,3 @@
1
1
  module OFXReader
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ofx_reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Martins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-04 00:00:00.000000000 Z
11
+ date: 2017-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -83,7 +83,8 @@ dependencies:
83
83
  description:
84
84
  email:
85
85
  - franciscomxs@gmail.com
86
- executables: []
86
+ executables:
87
+ - ofx_reader
87
88
  extensions: []
88
89
  extra_rdoc_files: []
89
90
  files:
@@ -96,6 +97,7 @@ files:
96
97
  - Rakefile
97
98
  - bin/console
98
99
  - bin/setup
100
+ - exe/ofx_reader
99
101
  - lib/ofx_reader.rb
100
102
  - lib/ofx_reader/parser/base.rb
101
103
  - lib/ofx_reader/parser/ofx_102.rb
@@ -120,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
122
  version: '0'
121
123
  requirements: []
122
124
  rubyforge_project:
123
- rubygems_version: 2.6.13
125
+ rubygems_version: 2.7.3
124
126
  signing_key:
125
127
  specification_version: 4
126
128
  summary: A simple ofx reader