boq_com_au 0.4.1 → 0.5.1
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/CHANGELOG +19 -0
- data/README.md +2 -1
- data/boq_com_au.gemspec +1 -1
- data/lib/BoqComAu/Account.rb +2 -18
- data/lib/BoqComAu/VERSION.rb +1 -1
- data/test/BoqComAu/Account_test.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a51ff6b8ec0798bb6b8f4f87fe886c4bf8bc4caa01426574c3f087112a77d98d
|
|
4
|
+
data.tar.gz: 719743f285019db673f69fcaf9fe091996071cefa35a613b7d227553f9d1457f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0535d93ec7097e5b7781318a1d37270d6a9eacb2aa584ebd4098fd1baf199efe62bfbd4bbe5a0072206312f3e17ba8cf781032e1eaef560dfff70f9f522a1a81
|
|
7
|
+
data.tar.gz: 1424c6752bb7a2382f399278940c20e28dbc2e144bcd3d6fec9903c020019fc9d5e52e3067a116d57d0c4976d581dbdcb65e4ed76566f5a464806e08faee243b
|
data/CHANGELOG
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
# boq_com_au/CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 20261116
|
|
4
|
+
|
|
5
|
+
0.5.1: - BoqComAu::Account#login, #validate_args: Now uses superclass WebAccount.
|
|
6
|
+
|
|
7
|
+
1. ~ boq_com_au.gemspec: webaccount /'~> 0.9'/'~> 0.10'/
|
|
8
|
+
2. - BoqComAu::Account#login, WebAccount 0.10.0's naming every missing value at once.
|
|
9
|
+
3. - BoqComAu::Account#validate_args, WebAccount 0.10.0's being inherited.
|
|
10
|
+
4. ~ Account.rb's notes: login is WebAccount's.
|
|
11
|
+
5. ~ BoqComAu::VERSION: /0.5.0/0.5.1/
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
## 20261115
|
|
4
15
|
|
|
16
|
+
0.5.0: ~ BoqComAu::Account::PAGE_SELECTORS: /logged_out_xpath/logged_out_selector/, as WebAccount 0.9.0's.
|
|
17
|
+
|
|
18
|
+
1. ~ boq_com_au.gemspec: webaccount /'~> 0.8'/'~> 0.9'/
|
|
19
|
+
2. ~ BoqComAu::Account::PAGE_SELECTORS: /logged_out_xpath: '...'/logged_out_selector: {xpath: '...'}/, logged_out_xpath going in WebAccount 0.10.0.
|
|
20
|
+
3. ~ test/BoqComAu/Account_test.rb: The logged-out selector is BOQ's where none is given, and one set after construction wins over it.
|
|
21
|
+
4. ~ README.md: The setters win over PAGE_SELECTORS, as the keywords do.
|
|
22
|
+
5. ~ BoqComAu::VERSION: /0.4.1/0.5.0/
|
|
23
|
+
|
|
5
24
|
0.4.1: ~ BoqComAu::Account#login and #download_transactions name every argument missing at once, as an ArgumentError.
|
|
6
25
|
|
|
7
26
|
1. + BoqComAu::Account#validate_args
|
data/README.md
CHANGED
|
@@ -79,9 +79,10 @@ Where BOQ asks for a one-time code after logging on, `login` waits up to 30 seco
|
|
|
79
79
|
|
|
80
80
|
The selectors were taken from the live site. BOQ's ids are generated, so things are found by their labels and text, and a change to the wording of the site will break it.
|
|
81
81
|
|
|
82
|
-
Each key of `BoqComAu::Account::PAGE_SELECTORS` is also a keyword of `new`, which wins over BOQ's, so as a
|
|
82
|
+
Each key of `BoqComAu::Account::PAGE_SELECTORS` is also a keyword of `new`, and has a setter, either of which wins over BOQ's, so as a selector which has changed can be given without waiting for a new version:
|
|
83
83
|
```ruby
|
|
84
84
|
BoqComAu::Account.new(login_page_submit_button_selector: {id: 'btnLogOn'})
|
|
85
|
+
boq_account.logged_out_selector = {id: 'btnLogOn'}
|
|
85
86
|
```
|
|
86
87
|
|
|
87
88
|
The tests cover only what doesn't depend on BOQ's site.
|
data/boq_com_au.gemspec
CHANGED
data/lib/BoqComAu/Account.rb
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# 4. Dropdowns are drawn by Chosen, a JavaScript library, which hides the select and draws its own: <select id>_chosen, opened by its a.chosen-single and chosen from its li.active-result. A select which is displayed is used as it is.
|
|
9
9
|
# 5. Where a one-time code is asked for after logging on, login() waits default_wait_timeout seconds for it to be entered by hand.
|
|
10
10
|
# 6. The browser, Chrome or Firefox, is WebAccount's: given a profile_directory, it's started with that profile, kept between runs, so as the bank sees a returning browser rather than a fresh automated one. It downloads into download_directory without asking, and opens nothing it downloads.
|
|
11
|
-
# 7.
|
|
11
|
+
# 7. login is WebAccount's, which stops before the browser is started where a username or password isn't given, naming every one missing.
|
|
12
12
|
# 8. BOQ names the exported file after the account number and the date, as 12345678_20261103.csv, and the browser numbers a second download of the same name; so the newest finished CSV file to appear in download_directory once Download is clicked is taken to be it.
|
|
13
13
|
# 9. Dates are BOQ's own, as shown on choosing the account, unless a period or a date is given; then they're set under Advanced Search and searched on before exporting.
|
|
14
14
|
|
|
@@ -23,7 +23,7 @@ module BoqComAu
|
|
|
23
23
|
login_page_password_field_selector: {xpath: '//input[@id=//label[normalize-space()="Password"]/@for]'},
|
|
24
24
|
login_page_submit_button_selector: {id: 'btnSignIn'},
|
|
25
25
|
logout_button_selector: {xpath: '//a[contains(translate(normalize-space(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"), "log off")]'},
|
|
26
|
-
|
|
26
|
+
logged_out_selector: {xpath: '//a[normalize-space()="Log On Again"] | //input[@id="btnSignIn"]'}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
TRANSACTIONS_SELECTORS = {
|
|
@@ -37,11 +37,6 @@ module BoqComAu
|
|
|
37
37
|
download_button: {xpath: '//*[self::a or self::button][normalize-space()="Download"] | //input[@value="Download"]'}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
def login(username: nil, password: nil)
|
|
41
|
-
validate_args(username: username || self.username, password: password || self.password)
|
|
42
|
-
super
|
|
43
|
-
end
|
|
44
|
-
|
|
45
40
|
# period is :all, the last year, or :last_month. Without it, from_date and to_date, either of which defaults to a year ago and today respectively where the other is given. Returns the name of the CSV file downloaded.
|
|
46
41
|
def download_transactions(account_number:, period: nil, from_date: nil, to_date: nil)
|
|
47
42
|
validate_args(account_number: account_number)
|
|
@@ -57,17 +52,6 @@ module BoqComAu
|
|
|
57
52
|
|
|
58
53
|
private
|
|
59
54
|
|
|
60
|
-
def validate_args(args)
|
|
61
|
-
missing_args = []
|
|
62
|
-
args.each do |arg_name, value|
|
|
63
|
-
missing_args << arg_name unless value
|
|
64
|
-
end
|
|
65
|
-
return if missing_args.empty?
|
|
66
|
-
aggregate_error = missing_args.join(', ')
|
|
67
|
-
copula = missing_args.count > 1 ? 'are' : 'is'
|
|
68
|
-
raise ArgumentError, "#{aggregate_error} #{copula} missing."
|
|
69
|
-
end
|
|
70
|
-
|
|
71
55
|
# page interaction
|
|
72
56
|
|
|
73
57
|
def chosen_list(select_element)
|
data/lib/BoqComAu/VERSION.rb
CHANGED
|
@@ -164,6 +164,13 @@ describe BoqComAu::Account do
|
|
|
164
164
|
account = BoqComAu::Account.new
|
|
165
165
|
_(account.send(:login_page_username_field_selector)).must_equal(BoqComAu::Account::PAGE_SELECTORS[:login_page_username_field_selector])
|
|
166
166
|
_(account.send(:logout_button_selector)).must_equal(BoqComAu::Account::PAGE_SELECTORS[:logout_button_selector])
|
|
167
|
+
_(account.logged_out_selector).must_equal({xpath: '//a[normalize-space()="Log On Again"] | //input[@id="btnSignIn"]'})
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
it "uses a selector set after construction over BOQ's" do
|
|
171
|
+
account = BoqComAu::Account.new
|
|
172
|
+
account.logged_out_selector = {id: 'btnLogOn'}
|
|
173
|
+
_(account.logged_out_selector).must_equal({id: 'btnLogOn'})
|
|
167
174
|
end
|
|
168
175
|
|
|
169
176
|
it "logs in where told to, a keyword winning over BOQ's selector" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: boq_com_au
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0.
|
|
32
|
+
version: '0.10'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0.
|
|
39
|
+
version: '0.10'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: minitest
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|