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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cba96159942652e76cd93b457730439dd0f38e63ac9686f6dbb194aeaf7264df
4
- data.tar.gz: c9383351d9ae7f2a537469911c63c4227958562f953c540e95bdb237cb88bd60
3
+ metadata.gz: b2f5d3c35f3ea4ab257c7634e157a2f07fbd0107df20916f9de72c1c8a9bd61b
4
+ data.tar.gz: 87bec9f245fdbda39ff27538e57af81facb02430a838b40c2e742d4a60132688
5
5
  SHA512:
6
- metadata.gz: a547e816be2d87e19efbb50a3d48c232a823c0c47ac8c4f98efa07f057809f1eb18a2a61d664183e1cfe7941e92c2b931588ed75f2f32171367ca9dd00f73344
7
- data.tar.gz: a1cb0b1929b785eab51146ec3bea0f10e42919383c049604691b3b7b7f7a9135e4b9acce81945eaff1ec33355782fcb3133e94c3f15f3434fe5bb7b66696776c
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.check_file?(path)
8
- BciXls.new(File.open(path, 'r'))
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 check_file?(path)
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.0.0
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: []