bank_scrap 0.0.16 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/.DS_Store +0 -0
- data/lib/bank_scrap/bank.rb +4 -4
- data/lib/bank_scrap/banks/bankinter.rb +4 -4
- data/lib/bank_scrap/banks/bbva.rb +6 -7
- data/lib/bank_scrap/banks/ing.rb +5 -4
- data/lib/bank_scrap/version.rb +1 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c43404e6ea53ff9f5830c75d486b8efcb0d64de0
|
4
|
+
data.tar.gz: c6b6b0c3d48789cfe2831c1b1e5ef1875417702b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5117b075b4e4a29e9f4103d0559a75a073c8770c355bf3b61f39e719ea7f9b2ffb7d8324d5beeab9714ff44cf7813a7c6bef36fe3881f88fa64bc4b87fb601
|
7
|
+
data.tar.gz: 028c67e7eb149676153f0d414ee75578bcc1b804ab7aff0f40e8bdf5b2b33226657e9345fab6adf10182c1c35961cc5341968ba4f3e6c3a324a34fc9497910bd
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ We are developers and we don't want to waste time doing things we are able to au
|
|
23
23
|
|
24
24
|
There are two approaches to solve this problem:
|
25
25
|
- Web scraping on the bank's site.
|
26
|
-
- Reverse engineering the bank's mobile app to use the same API
|
26
|
+
- Reverse engineering the bank's mobile app or the bank's single page web app (if they have one) to use the same API.
|
27
27
|
|
28
28
|
BankScrap uses both methods depending on the bank.
|
29
29
|
|
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/bank_scrap/bank.rb
CHANGED
@@ -32,15 +32,15 @@ module BankScrap
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
def get(url, params
|
36
|
-
@http.get(url, params).body
|
35
|
+
def get(url, params: [], referer: nil)
|
36
|
+
@http.get(url, params, referer, @headers).body
|
37
37
|
end
|
38
38
|
|
39
|
-
def post(url, fields)
|
39
|
+
def post(url, fields: {})
|
40
40
|
@http.post(url, fields, @headers).body
|
41
41
|
end
|
42
42
|
|
43
|
-
def put(url, fields)
|
43
|
+
def put(url, fields: {})
|
44
44
|
@http.put(url, fields, @headers).body
|
45
45
|
end
|
46
46
|
|
@@ -65,7 +65,7 @@ module BankScrap
|
|
65
65
|
'anioH' => end_date.strftime("%Y"),
|
66
66
|
}
|
67
67
|
|
68
|
-
response = post(BASE_ENDPOINT + TRANSACTIONS_ENDPOINT, fields)
|
68
|
+
response = post(BASE_ENDPOINT + TRANSACTIONS_ENDPOINT, fields: fields)
|
69
69
|
|
70
70
|
html_doc = Nokogiri::HTML(response)
|
71
71
|
|
@@ -93,7 +93,7 @@ module BankScrap
|
|
93
93
|
@login_field => @login_param
|
94
94
|
}
|
95
95
|
|
96
|
-
response = post(BASE_ENDPOINT + LOGIN_ENDPOINT, fields)
|
96
|
+
response = post(BASE_ENDPOINT + LOGIN_ENDPOINT, fields: fields)
|
97
97
|
|
98
98
|
response = get(BASE_ENDPOINT + '/www/es-es/cgi/ebk+opr+extractointegral')
|
99
99
|
|
@@ -131,7 +131,7 @@ module BankScrap
|
|
131
131
|
currency: data['currency'],
|
132
132
|
description: data['description'],
|
133
133
|
iban: data['iban']
|
134
|
-
)
|
134
|
+
)
|
135
135
|
end
|
136
136
|
|
137
137
|
def build_transaction(data, account)
|
@@ -147,6 +147,6 @@ module BankScrap
|
|
147
147
|
currency: data['currency'],
|
148
148
|
balance: balance
|
149
149
|
)
|
150
|
-
end
|
150
|
+
end
|
151
151
|
end
|
152
152
|
end
|
@@ -2,12 +2,12 @@ require 'json'
|
|
2
2
|
|
3
3
|
module BankScrap
|
4
4
|
class Bbva < Bank
|
5
|
-
BASE_ENDPOINT = 'https://
|
5
|
+
BASE_ENDPOINT = 'https://servicios.bbva.es'
|
6
6
|
LOGIN_ENDPOINT = '/DFAUTH/slod/DFServletXML'
|
7
7
|
PRODUCTS_ENDPOINT = '/ENPP/enpp_mult_web_mobility_02/products/v1'
|
8
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 = '12345;Android;LGE;Nexus 5;1080x1776;Android;
|
10
|
+
USER_AGENT = '12345;Android;LGE;Nexus 5;1080x1776;Android;5.1.1;BMES;4.4;xxhd'
|
11
11
|
|
12
12
|
def initialize(user, password, log: false, debug: false, extra_args: nil)
|
13
13
|
@user = format_user(user.dup)
|
@@ -42,7 +42,7 @@ module BankScrap
|
|
42
42
|
# the API requires a funny header that says is a GET
|
43
43
|
# otherwise the request doesn't work.
|
44
44
|
response = with_headers('BBVA-Method' => 'GET') do
|
45
|
-
post(BASE_ENDPOINT + PRODUCTS_ENDPOINT
|
45
|
+
post(BASE_ENDPOINT + PRODUCTS_ENDPOINT)
|
46
46
|
end
|
47
47
|
|
48
48
|
json = JSON.parse(response)
|
@@ -83,7 +83,7 @@ module BankScrap
|
|
83
83
|
loop do
|
84
84
|
new_url = offset ? (url + "&offset=#{offset}") : url
|
85
85
|
new_url = pagination_balance ? (new_url + "&paginationBalance=#{pagination_balance}") : new_url
|
86
|
-
json = JSON.parse(post(new_url
|
86
|
+
json = JSON.parse(post(new_url))
|
87
87
|
|
88
88
|
unless json['movements'].blank?
|
89
89
|
# As explained before, we have to discard records newer than end_date.
|
@@ -126,10 +126,9 @@ module BankScrap
|
|
126
126
|
'origen' => 'enpp',
|
127
127
|
'eai_tipoCP' => 'up',
|
128
128
|
'eai_user' => @user,
|
129
|
-
'eai_password' => @password
|
130
|
-
'eai_URLDestino' => '/ENPP/enpp_mult_web_mobility_02/sessions/v1'
|
129
|
+
'eai_password' => @password
|
131
130
|
}
|
132
|
-
post(BASE_ENDPOINT + LOGIN_ENDPOINT, params)
|
131
|
+
post(BASE_ENDPOINT + LOGIN_ENDPOINT, fields: params)
|
133
132
|
end
|
134
133
|
|
135
134
|
# Build an Account object from API data
|
data/lib/bank_scrap/banks/ing.rb
CHANGED
@@ -81,7 +81,7 @@ module BankScrap
|
|
81
81
|
|
82
82
|
transactions = []
|
83
83
|
loop do
|
84
|
-
request = get("#{PRODUCTS_ENDPOINT}/#{account.id}/movements", params)
|
84
|
+
request = get("#{PRODUCTS_ENDPOINT}/#{account.id}/movements", params: params)
|
85
85
|
json = JSON.parse(request)
|
86
86
|
transactions += (json['elements'] || []).map do |transaction|
|
87
87
|
build_transaction(transaction, account)
|
@@ -116,7 +116,7 @@ module BankScrap
|
|
116
116
|
device: 'desktop'
|
117
117
|
}
|
118
118
|
|
119
|
-
response = JSON.parse(post(LOGIN_ENDPOINT, params.to_json))
|
119
|
+
response = JSON.parse(post(LOGIN_ENDPOINT, fields: params.to_json))
|
120
120
|
current_pinpad_paths = save_pinpad_numbers(response['pinpad'])
|
121
121
|
pinpad_numbers = recognize_pinpad_numbers(current_pinpad_paths)
|
122
122
|
|
@@ -124,7 +124,8 @@ module BankScrap
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def pass_pinpad(positions)
|
127
|
-
|
127
|
+
fields = { pinPositions: positions }
|
128
|
+
response = put(LOGIN_ENDPOINT, fields: fields.to_json)
|
128
129
|
JSON.parse(response)['ticket']
|
129
130
|
end
|
130
131
|
|
@@ -135,7 +136,7 @@ module BankScrap
|
|
135
136
|
)
|
136
137
|
|
137
138
|
params = "ticket=#{ticket}&device=desktop"
|
138
|
-
post(POST_AUTH_ENDPOINT, params)
|
139
|
+
post(POST_AUTH_ENDPOINT, fields: params)
|
139
140
|
end
|
140
141
|
|
141
142
|
def save_pinpad_numbers(pinpad)
|
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.19
|
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:
|
14
|
+
date: 2016-04-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -165,7 +165,8 @@ dependencies:
|
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: 6.5.0
|
168
|
-
description:
|
168
|
+
description: 'WARNING: This gem has been deprecated and has been replaced by ''bankscrap''
|
169
|
+
(without underscore)'
|
169
170
|
email:
|
170
171
|
- root@ismagnu.com
|
171
172
|
executables:
|
@@ -175,6 +176,7 @@ extra_rdoc_files: []
|
|
175
176
|
files:
|
176
177
|
- README.md
|
177
178
|
- bin/bank_scrap
|
179
|
+
- lib/.DS_Store
|
178
180
|
- lib/bank_scrap.rb
|
179
181
|
- lib/bank_scrap/account.rb
|
180
182
|
- lib/bank_scrap/bank.rb
|
@@ -198,11 +200,14 @@ files:
|
|
198
200
|
- lib/bank_scrap/transaction.rb
|
199
201
|
- lib/bank_scrap/utils/inspectable.rb
|
200
202
|
- lib/bank_scrap/version.rb
|
201
|
-
homepage: https://github.com/
|
203
|
+
homepage: https://github.com/bankscrap/bankscrap
|
202
204
|
licenses:
|
203
205
|
- MIT
|
204
206
|
metadata: {}
|
205
|
-
post_install_message:
|
207
|
+
post_install_message: |2
|
208
|
+
! WARNING: This gem has been deprecated and has been replaced by 'bankscrap' (without underscore)
|
209
|
+
! See: https://rubygems.org/gems/bankscrap
|
210
|
+
! And: https://github.com/bankscrap/bankscrap
|
206
211
|
rdoc_options: []
|
207
212
|
require_paths:
|
208
213
|
- lib
|
@@ -218,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
223
|
version: '0'
|
219
224
|
requirements: []
|
220
225
|
rubyforge_project:
|
221
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.6.4
|
222
227
|
signing_key:
|
223
228
|
specification_version: 4
|
224
229
|
summary: Get your bank account details.
|