bankscrap 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -1
- data/generators/templates/lib/bankscrap/%bank_name_dasherized%/bank.rb.tt +1 -0
- data/lib/bankscrap/cli.rb +8 -6
- data/lib/bankscrap/exporters/csv.rb +1 -1
- data/lib/bankscrap/transaction.rb +2 -2
- data/lib/bankscrap/utils/cli_string.rb +40 -0
- data/lib/bankscrap/version.rb +1 -1
- data/lib/bankscrap.rb +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1481cd3fa9e6859cd8afaed3ddf47a7fcafa66d1
|
4
|
+
data.tar.gz: 3c11cce2190b9c058e2a28be2934015bbd63a9dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1d7ec05a3268e4760d387bb77172c3b20a9d8052c78253b40c8f0e53656f9532e2d260fcf5aaa62e0e115ab6c09f42376be65cdb460f03880b08bfe1c1519ff
|
7
|
+
data.tar.gz: 4bd5ddeb61e0f411a65ed0aa30c6581e5ece111d32856832a512c41ee5de416e532d3f29f7176efc6266f2151f3a0e0a5c7dd99fba1d80f964831fc4d3b6d69b
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# 💸 Bankscrap 💸
|
2
2
|
|
3
|
-
[![](
|
3
|
+
[![Slack](https://now-examples-slackin-hiyfeggjfn.now.sh/badge.svg)](https://now-examples-slackin-hiyfeggjfn.now.sh/)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/bankscrap.svg)](https://badge.fury.io/rb/bankscrap)
|
5
5
|
[![Build Status](https://travis-ci.org/bankscrap/bankscrap.svg?branch=master)](https://travis-ci.org/bankscrap/bankscrap)
|
6
6
|
|
@@ -16,7 +16,9 @@ Feel free to contribute and add your bank if it isn't supported.
|
|
16
16
|
* **Arquia Banca**: [bankscrap-arquia](https://github.com/bankscrap/bankscrap-arquia)
|
17
17
|
* **Openbank**: [bankscrap-openbank](https://github.com/bankscrap/bankscrap-openbank)
|
18
18
|
* **Sabadell**: [bankscrap-sabadell](https://github.com/bankscrap/bankscrap-sabadell)
|
19
|
+
* **Ibercaja**: [bankscrap-ibercaja](https://github.com/bankscrap/bankscrap-ibercaja)
|
19
20
|
* **Santander** (WIP): [bankscrap-santander](https://github.com/bankscrap/bankscrap-santander)
|
21
|
+
* **Shinsei Bank**: [bankscrap-shinsei](https://github.com/bankscrap/bankscrap-shinsei)
|
20
22
|
|
21
23
|
Interested in any other bank? Open a new Issue and we'll try to help.
|
22
24
|
|
@@ -175,6 +177,34 @@ ing = Bankscrap::ING::Bank.new(dni: YOUR_DNI, password: YOUR_ING_PASSWORD, birth
|
|
175
177
|
4. Push to the branch (`git push origin my-new-feature`)
|
176
178
|
5. Create a new Pull Request
|
177
179
|
|
180
|
+
### Start a new Bank Adapter with the generator
|
181
|
+
You can use a generator to create the basic template for your new bank adapter.
|
182
|
+
1. Install the bankscrap gem (`gem install bankscrap`) if you don't have it already.
|
183
|
+
2. Use the name of your *BankName* like: `bankscrap generate_adapter BankName`, you will get:
|
184
|
+
|
185
|
+
```
|
186
|
+
create
|
187
|
+
create bankscrap-my-bank-name.gemspec
|
188
|
+
create .gitignore
|
189
|
+
create Gemfile
|
190
|
+
create LICENSE.txt
|
191
|
+
create README.md
|
192
|
+
create Rakefile
|
193
|
+
create lib/bankscrap-my-bank-name.rb
|
194
|
+
create lib/bankscrap/my-bank-name/bank.rb
|
195
|
+
create lib/bankscrap/my-bank-name/version.rb
|
196
|
+
|
197
|
+
Great! Now you can start implementing your bank's adapter for Bankscrap.
|
198
|
+
|
199
|
+
To get started take a look to:
|
200
|
+
/Users/username/bankscrap/bankscrap-my-bank-name/lib/bankscrap/my-bank-name/bank.rb
|
201
|
+
|
202
|
+
If you need help you can join our Slack chat room. Click the Slack badge on Github:
|
203
|
+
https://github.com/bankscrap/bankscrap
|
204
|
+
```
|
205
|
+
3. Create a git repository on the newly created directory (`git init`) and start commiting.
|
206
|
+
4. Push your repo to github and open an Issue at https://github.com/bankscrap/bankscrap/issues referencing it
|
207
|
+
|
178
208
|
## Thanks
|
179
209
|
|
180
210
|
Thanks to Javier Cuevas (@javiercr) for his [BBVA](https://github.com/javiercr/bbva) gem.
|
@@ -75,6 +75,7 @@ module Bankscrap
|
|
75
75
|
id: REPLACE_ME,
|
76
76
|
amount: REPLACE_ME, # Should be a Money object
|
77
77
|
description: REPLACE_ME,
|
78
|
+
description_detail: REPLACE_ME, # Optional
|
78
79
|
effective_date: REPLACE_ME,
|
79
80
|
operation_date: REPLACE_ME,
|
80
81
|
balance: REPLACE_ME # Should be a Money object
|
data/lib/bankscrap/cli.rb
CHANGED
@@ -6,6 +6,8 @@ end
|
|
6
6
|
|
7
7
|
module Bankscrap
|
8
8
|
class CLI < Thor
|
9
|
+
SPACER = (' ' * 3).freeze
|
10
|
+
|
9
11
|
def self.shared_options
|
10
12
|
option :credentials, default: {}, type: :hash
|
11
13
|
option :log, default: false, type: :boolean
|
@@ -112,18 +114,18 @@ module Bankscrap
|
|
112
114
|
def print_transactions_header
|
113
115
|
say "\n"
|
114
116
|
say 'DATE'.ljust(13)
|
115
|
-
say 'DESCRIPTION'.ljust(50) +
|
116
|
-
say 'AMOUNT'.rjust(15) +
|
117
|
+
say 'DESCRIPTION'.ljust(50) + SPACER
|
118
|
+
say 'AMOUNT'.rjust(15) + SPACER
|
117
119
|
say 'BALANCE'.rjust(15)
|
118
120
|
say '-' * 99
|
119
121
|
end
|
120
122
|
|
121
123
|
def print_transaction(transaction)
|
122
124
|
color = (transaction.amount.to_i > 0 ? :green : :red)
|
123
|
-
say transaction.effective_date.strftime('%d/%m/%Y') +
|
124
|
-
say transaction.description.squish.truncate(50).ljust(50) +
|
125
|
-
say transaction.amount.format.rjust(15) +
|
126
|
-
say transaction.balance.format.rjust(15)
|
125
|
+
say transaction.effective_date.strftime('%d/%m/%Y') + SPACER
|
126
|
+
say Utils::CliString.new(transaction.description).squish.truncate(50).ljust(50) + SPACER, color
|
127
|
+
say Utils::CliString.new(transaction.amount.format).rjust(15) + SPACER, color
|
128
|
+
say Utils::CliString.new(transaction.balance.format).rjust(15)
|
127
129
|
end
|
128
130
|
end
|
129
131
|
end
|
@@ -2,7 +2,7 @@ module Bankscrap
|
|
2
2
|
class Transaction
|
3
3
|
include Utils::Inspectable
|
4
4
|
|
5
|
-
attr_accessor :id, :amount, :description, :effective_date, :operation_date, :balance, :account
|
5
|
+
attr_accessor :id, :amount, :description, :description_detail, :effective_date, :operation_date, :balance, :account
|
6
6
|
|
7
7
|
def initialize(params = {})
|
8
8
|
raise NotMoneyObjectError.new(:amount) unless params[:amount].is_a?(Money)
|
@@ -15,7 +15,7 @@ module Bankscrap
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def to_a
|
18
|
-
[effective_date.strftime('%d/%m/%Y'), description, amount]
|
18
|
+
[id, effective_date.strftime('%d/%m/%Y'), description, description_detail, amount]
|
19
19
|
end
|
20
20
|
|
21
21
|
def currency
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'unicode/display_width'
|
2
|
+
|
3
|
+
module Bankscrap
|
4
|
+
module Utils
|
5
|
+
class CliString < String
|
6
|
+
def ljust(to_length, padstr = ' ')
|
7
|
+
self.class.new(self + padding(to_length, padstr))
|
8
|
+
end
|
9
|
+
|
10
|
+
def rjust(to_length, padstr = ' ')
|
11
|
+
self.class.new(padding(to_length, padstr) + self)
|
12
|
+
end
|
13
|
+
|
14
|
+
def truncate(truncate_at)
|
15
|
+
if display_width > truncate_at
|
16
|
+
self.class.new(self[0..-2]).truncate(truncate_at)
|
17
|
+
else
|
18
|
+
self.class.new(self)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def padding(to_length, padstr)
|
25
|
+
padstr.to_str * padding_length(to_length)
|
26
|
+
end
|
27
|
+
|
28
|
+
def padding_length(to_length)
|
29
|
+
[
|
30
|
+
0,
|
31
|
+
to_length - display_width
|
32
|
+
].max
|
33
|
+
end
|
34
|
+
|
35
|
+
def display_width
|
36
|
+
Unicode::DisplayWidth.of(self)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/bankscrap/version.rb
CHANGED
data/lib/bankscrap.rb
CHANGED
@@ -2,6 +2,7 @@ require 'active_support/all'
|
|
2
2
|
require 'money'
|
3
3
|
require 'rubygems'
|
4
4
|
require_relative 'bankscrap/utils/inspectable'
|
5
|
+
require_relative 'bankscrap/utils/cli_string'
|
5
6
|
require_relative 'bankscrap/version'
|
6
7
|
require_relative 'bankscrap/config'
|
7
8
|
require_relative 'bankscrap/cli'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bankscrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Cuevas
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: unicode-display_width
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
112
126
|
description: Command line tools to get bank account details from some banks.
|
113
127
|
email:
|
114
128
|
- javi@diacode.com
|
@@ -139,9 +153,10 @@ files:
|
|
139
153
|
- lib/bankscrap/investment.rb
|
140
154
|
- lib/bankscrap/locale/en.yml
|
141
155
|
- lib/bankscrap/transaction.rb
|
156
|
+
- lib/bankscrap/utils/cli_string.rb
|
142
157
|
- lib/bankscrap/utils/inspectable.rb
|
143
158
|
- lib/bankscrap/version.rb
|
144
|
-
homepage: https://github.com/
|
159
|
+
homepage: https://github.com/bankscrap/bankscrap
|
145
160
|
licenses:
|
146
161
|
- MIT
|
147
162
|
metadata: {}
|