bank_scrap 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/bank_scrap.rb +4 -3
- data/lib/bank_scrap/account.rb +3 -3
- data/lib/bank_scrap/bank.rb +15 -12
- data/lib/bank_scrap/banks/bbva.rb +47 -34
- data/lib/bank_scrap/banks/ing.rb +31 -8
- data/lib/bank_scrap/cli.rb +7 -8
- data/lib/bank_scrap/config.rb +2 -2
- data/lib/bank_scrap/investment.rb +18 -0
- data/lib/bank_scrap/locale/en.yml +5 -5
- data/lib/bank_scrap/transaction.rb +2 -2
- data/lib/bank_scrap/utils/inspectable.rb +4 -4
- data/lib/bank_scrap/version.rb +1 -1
- metadata +5 -11
- data/.gitignore +0 -19
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/Rakefile +0 -2
- data/bank_scrap.gemspec +0 -34
- data/bin/bank_scrap +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72a10733f8205d87884e40ba46e1d783317c0670
|
4
|
+
data.tar.gz: 03caab3dceaf26a5101bf18f1078b19c0382f6ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0b2753998bdd9c2d523c0bf058080afd56b595d4fcb24a0199c8fcfed5d2b805b94b211b3d465359ed7a887e6c5bfa5f35eea8e3b78f954883be3198e4a3c87
|
7
|
+
data.tar.gz: 0a50ff4c20b0f2423f358dd7114f53960c1034629ed29b3b042bcfcb223564e8c526be6c38d1200d4bce6c0c746c4122fe780d429982fd26cfa5a3dc6c89cbc1
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ BankScrap uses both methods depending on the bank.
|
|
29
29
|
|
30
30
|
## Requirements
|
31
31
|
|
32
|
-
Some banks needs a JavaScript runtime in order to work. So if you find an error like "Could not find
|
32
|
+
Some banks needs a JavaScript runtime in order to work. So if you find an error like "Could not find JavaScript runtime" try to install one. It has been tested with nodejs.
|
33
33
|
|
34
34
|
## Installation
|
35
35
|
|
@@ -37,7 +37,7 @@ Some banks needs a JavaScript runtime in order to work. So if you find an error
|
|
37
37
|
|
38
38
|
You can check out the latest source from git:
|
39
39
|
|
40
|
-
git clone git://github.com/
|
40
|
+
git clone git://github.com/bank-scrap/bank_scrap
|
41
41
|
|
42
42
|
### From RubyGems
|
43
43
|
|
@@ -137,7 +137,7 @@ account.transactions
|
|
137
137
|
|
138
138
|
## Contributing
|
139
139
|
|
140
|
-
1. Fork it ( https://github.com/
|
140
|
+
1. Fork it ( https://github.com/bank-scrap/bank_scrap/fork )
|
141
141
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
142
142
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
143
143
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/bank_scrap.rb
CHANGED
@@ -6,12 +6,13 @@ require 'bank_scrap/config'
|
|
6
6
|
require 'bank_scrap/cli'
|
7
7
|
require 'bank_scrap/bank'
|
8
8
|
require 'bank_scrap/account'
|
9
|
+
require 'bank_scrap/investment'
|
9
10
|
require 'bank_scrap/transaction'
|
10
11
|
|
11
12
|
module BankScrap
|
12
13
|
# autoload only requires the file when the specified
|
13
14
|
# constant is used for the first time
|
14
|
-
autoload :Bankinter,
|
15
|
-
autoload :Bbva,
|
16
|
-
autoload :Ing,
|
15
|
+
autoload :Bankinter, 'bank_scrap/banks/bankinter'
|
16
|
+
autoload :Bbva, 'bank_scrap/banks/bbva'
|
17
|
+
autoload :Ing, 'bank_scrap/banks/ing'
|
17
18
|
end
|
data/lib/bank_scrap/account.rb
CHANGED
@@ -2,10 +2,10 @@ module BankScrap
|
|
2
2
|
class Account
|
3
3
|
include Utils::Inspectable
|
4
4
|
|
5
|
-
attr_accessor :bank, :id, :name, :balance, :currency,
|
5
|
+
attr_accessor :bank, :id, :name, :balance, :currency,
|
6
6
|
:available_balance, :description,
|
7
7
|
:transactions, :iban, :bic
|
8
|
-
|
8
|
+
|
9
9
|
def initialize(params = {})
|
10
10
|
params.each { |key, value| send "#{key}=", value }
|
11
11
|
end
|
@@ -22,7 +22,7 @@ module BankScrap
|
|
22
22
|
|
23
23
|
def inspect_attributes
|
24
24
|
[
|
25
|
-
:id, :name, :balance, :currency,
|
25
|
+
:id, :name, :balance, :currency,
|
26
26
|
:available_balance, :description,
|
27
27
|
:iban, :bic
|
28
28
|
]
|
data/lib/bank_scrap/bank.rb
CHANGED
@@ -3,26 +3,31 @@ require 'logger'
|
|
3
3
|
|
4
4
|
module BankScrap
|
5
5
|
class Bank
|
6
|
-
|
7
6
|
WEB_USER_AGENT = 'Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19'
|
8
|
-
attr_accessor :headers, :accounts
|
7
|
+
attr_accessor :headers, :accounts, :investments
|
9
8
|
|
10
9
|
def initialize(user, password, log: false, debug: false, extra_args: nil)
|
11
|
-
@accounts
|
10
|
+
@accounts = fetch_accounts
|
12
11
|
end
|
13
12
|
|
14
13
|
# Interface method placeholders
|
15
14
|
|
16
15
|
def fetch_accounts
|
17
|
-
|
16
|
+
fail "#{self.class} should implement a fetch_account method"
|
17
|
+
end
|
18
|
+
|
19
|
+
def fetch_investments
|
20
|
+
fail "#{self.class} should implement a fetch_investment method"
|
18
21
|
end
|
19
22
|
|
20
|
-
def fetch_transactions_for(
|
21
|
-
|
23
|
+
def fetch_transactions_for(*)
|
24
|
+
fail "#{self.class} should implement a fetch_transactions method"
|
22
25
|
end
|
23
26
|
|
24
27
|
def account_with_iban(iban)
|
25
|
-
accounts.find
|
28
|
+
accounts.find do |account|
|
29
|
+
account.iban.gsub(' ', '') == iban.gsub(' ', '')
|
30
|
+
end
|
26
31
|
end
|
27
32
|
|
28
33
|
private
|
@@ -43,19 +48,17 @@ module BankScrap
|
|
43
48
|
# and resets the headers
|
44
49
|
def with_headers(tmp_headers)
|
45
50
|
current_headers = @headers
|
46
|
-
|
51
|
+
add_headers(tmp_headers)
|
47
52
|
yield
|
48
53
|
ensure
|
49
|
-
|
54
|
+
add_headers(current_headers)
|
50
55
|
end
|
51
56
|
|
52
|
-
|
53
|
-
def set_headers(headers)
|
57
|
+
def add_headers(headers)
|
54
58
|
@headers.merge! headers
|
55
59
|
@http.request_headers = @headers
|
56
60
|
end
|
57
61
|
|
58
|
-
|
59
62
|
def initialize_cookie(url)
|
60
63
|
@http.get(url).body
|
61
64
|
end
|
@@ -2,12 +2,12 @@ require 'json'
|
|
2
2
|
|
3
3
|
module BankScrap
|
4
4
|
class Bbva < Bank
|
5
|
-
BASE_ENDPOINT
|
6
|
-
LOGIN_ENDPOINT
|
5
|
+
BASE_ENDPOINT = 'https://bancamovil.grupobbva.com'
|
6
|
+
LOGIN_ENDPOINT = '/DFAUTH/slod/DFServletXML'
|
7
7
|
PRODUCTS_ENDPOINT = '/ENPP/enpp_mult_web_mobility_02/products/v1'
|
8
|
-
ACCOUNT_ENDPOINT
|
8
|
+
ACCOUNT_ENDPOINT = '/ENPP/enpp_mult_web_mobility_02/accounts/'
|
9
9
|
# BBVA expects an identifier before the actual User Agent, but 12345 works fine
|
10
|
-
USER_AGENT
|
10
|
+
USER_AGENT = '12345;Android;LGE;Nexus 5;1080x1776;Android;4.4.4;BMES;4.0.4'
|
11
11
|
|
12
12
|
def initialize(user, password, log: false, debug: false, extra_args: nil)
|
13
13
|
@user = format_user(user.dup)
|
@@ -17,8 +17,8 @@ module BankScrap
|
|
17
17
|
|
18
18
|
initialize_connection
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
add_headers(
|
21
|
+
'User-Agent' => USER_AGENT,
|
22
22
|
'BBVA-User-Agent' => USER_AGENT,
|
23
23
|
'Accept-Language' => 'spa',
|
24
24
|
'Content-Language' => 'spa',
|
@@ -27,7 +27,7 @@ module BankScrap
|
|
27
27
|
'Connection' => 'Keep-Alive',
|
28
28
|
'Host' => 'bancamovil.grupobbva.com',
|
29
29
|
'Cookie2' => '$Version=1'
|
30
|
-
|
30
|
+
)
|
31
31
|
|
32
32
|
login
|
33
33
|
super
|
@@ -37,27 +37,27 @@ module BankScrap
|
|
37
37
|
# Returns an array of BankScrap::Account objects
|
38
38
|
def fetch_accounts
|
39
39
|
log 'fetch_accounts'
|
40
|
-
|
40
|
+
|
41
41
|
# Even if the required method is an HTTP POST
|
42
42
|
# the API requires a funny header that says is a GET
|
43
43
|
# otherwise the request doesn't work.
|
44
|
-
response = with_headers(
|
44
|
+
response = with_headers('BBVA-Method' => 'GET') do
|
45
45
|
post(BASE_ENDPOINT + PRODUCTS_ENDPOINT, {})
|
46
46
|
end
|
47
47
|
|
48
48
|
json = JSON.parse(response)
|
49
|
-
json[
|
49
|
+
json['accounts'].map { |data| build_account(data) }
|
50
50
|
end
|
51
51
|
|
52
|
-
# Fetch transactions for the given account.
|
52
|
+
# Fetch transactions for the given account.
|
53
53
|
# By default it fetches transactions for the last month,
|
54
54
|
# The maximum allowed by the BBVA API is the last 3 years.
|
55
55
|
#
|
56
56
|
# Account should be a BankScrap::Account object
|
57
57
|
# Returns an array of BankScrap::Transaction objects
|
58
58
|
def fetch_transactions_for(account, start_date: Date.today - 1.month, end_date: Date.today)
|
59
|
-
|
60
|
-
|
59
|
+
from_date = start_date.strftime('%Y-%m-%d')
|
60
|
+
to_date = end_date.strftime('%Y-%m-%d')
|
61
61
|
|
62
62
|
# Misteriously we need a specific content-type here
|
63
63
|
funny_headers = {
|
@@ -65,29 +65,34 @@ module BankScrap
|
|
65
65
|
'BBVA-Method' => 'GET'
|
66
66
|
}
|
67
67
|
|
68
|
-
url = BASE_ENDPOINT +
|
68
|
+
url = BASE_ENDPOINT +
|
69
|
+
ACCOUNT_ENDPOINT +
|
70
|
+
account.id +
|
71
|
+
"/movements/v1?fromDate=#{from_date}&toDate=#{to_date}"
|
69
72
|
offset = nil
|
70
73
|
transactions = []
|
71
|
-
|
74
|
+
|
72
75
|
with_headers(funny_headers) do
|
73
76
|
# Loop over pagination
|
74
77
|
loop do
|
75
78
|
new_url = offset ? (url + "&offset=#{offset}") : url
|
76
79
|
json = JSON.parse(post(new_url, {}))
|
77
80
|
|
78
|
-
unless json[
|
79
|
-
transactions += json[
|
80
|
-
|
81
|
+
unless json['movements'].blank?
|
82
|
+
transactions += json['movements'].map do |data|
|
83
|
+
build_transaction(data, account)
|
84
|
+
end
|
85
|
+
offset = json['offset']
|
81
86
|
end
|
82
87
|
|
83
|
-
break unless json[
|
88
|
+
break unless json['thereAreMoreMovements'] == true
|
84
89
|
end
|
85
90
|
end
|
86
91
|
|
87
92
|
transactions
|
88
93
|
end
|
89
|
-
|
90
|
-
private
|
94
|
+
|
95
|
+
private
|
91
96
|
|
92
97
|
# As far as we know there are two types of identifiers BBVA uses
|
93
98
|
# 1) A number of 7 characters that gets passed to the API as it is
|
@@ -95,24 +100,25 @@ module BankScrap
|
|
95
100
|
# Example: "49021740T" will become "0019-049021740T"
|
96
101
|
def format_user(user)
|
97
102
|
user.upcase!
|
98
|
-
|
99
|
-
if user.match
|
103
|
+
|
104
|
+
if user.match(/^[0-9]{8}[A-Z]$/)
|
100
105
|
# It's a DNI
|
101
106
|
"0019-0#{user}"
|
102
107
|
else
|
103
108
|
user
|
104
|
-
end
|
109
|
+
end
|
105
110
|
end
|
106
111
|
|
107
112
|
def login
|
108
113
|
log 'login'
|
109
|
-
|
114
|
+
params = {
|
110
115
|
'origen' => 'enpp',
|
111
116
|
'eai_tipoCP' => 'up',
|
112
117
|
'eai_user' => @user,
|
113
118
|
'eai_password' => @password,
|
114
119
|
'eai_URLDestino' => '/ENPP/enpp_mult_web_mobility_02/sessions/v1'
|
115
|
-
}
|
120
|
+
}
|
121
|
+
post(BASE_ENDPOINT + LOGIN_ENDPOINT, params)
|
116
122
|
end
|
117
123
|
|
118
124
|
# Build an Account object from API data
|
@@ -126,22 +132,29 @@ module BankScrap
|
|
126
132
|
currency: data['currency'],
|
127
133
|
iban: data['iban'],
|
128
134
|
description: "#{data['typeDescription']} #{data['familyCode']}"
|
129
|
-
)
|
130
|
-
end
|
135
|
+
)
|
136
|
+
end
|
131
137
|
|
132
138
|
# Build a transaction object from API data
|
133
139
|
def build_transaction(data, account)
|
134
|
-
amount = Money.new(data['amount'] * 100, data['currency'])
|
135
|
-
balance = data['accountBalanceAfterMovement'] ? Money.new(data['accountBalanceAfterMovement'] * 100, data['currency']) : nil
|
136
140
|
Transaction.new(
|
137
141
|
account: account,
|
138
142
|
id: data['id'],
|
139
|
-
amount:
|
143
|
+
amount: transaction_amount(data),
|
140
144
|
description: data['conceptDescription'] || data['description'],
|
141
|
-
effective_date: Date.strptime(data['operationDate'],
|
145
|
+
effective_date: Date.strptime(data['operationDate'], '%Y-%m-%d'),
|
142
146
|
currency: data['currency'],
|
143
|
-
balance:
|
147
|
+
balance: transaction_balance(data)
|
144
148
|
)
|
145
149
|
end
|
150
|
+
|
151
|
+
def transaction_amount(data)
|
152
|
+
Money.new(data['amount'] * 100, data['currency'])
|
153
|
+
end
|
154
|
+
|
155
|
+
def transaction_balance(data)
|
156
|
+
return unless data['accountBalanceAfterMovement']
|
157
|
+
Money.new(data['accountBalanceAfterMovement'] * 100, data['currency'])
|
158
|
+
end
|
146
159
|
end
|
147
|
-
end
|
160
|
+
end
|
data/lib/bank_scrap/banks/ing.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'base64'
|
3
|
-
require '
|
3
|
+
require 'rmagick'
|
4
4
|
require 'tempfile'
|
5
5
|
|
6
6
|
module BankScrap
|
@@ -25,6 +25,8 @@ module BankScrap
|
|
25
25
|
initialize_connection
|
26
26
|
bundled_login
|
27
27
|
|
28
|
+
@investments = fetch_investments
|
29
|
+
|
28
30
|
super
|
29
31
|
end
|
30
32
|
|
@@ -43,18 +45,28 @@ module BankScrap
|
|
43
45
|
|
44
46
|
def fetch_accounts
|
45
47
|
log 'fetch_accounts'
|
46
|
-
|
48
|
+
add_headers(
|
47
49
|
'Accept' => '*/*',
|
48
50
|
'Content-Type' => 'application/json; charset=utf-8'
|
49
51
|
)
|
50
52
|
|
51
|
-
|
52
|
-
|
53
|
-
@raw_accounts_data.map do |account|
|
53
|
+
JSON.parse(get(PRODUCTS_ENDPOINT)).map do |account|
|
54
54
|
build_account(account) if account['iban']
|
55
55
|
end.compact
|
56
56
|
end
|
57
57
|
|
58
|
+
def fetch_investments
|
59
|
+
log 'fetch_investments'
|
60
|
+
add_headers(
|
61
|
+
'Accept' => '*/*',
|
62
|
+
'Content-Type' => 'application/json; charset=utf-8'
|
63
|
+
)
|
64
|
+
|
65
|
+
JSON.parse(get(PRODUCTS_ENDPOINT)).map do |investment|
|
66
|
+
build_investment(investment) if investment['investment']
|
67
|
+
end.compact
|
68
|
+
end
|
69
|
+
|
58
70
|
def fetch_transactions_for(account, start_date: Date.today - 1.month, end_date: Date.today)
|
59
71
|
log "fetch_transactions for #{account.id}"
|
60
72
|
|
@@ -71,7 +83,7 @@ module BankScrap
|
|
71
83
|
loop do
|
72
84
|
request = get("#{PRODUCTS_ENDPOINT}/#{account.id}/movements", params)
|
73
85
|
json = JSON.parse(request)
|
74
|
-
transactions += json['elements'].map do |transaction|
|
86
|
+
transactions += (json['elements'] || []).map do |transaction|
|
75
87
|
build_transaction(transaction, account)
|
76
88
|
end
|
77
89
|
params[:offset] += 25
|
@@ -89,7 +101,7 @@ module BankScrap
|
|
89
101
|
end
|
90
102
|
|
91
103
|
def login
|
92
|
-
|
104
|
+
add_headers(
|
93
105
|
'Accept' => 'application/json, text/javascript, */*; q=0.01',
|
94
106
|
'Content-Type' => 'application/json; charset=utf-8'
|
95
107
|
)
|
@@ -117,7 +129,7 @@ module BankScrap
|
|
117
129
|
end
|
118
130
|
|
119
131
|
def post_auth(ticket)
|
120
|
-
|
132
|
+
add_headers(
|
121
133
|
'Accept' => 'application/json, text/javascript, */*; q=0.01',
|
122
134
|
'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8'
|
123
135
|
)
|
@@ -203,6 +215,17 @@ module BankScrap
|
|
203
215
|
)
|
204
216
|
end
|
205
217
|
|
218
|
+
def build_investment(data)
|
219
|
+
Investment.new(
|
220
|
+
bank: self,
|
221
|
+
id: data['uuid'],
|
222
|
+
name: data['name'],
|
223
|
+
balance: data['balance'],
|
224
|
+
currency: 'EUR',
|
225
|
+
investment: data['investment']
|
226
|
+
)
|
227
|
+
end
|
228
|
+
|
206
229
|
# Build a transaction object from API data
|
207
230
|
def build_transaction(data, account)
|
208
231
|
amount = Money.new(data['amount'] * 100, data['currency'])
|
data/lib/bank_scrap/cli.rb
CHANGED
@@ -15,7 +15,7 @@ module BankScrap
|
|
15
15
|
option :extra, type: :hash, default: {}
|
16
16
|
end
|
17
17
|
|
18
|
-
desc
|
18
|
+
desc 'balance BANK', "get accounts' balance"
|
19
19
|
shared_options
|
20
20
|
def balance(bank)
|
21
21
|
assign_shared_options
|
@@ -27,7 +27,7 @@ module BankScrap
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
desc
|
30
|
+
desc 'transactions BANK', "get account's transactions"
|
31
31
|
shared_options
|
32
32
|
def transactions(bank, iban = nil)
|
33
33
|
assign_shared_options
|
@@ -55,13 +55,13 @@ module BankScrap
|
|
55
55
|
end
|
56
56
|
|
57
57
|
say "Transactions for: #{account.description} (#{account.iban})", :cyan
|
58
|
-
|
58
|
+
|
59
59
|
transactions.each do |transaction|
|
60
60
|
say transaction.to_s, (transaction.amount > Money.new(0) ? :green : :red)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
private
|
64
|
+
private
|
65
65
|
|
66
66
|
def assign_shared_options
|
67
67
|
@user = options[:user]
|
@@ -72,15 +72,14 @@ module BankScrap
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def initialize_client_for(bank_name)
|
75
|
-
bank_class = find_bank_class_for(bank_name)
|
75
|
+
bank_class = find_bank_class_for(bank_name)
|
76
76
|
@client = bank_class.new(@user, @password, log: @log, debug: @debug, extra_args: @extra_args)
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
def find_bank_class_for(bank_name)
|
80
|
-
Object.const_get(
|
80
|
+
Object.const_get('BankScrap::' + bank_name.classify)
|
81
81
|
rescue NameError
|
82
82
|
raise ArgumentError.new('Invalid bank name')
|
83
83
|
end
|
84
|
-
|
85
84
|
end
|
86
85
|
end
|
data/lib/bank_scrap/config.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module BankScrap
|
2
2
|
# Default format for money: 1.000,00 €
|
3
|
-
Money.default_formatting_rules = {symbol_position: :after}
|
3
|
+
Money.default_formatting_rules = { symbol_position: :after }
|
4
4
|
I18n.load_path += Dir.glob(File.expand_path('../locale/*.yml', __FILE__))
|
5
|
-
end
|
5
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module BankScrap
|
2
|
+
class Investment
|
3
|
+
include Utils::Inspectable
|
4
|
+
|
5
|
+
attr_accessor :bank, :id, :name, :balance, :currency, :investment
|
6
|
+
|
7
|
+
def initialize(params = {})
|
8
|
+
params.each { |key,value| send "#{key}=", value }
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def inspect_attributes
|
13
|
+
[
|
14
|
+
:id, :name, :balance, :currency, :investment
|
15
|
+
]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -2,11 +2,11 @@ en:
|
|
2
2
|
number:
|
3
3
|
currency:
|
4
4
|
format:
|
5
|
-
delimiter:
|
6
|
-
format:
|
7
|
-
negative_format:
|
5
|
+
delimiter: '.'
|
6
|
+
format: '%n %u'
|
7
|
+
negative_format: '-%n %u'
|
8
8
|
precision: 2
|
9
|
-
separator:
|
9
|
+
separator: ','
|
10
10
|
significant: false
|
11
11
|
strip_insignificant_zeros: false
|
12
|
-
unit:
|
12
|
+
unit: '€'
|
@@ -7,11 +7,11 @@ module BankScrap
|
|
7
7
|
:balance, :account
|
8
8
|
|
9
9
|
def initialize(params = {})
|
10
|
-
params.each{ |key, value| send "#{key}=", value }
|
10
|
+
params.each { |key, value| send "#{key}=", value }
|
11
11
|
end
|
12
12
|
|
13
13
|
def to_s
|
14
|
-
"#{effective_date.strftime(
|
14
|
+
"#{effective_date.strftime('%d/%m/%Y')} #{description.ljust(45)} #{amount.format.rjust(20)}"
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -2,17 +2,17 @@ module BankScrap
|
|
2
2
|
module Utils
|
3
3
|
module Inspectable
|
4
4
|
def inspect
|
5
|
-
attributes = inspect_attributes.reject
|
5
|
+
attributes = inspect_attributes.reject do |x|
|
6
6
|
begin
|
7
7
|
attribute = send x
|
8
8
|
!attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
|
9
9
|
rescue NoMethodError
|
10
10
|
true
|
11
11
|
end
|
12
|
-
|
12
|
+
end.map do |attribute|
|
13
13
|
"#{attribute.to_s}: #{send(attribute).inspect}"
|
14
|
-
|
15
|
-
"#<#{self.class.name}:#{sprintf(
|
14
|
+
end.join ' '
|
15
|
+
"#<#{self.class.name}:#{sprintf('0x%x', object_id)} #{attributes}>"
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/bank_scrap/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bank_scrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Sánchez
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -168,18 +168,11 @@ dependencies:
|
|
168
168
|
description: Command line tools to get bank account details from some banks.
|
169
169
|
email:
|
170
170
|
- root@ismagnu.com
|
171
|
-
executables:
|
172
|
-
- bank_scrap
|
171
|
+
executables: []
|
173
172
|
extensions: []
|
174
173
|
extra_rdoc_files: []
|
175
174
|
files:
|
176
|
-
- ".gitignore"
|
177
|
-
- Gemfile
|
178
|
-
- LICENSE.txt
|
179
175
|
- README.md
|
180
|
-
- Rakefile
|
181
|
-
- bank_scrap.gemspec
|
182
|
-
- bin/bank_scrap
|
183
176
|
- lib/bank_scrap.rb
|
184
177
|
- lib/bank_scrap/account.rb
|
185
178
|
- lib/bank_scrap/bank.rb
|
@@ -198,11 +191,12 @@ files:
|
|
198
191
|
- lib/bank_scrap/banks/ing/numbers/9.png
|
199
192
|
- lib/bank_scrap/cli.rb
|
200
193
|
- lib/bank_scrap/config.rb
|
194
|
+
- lib/bank_scrap/investment.rb
|
201
195
|
- lib/bank_scrap/locale/en.yml
|
202
196
|
- lib/bank_scrap/transaction.rb
|
203
197
|
- lib/bank_scrap/utils/inspectable.rb
|
204
198
|
- lib/bank_scrap/version.rb
|
205
|
-
homepage: https://github.com/
|
199
|
+
homepage: https://github.com/bank-scrap/bank_scrap
|
206
200
|
licenses:
|
207
201
|
- MIT
|
208
202
|
metadata: {}
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 TODO: Write your name
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
data/bank_scrap.gemspec
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'bank_scrap/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "bank_scrap"
|
8
|
-
spec.version = BankScrap::VERSION
|
9
|
-
spec.authors = ["Ismael Sánchez", "Javier Cuevas", "Fernando Blat", "Raúl Marcos"]
|
10
|
-
spec.email = ["root@ismagnu.com"]
|
11
|
-
spec.summary = %q{Get your bank account details.}
|
12
|
-
spec.description = %q{Command line tools to get bank account details from some banks.}
|
13
|
-
spec.homepage = "https://github.com/ismaGNU/bank_scrap"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.required_ruby_version = '~> 2.1'
|
22
|
-
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
-
spec.add_development_dependency 'byebug', '~> 3.5', '>= 3.5.1'
|
26
|
-
|
27
|
-
spec.add_dependency 'thor', "~> 0.19"
|
28
|
-
spec.add_dependency 'nokogiri', "~> 1.6"
|
29
|
-
spec.add_dependency 'execjs', "~> 2.2"
|
30
|
-
spec.add_dependency 'mechanize', "~> 2.7.3"
|
31
|
-
spec.add_dependency 'activesupport', "~> 4.1"
|
32
|
-
spec.add_dependency 'rmagick', '~> 2.2', '>= 2.2.2'
|
33
|
-
spec.add_dependency 'money', '~> 6.5.0'
|
34
|
-
end
|