aq_banking 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +6 -0
- data/.gitignore +1 -0
- data/Dockerfile +3 -7
- data/README.md +63 -6
- data/docker-compose.yml +26 -0
- data/lib/aq_banking/cli.rb +17 -11
- data/lib/aq_banking/commander.rb +6 -3
- data/lib/aq_banking/version.rb +1 -1
- data/lib/aq_banking.rb +3 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef0811dfdb94ed0b563fdda4d5ab651b13e4839
|
4
|
+
data.tar.gz: 6f19b1ecbf90f90a5c34d6281c57e9c88b7df487
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7e9465feccb2285121a5c60818d609c6d80af4fade8cd611d176378015970c1a530eae35b2a91416011ff45efa587d8a01a8b6df66d398e56633037c5303b68
|
7
|
+
data.tar.gz: 57ceacef7efcb7573538f23281fcd5d5f80ad0331e6bf77dfb873a89945149aaea45419e0157d9b36ec085aa477320964ff087652fa082f1ad537279a3cd8a1e
|
data/.dockerignore
ADDED
data/.gitignore
CHANGED
data/Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
FROM ruby:2.
|
1
|
+
FROM ruby:2.3.0
|
2
2
|
MAINTAINER Robin Wenglewski, robin@wenglewski.de
|
3
3
|
|
4
4
|
RUN apt-get update -qq && apt-get install -y \
|
@@ -6,10 +6,6 @@ RUN apt-get update -qq && apt-get install -y \
|
|
6
6
|
aqbanking-tools \
|
7
7
|
ktoblzcheck
|
8
8
|
|
9
|
-
RUN
|
10
|
-
WORKDIR /gem
|
9
|
+
RUN gem install aq_banking
|
11
10
|
|
12
|
-
|
13
|
-
RUN bundle install
|
14
|
-
|
15
|
-
CMD bundle exec rspec
|
11
|
+
ENTRYPOINT ["aq_banking"]
|
data/README.md
CHANGED
@@ -3,8 +3,52 @@
|
|
3
3
|
[![Travis Status](https://travis-ci.org/rweng/aq_banking.svg)](https://travis-ci.org/rweng/aq_banking)
|
4
4
|
[![codecov.io](http://codecov.io/github/rweng/aq_banking/coverage.svg?branch=master)](http://codecov.io/github/rweng/aq_banking?branch=master)
|
5
5
|
|
6
|
+
|
7
|
+
This is a ruby library and command line tool to wrap around the more complex aqbanking cli tools.
|
8
|
+
|
9
|
+
Sample:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
$ aq_banking request --bank=diba BLZ ACCCOUNT_NUMBER LOGIN_ID PASSWORD --from=2016-04-18
|
13
|
+
{
|
14
|
+
"iban": "...",
|
15
|
+
"bic": "...",
|
16
|
+
"owner": "WENGLEWSKI, ROBIN",
|
17
|
+
"currency": "EUR",
|
18
|
+
"bank_code": "...",
|
19
|
+
"bank_name": "ING-DiBa",
|
20
|
+
"booked_balance": 123.45,
|
21
|
+
"noted_balance": 123.45,
|
22
|
+
"number": "...",
|
23
|
+
"name": "Girokonto",
|
24
|
+
"transactions": [
|
25
|
+
{
|
26
|
+
"amount": -22.0,
|
27
|
+
"currency": "EUR",
|
28
|
+
"date": "2016-04-18 12:00:00 UTC",
|
29
|
+
"valuta_date": "2016-04-18 12:00:00 UTC"
|
30
|
+
...
|
31
|
+
},
|
32
|
+
...
|
33
|
+
],
|
34
|
+
...
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
38
|
+
It still requires the aq_banking command line tools to be present.
|
39
|
+
To avoid errors with versions etc, I recommend using the docker image:
|
40
|
+
|
41
|
+
docker run -it --rm rweng/aq_banking --help
|
42
|
+
docker run -it --rm rweng/aq_banking request --bank=diba BLZ ACCCOUNT_NUMBER LOGIN_ID PASSWORD --from=2016-04-18
|
43
|
+
|
6
44
|
## Installation
|
7
45
|
|
46
|
+
### CLI
|
47
|
+
|
48
|
+
gem install aq_banking
|
49
|
+
|
50
|
+
### Ruby
|
51
|
+
|
8
52
|
Add this line to your application's Gemfile:
|
9
53
|
|
10
54
|
```ruby
|
@@ -15,15 +59,28 @@ And then execute:
|
|
15
59
|
|
16
60
|
$ bundle
|
17
61
|
|
18
|
-
##
|
62
|
+
## Usage
|
19
63
|
|
20
|
-
|
64
|
+
aq_banking --help
|
65
|
+
aq_banking request BLZ ACCCOUNT USER_ID PASSWORD --bank=diba
|
21
66
|
|
22
|
-
|
23
|
-
|
67
|
+
## Development
|
68
|
+
|
69
|
+
# log into container
|
70
|
+
docker-compose run dev
|
71
|
+
|
72
|
+
# run tests
|
73
|
+
rspec
|
74
|
+
|
75
|
+
### Release
|
76
|
+
|
77
|
+
# publish gem
|
78
|
+
rake release
|
79
|
+
|
80
|
+
# publish docker container
|
81
|
+
docker-compose build release
|
82
|
+
docker push rweng/aq_banking
|
24
83
|
|
25
|
-
# or to login and run tests manually
|
26
|
-
docker run -it --rm -v $(pwd):/gem rweng/aq_banking bash
|
27
84
|
|
28
85
|
## Contributing
|
29
86
|
|
data/docker-compose.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
version: '2'
|
2
|
+
|
3
|
+
services:
|
4
|
+
release:
|
5
|
+
build: .
|
6
|
+
image: rweng/aq_banking
|
7
|
+
|
8
|
+
dev:
|
9
|
+
image: rweng/aq_banking
|
10
|
+
depends_on:
|
11
|
+
- release
|
12
|
+
volumes:
|
13
|
+
- .:/gem
|
14
|
+
volumes_from:
|
15
|
+
- cache
|
16
|
+
working_dir: /gem
|
17
|
+
entrypoint: []
|
18
|
+
command: "/bin/bash -c 'bundle install --binstubs bin; /bin/bash'"
|
19
|
+
environment:
|
20
|
+
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:./bin"
|
21
|
+
|
22
|
+
cache:
|
23
|
+
image: busybox
|
24
|
+
volumes:
|
25
|
+
- /usr/local/bundle/cache
|
26
|
+
|
data/lib/aq_banking/cli.rb
CHANGED
@@ -5,20 +5,26 @@ module AqBanking
|
|
5
5
|
class_option :dry, :type => :boolean, default: false, aliases: '-d'
|
6
6
|
class_option :verbose, :type => :boolean, default: false, aliases: '-v'
|
7
7
|
|
8
|
-
option :bank
|
8
|
+
option :bank, aliases: '-b', banner: "NAME - one of: #{BANKS.keys.map(&:to_s).join(', ')}"
|
9
9
|
option :server_url
|
10
10
|
option :hbci_version
|
11
|
+
option :from, banner: 'FROM - e.g. 2016-01-01'
|
12
|
+
option :to, banner: 'TO - e.g. 2016-01-01'
|
11
13
|
desc 'request BANK_CODE ACCOUNT_NUMBER USER_ID PASSWORD', 'requests balance and transactions for an account. you must either specify --bank= or (--server-url and maybe --hbci-version)'
|
12
14
|
def request(bank_code, account_number, user_id, password)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
request_options = {
|
16
|
+
server_url: server_url,
|
17
|
+
bank_code: bank_code,
|
18
|
+
account_number: account_number,
|
19
|
+
user_id: user_id,
|
20
|
+
password: password
|
21
|
+
}
|
22
|
+
|
23
|
+
request_options[:hbci_version] = hbci_version if hbci_version
|
24
|
+
request_options[:from] = options[:from] if options[:from]
|
25
|
+
request_options[:to] = options[:to] if options[:to]
|
26
|
+
|
27
|
+
response = commander.send_request!(request_options)
|
22
28
|
account = parser.parse_account_list(response).first
|
23
29
|
|
24
30
|
puts account.to_json
|
@@ -26,7 +32,7 @@ module AqBanking
|
|
26
32
|
|
27
33
|
desc 'list_banks', 'shows valid values for the --bank flag'
|
28
34
|
def list_banks
|
29
|
-
|
35
|
+
BANKS.keys.map(&:to_s).each { |key| puts key }
|
30
36
|
end
|
31
37
|
|
32
38
|
private
|
data/lib/aq_banking/commander.rb
CHANGED
@@ -13,12 +13,15 @@ module AqBanking
|
|
13
13
|
# @param [String] bank_code
|
14
14
|
# @param [String] account_number
|
15
15
|
# @param [String] pin_file path to pin
|
16
|
-
# @param [Date] from
|
17
|
-
# @param [Date] to
|
16
|
+
# @param [Date,String] from
|
17
|
+
# @param [Date,String] to
|
18
18
|
#
|
19
19
|
# @return [String]
|
20
20
|
# @raise [SystemCmdError]
|
21
21
|
def send_request(bank_code, account_number, pin_file, from: nil, to: nil)
|
22
|
+
from = Date.parse(from) if from.is_a? String
|
23
|
+
to = Date.parse(to) if to.is_a? String
|
24
|
+
|
22
25
|
cmd = "#{aq_cli} -P #{pin_file} request -b #{bank_code} -a #{account_number}"
|
23
26
|
cmd << " --fromdate=#{from.strftime("%Y%m%d")}" if from
|
24
27
|
cmd << " --todate=#{to.strftime("%Y%m%d")}" if to
|
@@ -94,7 +97,7 @@ module AqBanking
|
|
94
97
|
# @return [AqBanking::Commander::Result]
|
95
98
|
# @raise [Timeout::Error]
|
96
99
|
def run(cmd, timeout: DEFAULT_TIMEOUT)
|
97
|
-
logger.
|
100
|
+
logger.info "run: #{cmd}"
|
98
101
|
result = nil
|
99
102
|
|
100
103
|
Timeout::timeout(timeout) do
|
data/lib/aq_banking/version.rb
CHANGED
data/lib/aq_banking.rb
CHANGED
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Wenglewski
|
@@ -158,6 +158,7 @@ executables:
|
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
|
+
- ".dockerignore"
|
161
162
|
- ".gitignore"
|
162
163
|
- ".rspec"
|
163
164
|
- ".ruby-version"
|
@@ -167,6 +168,7 @@ files:
|
|
167
168
|
- README.md
|
168
169
|
- Rakefile
|
169
170
|
- aq_banking.gemspec
|
171
|
+
- docker-compose.yml
|
170
172
|
- exe/aq_banking
|
171
173
|
- lib/aq_banking.rb
|
172
174
|
- lib/aq_banking/account_info_list.tt
|