nab_com_au 0.3.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70ea8fa4c1c09b78411479f27506c76c59d7c15764e67874072663ca1b61c8c5
4
- data.tar.gz: f87968139f9f86b91b2c69ef479eddbff9962a08fb764a65ee90af1e68d1cd55
3
+ metadata.gz: f4e51b12e8c983e791870b45d69458bd80d82d38f5b1ed8c101a9cc498bf383e
4
+ data.tar.gz: abed326edc44d32d8a10e1bab6742afdd4d137e1c6d1aa014563619113e926e2
5
5
  SHA512:
6
- metadata.gz: ffbf27cde4c0b499ceb237e86f04f9d4f7cbd257f7878d6e2aea2ba7894c9d2ecfc4f5d31fd87599cdde0801e505d0d2ad7fa4599ed2f2c8848189da09b25951
7
- data.tar.gz: b3d103c9ce81e1a119f505f3a50ae4824d824712360cd46dbda918044346f00e6f55ff979f8f6f32065ba3a92c87556e17c8875fff7189cc5f2a37250ee0598c
6
+ metadata.gz: ffc30eb4f4abefda47e4811c0beb43a8b43371cce19270a23850c1f8d3ddf2b4595ab438b743486be52202d02f42b5bf6a9c0936125adac0e745d1d9b77b5126
7
+ data.tar.gz: eaac7048b7c822277ebb6cd368e976a0d60230fc5f5088b7141c9b6dc93df78033bccbd6fd121f0eccbf1fe2dc89cf086f173c3d6e06c63fc65d4b4133221e4f
data/CHANGELOG CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## 20261115
4
4
 
5
+ 0.3.1: ~ NabComAu::Account#login: Names every missing argument at once, by validate_args().
6
+
7
+ 1. ~ NabComAu::Account#login: validate_args(username:, password:), in place of raising upon each in turn.
8
+ 2. + NabComAu::Account#validate_args, moved from NabComAu::Bpay, which inherits it.
9
+ 3. ~ test/NabComAu/Account_test.rb: The messages for username or password missing, and for both, are tested.
10
+ 4. ~ NabComAu::VERSION: /0.3.0/0.3.1/
11
+
12
+
5
13
  0.3.0: - NabComAu::Account#initialize: Now uses superclass WebAccount; + nab_com_au.gemspec.
6
14
 
7
15
  1. - NabComAu::Account#initialize, WebAccount's taking the browser's options, such as browser:, profile_directory: and headless:, and reading PAGE_SELECTORS itself.
@@ -26,8 +26,9 @@ module NabComAu
26
26
 
27
27
  def login(username: nil, password: nil)
28
28
  @logged_in = false
29
- username ||= self.username or raise ArgumentError, "Can't log in without username:."
30
- password ||= self.password or raise ArgumentError, "Can't log in without password:."
29
+ username ||= self.username
30
+ password ||= self.password
31
+ validate_args(username: username, password: password)
31
32
  driver.attempt do
32
33
  get_login_page
33
34
  sleep 1
@@ -61,5 +62,18 @@ module NabComAu
61
62
  transfer.driver = driver
62
63
  transfer.pay
63
64
  end
65
+
66
+ private
67
+
68
+ def validate_args(args)
69
+ missing_args = []
70
+ args.each do |arg_name, value|
71
+ missing_args << arg_name unless value
72
+ end
73
+ return if missing_args.empty?
74
+ aggregate_error = missing_args.join(', ')
75
+ copula = missing_args.count > 1 ? 'are' : 'is'
76
+ raise ArgumentError, "#{aggregate_error} #{copula} missing."
77
+ end
64
78
  end
65
79
  end
data/lib/NabComAu/Bpay.rb CHANGED
@@ -205,18 +205,5 @@ module NabComAu
205
205
  new_bill_payment_confirmation(password: password)
206
206
  sleep 1
207
207
  end
208
-
209
- private
210
-
211
- def validate_args(args)
212
- missing_args = []
213
- args.each do |arg_name, value|
214
- missing_args << arg_name unless value
215
- end
216
- return if missing_args.empty?
217
- aggregate_error = missing_args.join(', ')
218
- copula = missing_args.count > 1 ? 'are' : 'is'
219
- raise ArgumentError, "#{aggregate_error} #{copula} missing."
220
- end
221
208
  end
222
209
  end
@@ -2,5 +2,5 @@
2
2
  # NabComAu::VERSION
3
3
 
4
4
  module NabComAu
5
- VERSION = '0.3.0'
5
+ VERSION = '0.3.1'
6
6
  end
@@ -71,14 +71,19 @@ describe NabComAu::Account do
71
71
  end
72
72
 
73
73
  describe "#login" do
74
- it "says username: is missing, before using the browser" do
74
+ it "says username is missing, before using the browser" do
75
75
  error = _{account(password: 'password').login}.must_raise ArgumentError
76
- _(error.message).must_match(/username:/)
76
+ _(error.message).must_equal 'username is missing.'
77
77
  end
78
78
 
79
- it "says password: is missing, before using the browser" do
79
+ it "says password is missing, before using the browser" do
80
80
  error = _{account(username: 'username').login}.must_raise ArgumentError
81
- _(error.message).must_match(/password:/)
81
+ _(error.message).must_equal 'password is missing.'
82
+ end
83
+
84
+ it "says both are missing at once, before using the browser" do
85
+ error = _{account.login}.must_raise ArgumentError
86
+ _(error.message).must_equal 'username, password are missing.'
82
87
  end
83
88
  end
84
89
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nab_com_au
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran