aq_banking 0.2.3 → 0.2.4

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
  SHA1:
3
- metadata.gz: fb755fc3ecf19519221f888fbbff0eb89105db84
4
- data.tar.gz: c914bed545653e9feae6e2e565e0dc74ce8e813f
3
+ metadata.gz: 70d0bb8ab7a557647a25a06b7a73765cab0270ad
4
+ data.tar.gz: 378949a71c9fe792ce46a6211f263abc5d97b1b9
5
5
  SHA512:
6
- metadata.gz: a3b465c9fa966876670fefd120a3e74d3aacf08b1fdd7bb54c3c67e960429d650725376687dcac66f362b37216a53ffc9a485754eb7be6f3303961f5dc59fc22
7
- data.tar.gz: c458b092d76bd9805f6b80edb7a5f4f75d0eeaf7dac10a8cbb7f1cc4efaad77e65e24ce153965a31f073de79bce778455e3b7fe8fc3a5b974b0913c64287e66c
6
+ metadata.gz: c70c690ba8abaaf78102c6f8d60f7007d8d02ac0fa7adb3b84f76bd2b0445850b9fa50cbfb5e665ef3ef2f1067740a5329edbf16be9f4d7a65fde00491bd474c
7
+ data.tar.gz: 39ece253a7a92c3aaca0800e28a738204ac745e0a1df9fea4ad894b14b7cd54e433505251e7b61a044f791be9dd612f2ceeadf60f0e4d745c7384ff642aaf485
data/README.md CHANGED
@@ -34,8 +34,10 @@ $ aq_banking request --bank=diba BLZ ACCCOUNT_NUMBER LOGIN_ID PASSWORD --from=20
34
34
  }
35
35
  ```
36
36
 
37
- It still requires the aq_banking command line tools to be present.
38
- To avoid errors with versions etc, I recommend using the docker image:
37
+ It still requires the aq_banking command line tools (aqhbci-tool4, aqbanking-cli) to be present.
38
+ To my experience, these tools are very unstable and full of bugs.
39
+ This tool is developed using a specific version which ships with the docker image.
40
+ To avoid errors with different versions, I recommend using the docker image:
39
41
 
40
42
  docker run -it --rm rweng/aq_banking --help
41
43
  docker run -it --rm rweng/aq_banking request --bank=diba BLZ ACCCOUNT_NUMBER LOGIN_ID PASSWORD --from=2016-04-18
@@ -56,8 +56,8 @@ module AqBanking
56
56
  # ensure that no old password is in cache
57
57
  remove_user bank_code: bank_code, user_id: user_id
58
58
 
59
- add_account(server_url: server_url, hbci_version: hbci_version,
60
- bank_code: bank_code, user_id: user_id, user_name: user_name)
59
+ add_user(server_url: server_url, hbci_version: hbci_version,
60
+ bank_code: bank_code, user_id: user_id, user_name: user_name)
61
61
 
62
62
  call_getsysid pin_file: pin_file_path, user_id: user_id, bank_code: bank_code
63
63
 
@@ -77,7 +77,7 @@ module AqBanking
77
77
  # @param [String] bank_code
78
78
  # @param [String] user_id
79
79
  # @return [Boolean]
80
- def account_exists?(bank_code:, user_id:)
80
+ def user_exists?(bank_code:, user_id:)
81
81
  result = run "aqhbci-tool4 listusers"
82
82
  result.stdout.include?("Bank: de/#{bank_code} User Id: #{user_id}")
83
83
  end
@@ -90,10 +90,21 @@ module AqBanking
90
90
  def remove_user(bank_code:, user_id:)
91
91
  logger.debug 'removing user %p' % {bank_code: bank_code, user_id: user_id}
92
92
 
93
- run "aqhbci-tool4 deluser -u %p -b %p" % [user_id, bank_code]
93
+ # we must do this due to frickin aqhbci: the option --with-acccounts removes one account and if there are more
94
+ # an error is raised. on the other hand, aqhbci-tool4 listaccounts only shows bank_code and account number, but not
95
+ # user id. Refactorings to improve this are very welcome
96
+ count = 0
97
+ max_trials = 10
98
+ loop do
99
+ count = count + 1
100
+ result = run "aqhbci-tool4 deluser --with-accounts -u %p -b %p" % [user_id, bank_code]
101
+ break if result.stderr.include? 'ERROR: No matching users' or result.stdout.match /User %d+ deleted\./
102
+
103
+ raise 'could not delete user' if count >= max_trials
104
+ end
94
105
  end
95
106
 
96
- def add_account(server_url:, hbci_version:, bank_code:, user_id:, user_name: '')
107
+ def add_user(server_url:, hbci_version:, bank_code:, user_id:, user_name: '')
97
108
  logger.debug 'adding account %p' % {server_url: server_url, hbci_version: hbci_version, bank_code: bank_code, user_id: user_id, user_name: user_name}
98
109
 
99
110
  cmd = ""
@@ -1,3 +1,3 @@
1
1
  module AqBanking
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aq_banking
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Wenglewski