cnab240santander 0.1.0 → 1.0.0
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.
- data/.gitignore +1 -0
- data/README.rdoc +25 -0
- data/lib/cnab240santander/formatacao.rb +0 -1
- data/lib/cnab240santander/retorno.rb +0 -3
- data/lib/cnab240santander/version.rb +2 -2
- data/lib/cnab240santander.rb +2 -2
- data/spec/files/cnab_spec.rb +2 -2
- metadata +5 -4
data/.gitignore
CHANGED
data/README.rdoc
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
= CNAB240 Santander
|
2
|
+
|
3
|
+
== Installing
|
4
|
+
|
5
|
+
$ require 'cnab240santander'
|
6
|
+
$ gem install cnab240santander
|
7
|
+
|
8
|
+
== Usage
|
9
|
+
|
10
|
+
You can request all the lines:
|
11
|
+
|
12
|
+
$ result = Cnab240santander.retorno(:path => '/home/yourname/file.TXT', :retorna => nil)
|
13
|
+
|
14
|
+
You can request only the header:
|
15
|
+
|
16
|
+
$ result = Cnab240santander.retorno(:path => '/home/yourname/file.TXT', :retorna => 0)
|
17
|
+
|
18
|
+
Or you can request only the data, optionally merging the T and U segments:
|
19
|
+
|
20
|
+
$ result = Cnab240santander.retorno(:path => '/home/yourname/file.TXT', :retorna => 3, :merge => true)
|
21
|
+
|
22
|
+
== Thanks
|
23
|
+
|
24
|
+
Thanks to Arthur Alexandre (https://github.com/arthurix), whose project I used as base to this one,
|
25
|
+
and to Rafael Macedo (https://github.com/rafaelmacedo), who helped me deploying my first gem.
|
@@ -52,10 +52,8 @@ module Cnab240santander
|
|
52
52
|
while (linha = f.gets)
|
53
53
|
tipoLn = linha[7..7].to_i
|
54
54
|
if tipoLn == $HEADER_ARQUIVO and args[:retorna] == $HEADER_ARQUIVO #0
|
55
|
-
puts "Processando header"
|
56
55
|
linhas << HeaderArquivo.processar(linha)
|
57
56
|
elsif tipoLn == $DETALHE and args[:retorna] == $DETALHE #3
|
58
|
-
puts "Processando detalhe"
|
59
57
|
segmento = linha[13..13]
|
60
58
|
if args[:merge] == true
|
61
59
|
hash_aux = {}
|
@@ -75,7 +73,6 @@ module Cnab240santander
|
|
75
73
|
end
|
76
74
|
|
77
75
|
elsif args[:retorna].blank?
|
78
|
-
puts "Processando linha..."
|
79
76
|
linhas << processarLinha(numLn, linha)
|
80
77
|
end
|
81
78
|
numLn += 1
|
data/lib/cnab240santander.rb
CHANGED
data/spec/files/cnab_spec.rb
CHANGED
@@ -12,13 +12,13 @@ describe "Cnab240santander" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should return an array" do
|
15
|
-
cnab = Cnab240santander.retorno(File.dirname(__FILE__)+"/../../RETORNO.TXT", nil)
|
15
|
+
cnab = Cnab240santander.retorno(:path => File.dirname(__FILE__)+"/../../RETORNO.TXT", :retorna => nil)
|
16
16
|
cnab.linhas.should be_kind_of(Array)
|
17
17
|
end
|
18
18
|
|
19
19
|
context "Header file" do
|
20
20
|
it "should parse the header file" do
|
21
|
-
cnab = Cnab240santander.retorno(File.dirname(__FILE__)+"/../../RETORNO.TXT", 0)
|
21
|
+
cnab = Cnab240santander.retorno(:path => File.dirname(__FILE__)+"/../../RETORNO.TXT", :retorna => 0)
|
22
22
|
cnab.linhas.should be_kind_of(Array)
|
23
23
|
end
|
24
24
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cnab240santander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
-
- 0
|
8
7
|
- 1
|
9
8
|
- 0
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lairton Borges
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-12-08 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activesupport
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- .gitignore
|
79
79
|
- .rspec
|
80
80
|
- Gemfile
|
81
|
+
- README.rdoc
|
81
82
|
- RETORNO.TXT
|
82
83
|
- Rakefile
|
83
84
|
- cnab240santander.gemspec
|