bank_scrap 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bank_scrap/banks/bankinter.rb +1 -1
- data/lib/bank_scrap/banks/bbva.rb +1 -1
- data/lib/bank_scrap/cli.rb +32 -25
- data/lib/bank_scrap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e07ddabb163c0283055e9b48996e8a03bff8db6
|
4
|
+
data.tar.gz: d0bc91897c4c607e61de130ca32ac10118140283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67cd5e951a7701884e44fc40990b9f7d17afdc84e0928c496f7789b057b9c09a27667452dc364b5f96e575e943c6db4bcdb8ff01d78a154933551de3ee5063d6
|
7
|
+
data.tar.gz: 086880bb1048f771821aa16e63620e6c509e4574dd5aac83e497ce8066aeaba76f796d99f133991c2b5c0eadb2436b691a4a888eacd356c62ff720a5940405af
|
@@ -7,7 +7,7 @@ module BankScrap
|
|
7
7
|
BASE_ENDPOINT = "https://movil.bankinter.es"
|
8
8
|
LOGIN_ENDPOINT = "/mov/es-es/cgi/ebkmovil+md+login"
|
9
9
|
|
10
|
-
def initialize(user, password, log: false, debug: false)
|
10
|
+
def initialize(user, password, log: false, debug: false, extra_args: nil)
|
11
11
|
@user = user
|
12
12
|
@password = password
|
13
13
|
@log = log
|
@@ -7,7 +7,7 @@ module BankScrap
|
|
7
7
|
BALANCE_ENDPOINT = '/ENPP/enpp_mult_web_mobility_02/products/v1'
|
8
8
|
USER_AGENT = 'Android;LGE;Nexus 5;1080x1776;Android;4.4.4;BMES;4.0.4'
|
9
9
|
|
10
|
-
def initialize(user, password, log: false, debug: false)
|
10
|
+
def initialize(user, password, log: false, debug: false, extra_args: nil)
|
11
11
|
@user = format_user(user.dup)
|
12
12
|
@password = password
|
13
13
|
@log = log
|
data/lib/bank_scrap/cli.rb
CHANGED
@@ -3,48 +3,55 @@ require 'active_support/core_ext/string'
|
|
3
3
|
|
4
4
|
module BankScrap
|
5
5
|
class Cli < Thor
|
6
|
+
def self.shared_options
|
7
|
+
option :user, default: ENV['BANK_SCRAP_USER']
|
8
|
+
option :password, default: ENV['BANK_SCRAP_PASSWORD']
|
9
|
+
option :log, default: false
|
10
|
+
option :debug, default: false
|
11
|
+
|
12
|
+
# Some bank needs more input, like birthday, this would go here
|
13
|
+
# Usage:
|
14
|
+
# bank_scrap balance BANK_NAME --extra=birthday:01/12/1980
|
15
|
+
option :extra, type: :hash
|
16
|
+
end
|
6
17
|
|
7
18
|
desc "balance BANK", "get account's balance"
|
8
|
-
|
9
|
-
option :password, default: ENV['BANK_SCRAP_PASSWORD']
|
10
|
-
option :log, default: false
|
11
|
-
option :debug, default: false
|
19
|
+
shared_options
|
12
20
|
def balance(bank)
|
13
|
-
|
14
|
-
|
15
|
-
@log = options[:log]
|
16
|
-
@debug = options[:debug]
|
17
|
-
|
18
|
-
bank_class = find_bank_class_for(bank)
|
19
|
-
@client = bank_class.new(@user, @password, log: @log, debug: @debug)
|
21
|
+
assign_shared_options
|
22
|
+
initialize_client_for(bank)
|
20
23
|
|
21
|
-
|
22
|
-
puts "Balance: #{balance}"
|
24
|
+
say "Balance: #{@client.get_balance}", :green
|
23
25
|
end
|
24
26
|
|
25
27
|
desc "transactions BANK", "get account's transactions"
|
26
|
-
|
27
|
-
option :password, default: ENV['BANK_SCRAP_PASSWORD']
|
28
|
-
option :log, default: false
|
29
|
-
option :debug, default: false
|
28
|
+
shared_options
|
30
29
|
def transactions(bank)
|
31
|
-
|
32
|
-
|
33
|
-
@log = options[:log]
|
34
|
-
@debug = options[:debug]
|
35
|
-
|
36
|
-
bank_class = find_bank_class_for(bank)
|
37
|
-
@client = bank_class.new(@user, @password, log: @log, debug: @debug)
|
38
|
-
|
30
|
+
assign_shared_options
|
31
|
+
initialize_client_for(bank)
|
39
32
|
transactions = @client.get_transactions
|
40
33
|
end
|
41
34
|
|
42
35
|
private
|
36
|
+
|
37
|
+
def assign_shared_options
|
38
|
+
@user = options[:user]
|
39
|
+
@password = options[:password]
|
40
|
+
@log = options[:log]
|
41
|
+
@debug = options[:debug]
|
42
|
+
@extra_args = options[:extra]
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize_client_for(bank_name)
|
46
|
+
bank_class = find_bank_class_for(bank_name)
|
47
|
+
@client = bank_class.new(@user, @password, log: @log, debug: @debug, extra_args: @extra_args)
|
48
|
+
end
|
43
49
|
|
44
50
|
def find_bank_class_for(bank_name)
|
45
51
|
Object.const_get("BankScrap::" + bank_name.classify)
|
46
52
|
rescue NameError
|
47
53
|
raise ArgumentError.new('Invalid bank name')
|
48
54
|
end
|
55
|
+
|
49
56
|
end
|
50
57
|
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.5
|
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: 2014-11-
|
14
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|