bank_api 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bank_api/clients/banco_de_chile_company_client.rb +19 -7
- data/lib/bank_api/clients/base_client.rb +2 -2
- data/lib/bank_api/version.rb +1 -1
- data/lib/bank_api.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ee63798e44803986aa2a2a9428500311aaddf896d9d9d0dd537b12705be2cfe
|
4
|
+
data.tar.gz: d2449dd880b2056573e3977aefc1610e82e5a8f59a1f66814aa9f7bcb4377c41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e2cbbff9ffd1e26903c8c79566b141761460d5b4190ca05be78d6e6e71b92a4ac9122ac318380bb0dd72598f50cc496c018e3ff725c3b83addc5c8bdcc2641
|
7
|
+
data.tar.gz: 17a5e5827d454eec7f0e892a1173b117ab39acac44625a50779fe8569485bad294bdfa317de5b8ac4e32ebbb005af667b185eb4ad8ff214eb860afdc97467b35
|
data/Gemfile.lock
CHANGED
@@ -39,21 +39,27 @@ module BankApi::Clients
|
|
39
39
|
].any?(&:nil?)
|
40
40
|
end
|
41
41
|
|
42
|
-
def get_balance
|
42
|
+
def get_balance(account_number)
|
43
43
|
login
|
44
44
|
goto_balance
|
45
|
-
select_account
|
45
|
+
select_account(account_number)
|
46
46
|
click_fetch_balance_button
|
47
|
-
|
47
|
+
{
|
48
|
+
account_number: account_number,
|
49
|
+
available_balance: money_to_i(read_balance(:available)),
|
50
|
+
countable_balance: money_to_i(read_balance(:countable))
|
51
|
+
}
|
52
|
+
ensure
|
53
|
+
browser.close
|
48
54
|
end
|
49
55
|
|
50
56
|
def goto_balance
|
51
57
|
browser.goto COMPANY_CC_BALANCE_URL
|
52
58
|
end
|
53
59
|
|
54
|
-
def select_account
|
60
|
+
def select_account(account_number)
|
55
61
|
first_account = browser.search("select[name=cuenta] option").find do |account|
|
56
|
-
account.value.include?
|
62
|
+
account.value.include? account_number
|
57
63
|
end.value
|
58
64
|
browser.search("select[name=cuenta]").set by_value: first_account
|
59
65
|
end
|
@@ -66,8 +72,14 @@ module BankApi::Clients
|
|
66
72
|
text.delete(".").delete("$").delete(" ").to_i
|
67
73
|
end
|
68
74
|
|
69
|
-
def read_balance
|
70
|
-
|
75
|
+
def read_balance(balance_kind)
|
76
|
+
return '' unless [:available, :countable].include? balance_kind
|
77
|
+
|
78
|
+
if balance_kind == :available
|
79
|
+
return browser.search('table.detalleSaldosMov tr:nth-child(2) > td.aRight.bold').text
|
80
|
+
end
|
81
|
+
|
82
|
+
browser.search('table.detalleSaldosMov tr:first-child > td.aRight.bold').text
|
71
83
|
end
|
72
84
|
|
73
85
|
def get_deposits(_options = {})
|
@@ -16,9 +16,9 @@ module BankApi::Clients
|
|
16
16
|
parse_entries(get_deposits(options))
|
17
17
|
end
|
18
18
|
|
19
|
-
def get_account_balance
|
19
|
+
def get_account_balance(account_number)
|
20
20
|
validate_credentials
|
21
|
-
get_balance
|
21
|
+
get_balance(account_number)
|
22
22
|
end
|
23
23
|
|
24
24
|
def transfer(transfer_data)
|
data/lib/bank_api/version.rb
CHANGED
data/lib/bank_api.rb
CHANGED
@@ -25,8 +25,8 @@ module BankApi
|
|
25
25
|
Clients::BancoDeChileCompanyClient.new(configuration).get_recent_deposits
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.
|
29
|
-
Clients::BancoDeChileCompanyClient.new(configuration).get_account_balance
|
28
|
+
def self.get_bdc_account_balance(account_number)
|
29
|
+
Clients::BancoDeChileCompanyClient.new(configuration).get_account_balance(account_number)
|
30
30
|
end
|
31
31
|
|
32
32
|
module BancoSecurity
|