bunq-client 0.6.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +40 -0
- data/.rubocop.yml +212 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/README.md +6 -4
- data/Rakefile +7 -3
- data/bunq-client.gemspec +22 -20
- data/lib/bunq/attachment.rb +15 -0
- data/lib/bunq/attachment_public.rb +13 -0
- data/lib/bunq/attachment_public_content.rb +4 -2
- data/lib/bunq/attachment_publics.rb +20 -0
- data/lib/bunq/attachments.rb +20 -0
- data/lib/bunq/avatar.rb +15 -0
- data/lib/bunq/avatars.rb +15 -0
- data/lib/bunq/bunq.rb +2 -0
- data/lib/bunq/bunqme_tab.rb +17 -0
- data/lib/bunq/bunqme_tabs.rb +21 -0
- data/lib/bunq/card.rb +2 -0
- data/lib/bunq/cards.rb +3 -1
- data/lib/bunq/certificate_pinned.rb +10 -6
- data/lib/bunq/client.rb +74 -51
- data/lib/bunq/device_servers.rb +5 -4
- data/lib/bunq/draft_share_invite_bank.rb +2 -0
- data/lib/bunq/draft_share_invite_banks.rb +3 -1
- data/lib/bunq/encryptor.rb +6 -7
- data/lib/bunq/errors.rb +10 -3
- data/lib/bunq/header.rb +20 -0
- data/lib/bunq/installation.rb +2 -0
- data/lib/bunq/installations.rb +4 -2
- data/lib/bunq/monetary_account.rb +17 -0
- data/lib/bunq/monetary_account_bank.rb +17 -0
- data/lib/bunq/monetary_account_banks.rb +21 -0
- data/lib/bunq/monetary_accounts.rb +3 -1
- data/lib/bunq/notification_filter_url.rb +4 -2
- data/lib/bunq/paginated.rb +14 -3
- data/lib/bunq/payment.rb +2 -0
- data/lib/bunq/payments.rb +3 -1
- data/lib/bunq/qr_code_content.rb +5 -3
- data/lib/bunq/resource.rb +34 -16
- data/lib/bunq/session_servers.rb +5 -2
- data/lib/bunq/signature.rb +31 -8
- data/lib/bunq/user.rb +17 -0
- data/lib/bunq/user_company.rb +2 -0
- data/lib/bunq/user_person.rb +2 -0
- data/lib/bunq/users.rb +17 -0
- data/lib/bunq/version.rb +3 -1
- metadata +53 -20
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef10a801a625977962349812aa5b47ef63e802a4a3a5c33853b332a514bca935
|
4
|
+
data.tar.gz: 42d8632ffa3063f16f13c12a881478b735c7849e0bc0cfce1f5fe3fe44e0b81e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58ee5014d8792932f156b65902af3c72d8bb11671b8838f6685ef3132a74f947457db81f0d8aeec315e3f4d348016a417c59a8276d5b3ed526dd6b397dfbc146
|
7
|
+
data.tar.gz: 5cbfff265e0bdd934d4364581cae0baba31f0c5ea71d3fc2c2270032f77b0d6d7b5424cf3adb7bfb257f9517252f3b03a6450946c255616be23450d1ee4a1514
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: rspec
|
2
|
+
|
3
|
+
on:
|
4
|
+
[push]
|
5
|
+
|
6
|
+
env:
|
7
|
+
RACK_ENV: test
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
include:
|
15
|
+
- ruby-version: 3.0.0
|
16
|
+
- ruby-version: 2.7
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- name: Checkout code
|
20
|
+
uses: actions/checkout@v2
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: actions/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
- name: Cache bundler
|
26
|
+
uses: actions/cache@v2
|
27
|
+
with:
|
28
|
+
path: vendor/bundle
|
29
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
30
|
+
restore-keys: |
|
31
|
+
${{ runner.os }}-gems-
|
32
|
+
- name: Install bundler
|
33
|
+
run: |
|
34
|
+
gem install bundler
|
35
|
+
- name: Install ruby dependencies
|
36
|
+
run: |
|
37
|
+
bundle config path vendor/bundle
|
38
|
+
bundle install --jobs 4
|
39
|
+
- name: Run tests
|
40
|
+
run: bundle exec rspec
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
# The behavior of RuboCop can be controlled via the .rubocop.yml
|
2
|
+
# configuration file. It makes it possible to enable/disable
|
3
|
+
# certain cops (checks) and to alter their behavior if they accept
|
4
|
+
# any parameters. The file can be placed either in your home
|
5
|
+
# directory or in some project directory.
|
6
|
+
#
|
7
|
+
# RuboCop will start looking for the configuration file in the directory
|
8
|
+
# where the inspected file is and continue its way up to the root directory.
|
9
|
+
#
|
10
|
+
# See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
|
11
|
+
|
12
|
+
##
|
13
|
+
# General styles
|
14
|
+
##
|
15
|
+
Style/Documentation:
|
16
|
+
Enabled: false # Code should be self-documenting
|
17
|
+
|
18
|
+
Style/AsciiComments:
|
19
|
+
Enabled: false # We have no issues with non-ascii characters in comments
|
20
|
+
|
21
|
+
Style/GuardClause:
|
22
|
+
Enabled: false # Can lead to strange constructions
|
23
|
+
|
24
|
+
Style/EachWithObject:
|
25
|
+
Enabled: false # We prefer/are used to using reduce
|
26
|
+
|
27
|
+
Style/NumericPredicate:
|
28
|
+
Enabled: false # Using .zero? can lead to 'Undefined method x for nil'
|
29
|
+
|
30
|
+
Style/MultilineBlockChain:
|
31
|
+
Enabled: false # Acceptable
|
32
|
+
|
33
|
+
Style/DoubleNegation:
|
34
|
+
Enabled: false # Usable 'hack'
|
35
|
+
|
36
|
+
Style/Lambda:
|
37
|
+
EnforcedStyle: literal
|
38
|
+
|
39
|
+
Style/SignalException:
|
40
|
+
EnforcedStyle: semantic
|
41
|
+
|
42
|
+
Style/FormatStringToken:
|
43
|
+
EnforcedStyle: unannotated
|
44
|
+
|
45
|
+
##
|
46
|
+
# Metrics (all disabled; we have our own opinion on this)
|
47
|
+
##
|
48
|
+
Layout/LineLength:
|
49
|
+
Enabled: true
|
50
|
+
Max: 120
|
51
|
+
AutoCorrect: true
|
52
|
+
|
53
|
+
Metrics/AbcSize:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Metrics/BlockLength:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Metrics/BlockNesting:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Metrics/ClassLength:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
Metrics/CyclomaticComplexity:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
Metrics/MethodLength:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
Metrics/ModuleLength:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Metrics/ParameterLists:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
Metrics/PerceivedComplexity:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
##
|
81
|
+
# Trailing comma's
|
82
|
+
##
|
83
|
+
Style/TrailingCommaInArguments:
|
84
|
+
EnforcedStyleForMultiline: comma
|
85
|
+
|
86
|
+
Style/TrailingCommaInArrayLiteral:
|
87
|
+
EnforcedStyleForMultiline: comma
|
88
|
+
|
89
|
+
Style/TrailingCommaInHashLiteral:
|
90
|
+
EnforcedStyleForMultiline: comma
|
91
|
+
|
92
|
+
##
|
93
|
+
# Naming things
|
94
|
+
##
|
95
|
+
Naming/AccessorMethodName:
|
96
|
+
Enabled: false # We have our own opinion on this
|
97
|
+
|
98
|
+
Naming/PredicateName:
|
99
|
+
Enabled: false # We have our own opinion on this
|
100
|
+
|
101
|
+
Naming/VariableNumber:
|
102
|
+
Enabled: false # We have our own opinion on this
|
103
|
+
|
104
|
+
Naming/HeredocDelimiterNaming:
|
105
|
+
Enabled: false # We have our own opinion on this
|
106
|
+
|
107
|
+
##
|
108
|
+
# Lint
|
109
|
+
Lint/UriEscapeUnescape:
|
110
|
+
Enabled: false
|
111
|
+
|
112
|
+
Lint/SuppressedException:
|
113
|
+
AllowComments: true
|
114
|
+
|
115
|
+
Lint/AmbiguousBlockAssociation:
|
116
|
+
Enabled: true
|
117
|
+
Exclude:
|
118
|
+
- spec/**/*
|
119
|
+
|
120
|
+
Lint/NestedMethodDefinition:
|
121
|
+
Enabled: true
|
122
|
+
|
123
|
+
##
|
124
|
+
# Layout
|
125
|
+
##
|
126
|
+
Layout/ExtraSpacing:
|
127
|
+
Enabled: true
|
128
|
+
AllowForAlignment: false
|
129
|
+
|
130
|
+
Layout/SpaceInsideHashLiteralBraces:
|
131
|
+
EnforcedStyle: no_space
|
132
|
+
|
133
|
+
##
|
134
|
+
# Multi-line formatting (hashes)
|
135
|
+
##
|
136
|
+
Layout/FirstHashElementLineBreak:
|
137
|
+
Enabled: true
|
138
|
+
|
139
|
+
Layout/FirstHashElementIndentation:
|
140
|
+
Enabled: true
|
141
|
+
EnforcedStyle: consistent
|
142
|
+
|
143
|
+
Layout/MultilineHashBraceLayout:
|
144
|
+
Enabled: true
|
145
|
+
EnforcedStyle: new_line
|
146
|
+
|
147
|
+
Layout/MultilineHashKeyLineBreaks:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
##
|
151
|
+
# Multi-line formatting (array)
|
152
|
+
##
|
153
|
+
Layout/FirstArrayElementLineBreak:
|
154
|
+
Enabled: true
|
155
|
+
|
156
|
+
Layout/FirstArrayElementIndentation:
|
157
|
+
Enabled: true
|
158
|
+
EnforcedStyle: consistent
|
159
|
+
|
160
|
+
Layout/MultilineArrayBraceLayout:
|
161
|
+
Enabled: true
|
162
|
+
EnforcedStyle: new_line
|
163
|
+
|
164
|
+
Layout/MultilineArrayLineBreaks:
|
165
|
+
Enabled: true
|
166
|
+
|
167
|
+
##
|
168
|
+
# Multi-line formatting (methods/arguments)
|
169
|
+
##
|
170
|
+
Layout/FirstMethodArgumentLineBreak:
|
171
|
+
Enabled: true
|
172
|
+
|
173
|
+
Layout/FirstArgumentIndentation:
|
174
|
+
Enabled: true
|
175
|
+
EnforcedStyle: consistent
|
176
|
+
|
177
|
+
Layout/FirstParameterIndentation:
|
178
|
+
Enabled: true
|
179
|
+
EnforcedStyle: consistent
|
180
|
+
|
181
|
+
Layout/MultilineMethodCallBraceLayout:
|
182
|
+
Enabled: true
|
183
|
+
EnforcedStyle: new_line
|
184
|
+
|
185
|
+
Layout/MultilineMethodArgumentLineBreaks:
|
186
|
+
Enabled: true
|
187
|
+
|
188
|
+
Layout/MultilineMethodCallIndentation:
|
189
|
+
Enabled: true
|
190
|
+
EnforcedStyle: indented
|
191
|
+
|
192
|
+
# New
|
193
|
+
Layout/SpaceAroundMethodCallOperator:
|
194
|
+
Enabled: true
|
195
|
+
|
196
|
+
Lint/RaiseException:
|
197
|
+
Enabled: true
|
198
|
+
|
199
|
+
Lint/StructNewOverride:
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
Style/ExponentialNotation:
|
203
|
+
Enabled: true
|
204
|
+
|
205
|
+
Style/HashEachMethods:
|
206
|
+
Enabled: true
|
207
|
+
|
208
|
+
Style/HashTransformKeys:
|
209
|
+
Enabled: true
|
210
|
+
|
211
|
+
Style/HashTransformValues:
|
212
|
+
Enabled: true
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Bunq::Client
|
2
2
|
|
3
|
+
[![rspec Actions Status](https://github.com/jorttbv/bunq-client/workflows/rspec/badge.svg)](https://github.com/jorttbv/bunq-client/actions)
|
4
|
+
|
3
5
|
The `Bunq::Client` is a ruby wrapper of the [bunq Public API](https://doc.bunq.com) extracted from [Jortt Online boekhouden](https://www.jortt.nl).
|
4
6
|
|
5
7
|
The `Bunq::Client` is the main interface which can be used to navigate to other resources. The response objects are just
|
@@ -40,7 +42,7 @@ Bunq.configure do |config|
|
|
40
42
|
config.api_key = 'YOUR API KEY'
|
41
43
|
config.private_key = private_key
|
42
44
|
config.server_public_key = nil # you don't have this yet
|
43
|
-
|
45
|
+
config.installation_token = nil # this MUST be nil for creating installations
|
44
46
|
end
|
45
47
|
|
46
48
|
# Create the installation
|
@@ -66,7 +68,7 @@ Bunq.configure do |config|
|
|
66
68
|
config.private_key = 'SAME PRIVATE KEY AS IN STEP 1'
|
67
69
|
# Used for response verification
|
68
70
|
config.server_public_key = 'THE CONTENTS OF THE PUBLIC KEY FILE RETURNED IN STEP 1'
|
69
|
-
|
71
|
+
config.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
|
70
72
|
end
|
71
73
|
|
72
74
|
response = Bunq.client.device_servers.create('My Laptop')
|
@@ -81,7 +83,7 @@ Bunq.configure do |config|
|
|
81
83
|
config.private_key = 'SAME PRIVATE KEY AS IN STEP 1'
|
82
84
|
# Used for response verification
|
83
85
|
config.server_public_key = 'THE CONTENTS OF THE PUBLIC KEY FILE RETURNED IN STEP 1'
|
84
|
-
|
86
|
+
config.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
|
85
87
|
end
|
86
88
|
|
87
89
|
certificate_of_you_callback_url = IO.read('path_to_pem_file')
|
@@ -96,7 +98,7 @@ Bunq.configure do |config|
|
|
96
98
|
config.private_key = 'SAME PRIVATE KEY AS IN STEP 1'
|
97
99
|
# Used for response verification
|
98
100
|
config.server_public_key = 'THE CONTENTS OF THE PUBLIC KEY FILE RETURNED IN STEP 1'
|
99
|
-
|
101
|
+
config.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
|
100
102
|
end
|
101
103
|
|
102
104
|
Bunq.client.me_as_user.notification_filter_url.create(
|
data/Rakefile
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'rubocop/rake_task'
|
3
6
|
|
4
7
|
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
RuboCop::RakeTask.new
|
5
9
|
|
6
|
-
task :
|
10
|
+
task default: %w[rubocop spec]
|
data/bunq-client.gemspec
CHANGED
@@ -1,42 +1,44 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'bunq/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
8
|
+
spec.name = 'bunq-client'
|
9
|
+
spec.version = Bunq::VERSION
|
10
|
+
spec.authors = [
|
10
11
|
'Lars Vonk',
|
11
12
|
'Bob Forma',
|
12
13
|
'Derek Kraan',
|
13
14
|
'Mike van Diepen',
|
14
15
|
]
|
15
|
-
spec.email
|
16
|
+
spec.email = [
|
16
17
|
'lars.vonk@gmail.com',
|
17
18
|
'bforma@zilverline.com',
|
18
19
|
'derek.kraan@gmail.com',
|
19
20
|
'mvdiepen@zilverline.com',
|
20
21
|
]
|
21
22
|
|
22
|
-
spec.summary
|
23
|
-
spec.description
|
24
|
-
spec.homepage
|
25
|
-
spec.license
|
23
|
+
spec.summary = 'Ruby client for the bunq public API.'
|
24
|
+
spec.description = 'Ruby client for the bunq public API. Extracted from www.jortt.nl'
|
25
|
+
spec.homepage = 'https://github.com/jorttbv/bunq-client'
|
26
|
+
spec.license = 'MIT'
|
26
27
|
|
27
|
-
spec.files
|
28
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
29
|
f.match(%r{^(test|spec|features)/})
|
29
30
|
end
|
30
|
-
spec.bindir
|
31
|
-
spec.executables
|
32
|
-
spec.require_paths = [
|
31
|
+
spec.bindir = 'exe'
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ['lib']
|
33
34
|
|
34
|
-
spec.add_runtime_dependency 'rest-client', '
|
35
|
+
spec.add_runtime_dependency 'rest-client', ['>= 2.0', '< 2.2']
|
35
36
|
spec.add_runtime_dependency 'thread_safe', '~> 0.3.6'
|
36
37
|
|
37
|
-
spec.add_development_dependency
|
38
|
-
spec.add_development_dependency
|
39
|
-
spec.add_development_dependency
|
40
|
-
spec.add_development_dependency
|
41
|
-
spec.add_development_dependency
|
38
|
+
spec.add_development_dependency 'codecov', '~> 0.4.2'
|
39
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
40
|
+
spec.add_development_dependency 'rspec', '~> 3.10'
|
41
|
+
spec.add_development_dependency 'rspec-json_expectations', '~> 2.2'
|
42
|
+
spec.add_development_dependency 'rubocop', '~> 0.82.0'
|
43
|
+
spec.add_development_dependency 'webmock', '~> 3.11'
|
42
44
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'resource'
|
4
|
+
|
5
|
+
module Bunq
|
6
|
+
class Attachment
|
7
|
+
def initialize(parent_resource, id)
|
8
|
+
@resource = parent_resource.append("/attachment/#{id}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
@resource.with_session { @resource.get }['Response']
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bunq
|
4
|
+
class AttachmentPublic
|
5
|
+
def initialize(client, id)
|
6
|
+
@resource = Bunq::Resource.new(client, "/v1/attachment-public/#{id}")
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
@resource.with_session { @resource.get }['Response']
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Bunq
|
2
4
|
##
|
3
5
|
# https://doc.bunq.com/api/1/call/attachment-public-content
|
@@ -11,8 +13,8 @@ module Bunq
|
|
11
13
|
# Returns the raw content of a public attachment with given ID.
|
12
14
|
# The raw content is the binary representation of a file.
|
13
15
|
def show
|
14
|
-
@resource.with_session do
|
15
|
-
@resource.get
|
16
|
+
@resource.with_session do
|
17
|
+
@resource.get(&:body)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|