cartolabco 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -2
- data/lib/cartolabco.rb +7 -2
- data/lib/check_file.rb +5 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f5d3c35f3ea4ab257c7634e157a2f07fbd0107df20916f9de72c1c8a9bd61b
|
4
|
+
data.tar.gz: 87bec9f245fdbda39ff27538e57af81facb02430a838b40c2e742d4a60132688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b61d308ac8d2725992d71825315037860763b078025e745ea1050ae1a48e3ddb03e58252d270600eb70de498fac51ce7a65c968b622d4827af4aca4b803cdc
|
7
|
+
data.tar.gz: 6db809afd27bb58aab29d0e4cb97a4c62a95037d5aef0a4d4e7d9f655c4b07ac3c1ccdc8f5c275c8b7ce609fda06b641da859e1ee556eca4bb43d46edd3bf519
|
data/README.md
CHANGED
@@ -5,8 +5,6 @@
|
|
5
5
|
|
6
6
|
Import file from banks to raise bank balance.
|
7
7
|
|
8
|
-
## How to use
|
9
|
-
|
10
8
|
Distributed in [RubyGems](https://rubygems.org/gems/cartolabco)
|
11
9
|
|
12
10
|
__Gemfile__
|
@@ -17,6 +15,45 @@ __Install__
|
|
17
15
|
|
18
16
|
`gem install cartolabco`
|
19
17
|
|
18
|
+
## How to use
|
19
|
+
|
20
|
+
__from path or file__
|
21
|
+
```ruby
|
22
|
+
bci_xls = Cartolabco::BciParse.from_path('path ...')
|
23
|
+
bci_xls = Cartolabco::BciParse.from_file(file)
|
24
|
+
```
|
25
|
+
|
26
|
+
__get data__
|
27
|
+
```ruby
|
28
|
+
bci = bci_xls.parse
|
29
|
+
```
|
30
|
+
|
31
|
+
`bci` contains:
|
32
|
+
|
33
|
+
|attribute|type|
|
34
|
+
|:-:|:-:|
|
35
|
+
|numero_catola|int|
|
36
|
+
|saldo_inicial|float|
|
37
|
+
|saldo_final|float|
|
38
|
+
|total_cargos|float|
|
39
|
+
|total_abonos|float|
|
40
|
+
|desde|string|
|
41
|
+
|hasta|string|
|
42
|
+
|movimientos|array|
|
43
|
+
|
44
|
+
`movimientos` contains:
|
45
|
+
|
46
|
+
|attribute|type|
|
47
|
+
|:-:|:-:|
|
48
|
+
|fecha|string|
|
49
|
+
|correlativo|int|
|
50
|
+
|descripcion|string|
|
51
|
+
|sucursal|string|
|
52
|
+
|nro_documento|string|
|
53
|
+
|cargo|float|
|
54
|
+
|abono|float|
|
55
|
+
|saldo|float|
|
56
|
+
|
20
57
|
## Contribute
|
21
58
|
just test your code before pull request, run
|
22
59
|
```console
|
data/lib/cartolabco.rb
CHANGED
@@ -4,8 +4,13 @@ require 'bci_xls'
|
|
4
4
|
module Cartolabco
|
5
5
|
class BciParse
|
6
6
|
def self.from_path(path)
|
7
|
-
CheckFile.new.
|
8
|
-
|
7
|
+
CheckFile.new.check_path?(path)
|
8
|
+
self.from_file(File.open(path, 'r'))
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.from_file(file)
|
12
|
+
CheckFile.new.check_file?(file)
|
13
|
+
BciXls.new(file)
|
9
14
|
end
|
10
15
|
end
|
11
16
|
end
|
data/lib/check_file.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class CheckFile
|
2
|
-
def
|
2
|
+
def check_path?(path)
|
3
3
|
accepted_formats = [".xls"]
|
4
4
|
unless File.file?(path)
|
5
5
|
raise 'File does not exist'
|
@@ -8,4 +8,8 @@ class CheckFile
|
|
8
8
|
raise 'Not accepted format: ' + File.extname(path)
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
def check_file?(file)
|
13
|
+
check_path?(file.path)
|
14
|
+
end
|
11
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cartolabco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Astorga
|
@@ -27,7 +27,8 @@ files:
|
|
27
27
|
- lib/check_file.rb
|
28
28
|
- lib/movimiento.rb
|
29
29
|
homepage: http://rubygems.org/gems/cartolabco
|
30
|
-
licenses:
|
30
|
+
licenses:
|
31
|
+
- MIT
|
31
32
|
metadata: {}
|
32
33
|
post_install_message:
|
33
34
|
rdoc_options: []
|