cnab2ofx 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +30 -5
- data/cnab2ofx.gemspec +11 -2
- data/helpers/cnab240_helper.rb +0 -4
- data/lib/cnab2ofx.rb +16 -4
- data/lib/cnab2ofx/version.rb +6 -0
- metadata +12 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 86cd1b9cb677edb05df8ee80db79bec2185005fa
|
4
|
+
data.tar.gz: 2c75f19843f920937b7c8d448e9b3fd694f83200
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 78c20335572b8737b007f4cc76b28f9c24956b0c96bba8f522b0d635feb7c7db20b607a7d23f7349d1c782a8f3aab9b59e53bf66cb77ac129e7b53c3afca58ee
|
7
|
+
data.tar.gz: 1a1dc3c62e1403fc81bf18a7ca08411b15bb00232cee65e223b3a1c036db72af2bf2ee3f2aa753fd031668c4cb57c89ed77e09e37c5e76ad210fc32aec345d1a
|
data/README.md
CHANGED
@@ -2,12 +2,21 @@
|
|
2
2
|
cnab2ofx
|
3
3
|
========
|
4
4
|
|
5
|
-
**cnab2ofx** é script simples em [Ruby][1] que serve para converter extratos bancários no formato CNAB240 para o formato ofx.
|
5
|
+
**cnab2ofx** é um script simples em [Ruby][1] que serve para converter extratos bancários no formato CNAB240 para o formato ofx.
|
6
6
|
A Unicred emite extratos nesse formato.
|
7
7
|
|
8
8
|
[CNAB240][2] é o formato padrão da [FEBRABAN][3] (Federação Brasileira de Bancos) utilizado para gerar extratos dentre outras transações bancárias.
|
9
9
|
[OFX][4] é a sigla do "Open Financial Exchange" e é o que permite a importação de extratos bancários para softwares como o [GnuCash][5], [Microsoft Money][6] e [Quicken][7].
|
10
10
|
|
11
|
+
**Instalação (como gem):**
|
12
|
+
|
13
|
+
gem install cnab2ofx
|
14
|
+
|
15
|
+
ou
|
16
|
+
|
17
|
+
sudo gem install cnab2ofx
|
18
|
+
|
19
|
+
|
11
20
|
**Uso:**
|
12
21
|
|
13
22
|
cnab2ofx [extrato_cnab240] > [arquivo_ofx]
|
@@ -16,22 +25,38 @@ A Unicred emite extratos nesse formato.
|
|
16
25
|
|
17
26
|
cnab2ofx
|
18
27
|
========
|
19
|
-
[**English**]
|
28
|
+
[ **English** ]
|
20
29
|
|
21
30
|
**cnab2ofx** is a simple [Ruby][1] script that can be used to convert from CNAB240 to ofx.
|
22
31
|
|
23
32
|
[CNAB240][2] is a brazilian account statement format by [FEBRABAN][3] (Brazilian Bank Federation).
|
24
33
|
[OFX][4] stands for Open Financial Exchange and can be used to allow financial softwares as [GnuCash][5], [Microsoft Money][6] and [Quicken][7] to import bank statemnts.
|
25
34
|
|
35
|
+
**Install (as gem):**
|
36
|
+
|
37
|
+
gem install cnab2ofx
|
38
|
+
|
39
|
+
or
|
40
|
+
|
41
|
+
sudo gem install cnab2ofx
|
42
|
+
|
43
|
+
|
26
44
|
**Usage:**
|
27
45
|
|
28
46
|
cnab2ofx [cnab240_bank_statement_file] > [ofx_output_file]
|
29
|
-
|
30
|
-
|
47
|
+
|
48
|
+
---------------------------------------
|
49
|
+
|
50
|
+
Hosted on:
|
51
|
+
|
52
|
+
* __RubyGems__: [http://rubygems.org/gems/cnab2ofx/](http://rubygems.org/gems/cnab2ofx/)
|
53
|
+
* __BitBucket__: [https://bitbucket.org/abinoam/cnab2ofx](https://bitbucket.org/abinoam/cnab2ofx)
|
54
|
+
* __GitHub__: [https://github.com/abinoam/cnab2ofx](https://github.com/abinoam/cnab2ofx)
|
55
|
+
|
31
56
|
[1]: http://ruby-lang.org/ "Ruby Language"
|
32
57
|
[2]: http://www.febraban.org.br/Acervo1.asp?id_texto=717&id_pagina=173 "CNAB240"
|
33
58
|
[3]: http://www.febraban.org.br "Febraban"
|
34
59
|
[4]: http://www.ofx.net/ "Open Financial Exchange"
|
35
60
|
[5]: http://www.gnucash.org/ "GnuCash - Free Accounting Software"
|
36
61
|
[6]: http://support.microsoft.com/kb/2118008 "Microsoft Money"
|
37
|
-
[7]: http://quicken.intuit.com/ "Quicken"
|
62
|
+
[7]: http://quicken.intuit.com/ "Quicken"
|
data/cnab2ofx.gemspec
CHANGED
@@ -1,10 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require 'cnab2ofx/version'
|
7
|
+
|
8
|
+
GEM_VERSION = CNAB240::VERSION
|
9
|
+
|
1
10
|
Gem::Specification.new do |s|
|
2
11
|
s.name = "cnab2ofx"
|
3
|
-
s.version =
|
12
|
+
s.version = GEM_VERSION
|
4
13
|
s.platform = Gem::Platform::RUBY
|
5
14
|
s.authors = ["Abinoam Praxedes Marques Junior"]
|
6
15
|
s.email = ["abinoam@gmail.com"]
|
7
|
-
s.homepage = "https://
|
16
|
+
s.homepage = "https://github.com/abinoam/cnab2ofx"
|
8
17
|
s.summary = "CNAB240 to ofx conversion script"
|
9
18
|
s.description = "A small and simple script that can be used to convert CNAB240 to ofx financial formats"
|
10
19
|
s.rubyforge_project = s.name
|
data/helpers/cnab240_helper.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module CNAB240Helper
|
2
|
-
|
3
2
|
module StringHelper
|
4
|
-
|
5
3
|
def trim_lzeroes
|
6
4
|
self.sub(/^0+/,"")
|
7
5
|
rescue ArgumentError => e
|
@@ -14,7 +12,5 @@ module CNAB240Helper
|
|
14
12
|
from_date = DateTime.strptime(self,from) # Import from 'from' DateTime format
|
15
13
|
to_date = from_date.strftime(to) # Export to 'to' DateTime format
|
16
14
|
end
|
17
|
-
|
18
15
|
end
|
19
|
-
|
20
16
|
end
|
data/lib/cnab2ofx.rb
CHANGED
@@ -96,13 +96,25 @@ class CNAB240
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def get_branchid
|
99
|
-
@cnab240[:header_de_arquivo][:agência].trim_lzeroes
|
100
|
-
@cnab240[:header_de_arquivo][:agência_dv].trim_lzeroes
|
99
|
+
agência = @cnab240[:header_de_arquivo][:agência].trim_lzeroes
|
100
|
+
agência_dv = @cnab240[:header_de_arquivo][:agência_dv].trim_lzeroes
|
101
|
+
|
102
|
+
if agência_dv.empty?
|
103
|
+
agência
|
104
|
+
else
|
105
|
+
agência + "-" + agência_dv
|
106
|
+
end
|
101
107
|
end
|
102
108
|
|
103
109
|
def get_acctid
|
104
|
-
@cnab240[:header_de_arquivo][:conta_corrente].trim_lzeroes
|
105
|
-
@cnab240[:header_de_arquivo][:conta_corrente_dv].trim_lzeroes
|
110
|
+
conta_corrente = @cnab240[:header_de_arquivo][:conta_corrente].trim_lzeroes
|
111
|
+
conta_corrente_dv = @cnab240[:header_de_arquivo][:conta_corrente_dv].trim_lzeroes
|
112
|
+
|
113
|
+
if conta_corrente_dv.empty?
|
114
|
+
conta_corrente
|
115
|
+
else
|
116
|
+
conta_corrente + "-" + conta_corrente_dv
|
117
|
+
end
|
106
118
|
end
|
107
119
|
|
108
120
|
def get_balamt
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cnab2ofx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Abinoam Praxedes Marques Junior
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-01-04 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: A small and simple script that can be used to convert CNAB240 to ofx
|
15
14
|
financial formats
|
@@ -31,36 +30,35 @@ files:
|
|
31
30
|
- lib/cnab2ofx/cnab240/002_registro_detalhe_segmento_e.yaml
|
32
31
|
- lib/cnab2ofx/cnab240/003_registro_trailer_de_lote.yaml
|
33
32
|
- lib/cnab2ofx/cnab240/004_registro_trailer_de_arquivo.yaml
|
33
|
+
- lib/cnab2ofx/version.rb
|
34
34
|
- test/modelo.teste.cnab240
|
35
35
|
- view/extrato.ofx.erb
|
36
|
-
homepage: https://
|
36
|
+
homepage: https://github.com/abinoam/cnab2ofx
|
37
37
|
licenses: []
|
38
|
-
|
38
|
+
metadata: {}
|
39
|
+
post_install_message: |2+
|
39
40
|
|
40
|
-
A sample generated CNAB240 file is provided at '
|
41
|
+
A sample generated CNAB240 file is provided at 'test' directory.
|
41
42
|
|
42
|
-
|
43
|
-
'
|
44
43
|
rdoc_options: []
|
45
44
|
require_paths:
|
46
45
|
- lib
|
47
46
|
- helpers
|
48
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
48
|
requirements:
|
51
|
-
- -
|
49
|
+
- - ">="
|
52
50
|
- !ruby/object:Gem::Version
|
53
51
|
version: 1.9.2
|
54
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
53
|
requirements:
|
57
|
-
- -
|
54
|
+
- - ">="
|
58
55
|
- !ruby/object:Gem::Version
|
59
56
|
version: 1.3.6
|
60
57
|
requirements: []
|
61
58
|
rubyforge_project: cnab2ofx
|
62
|
-
rubygems_version:
|
59
|
+
rubygems_version: 2.4.5.1
|
63
60
|
signing_key:
|
64
|
-
specification_version:
|
61
|
+
specification_version: 4
|
65
62
|
summary: CNAB240 to ofx conversion script
|
66
63
|
test_files: []
|
64
|
+
has_rdoc:
|