bunq-client 0.7.0 → 0.7.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/README.md +4 -4
- data/lib/bunq/resource.rb +8 -4
- data/lib/bunq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04c107e325b51afce818d5381d4ce6ddcd86c6307f80e187bb6de26fcbc2ccff
|
4
|
+
data.tar.gz: 55187a4b44972380ff11d8464749fbb06bd40d5b93c726f5dcafe96cd0759ce3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c35108c41c6d8ed675dd9e189f1fbbf041d8166a08495af6c9c07462b202120955177b6bfee92eafe576ea0c1caed2f3ce52d00c8729c9eae48429fb640276b3
|
7
|
+
data.tar.gz: 399691acb52796732f68801e2922536491db58ec1f42035795ad8f14c2c3814c5406249b78dcbe2994758245995950f3e71e2d16de0bab56853a70e177914d3f
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ Bunq.configure do |config|
|
|
40
40
|
config.api_key = 'YOUR API KEY'
|
41
41
|
config.private_key = private_key
|
42
42
|
config.server_public_key = nil # you don't have this yet
|
43
|
-
|
43
|
+
config.installation_token = nil # this MUST be nil for creating installations
|
44
44
|
end
|
45
45
|
|
46
46
|
# Create the installation
|
@@ -66,7 +66,7 @@ Bunq.configure do |config|
|
|
66
66
|
config.private_key = 'SAME PRIVATE KEY AS IN STEP 1'
|
67
67
|
# Used for response verification
|
68
68
|
config.server_public_key = 'THE CONTENTS OF THE PUBLIC KEY FILE RETURNED IN STEP 1'
|
69
|
-
|
69
|
+
config.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
|
70
70
|
end
|
71
71
|
|
72
72
|
response = Bunq.client.device_servers.create('My Laptop')
|
@@ -81,7 +81,7 @@ Bunq.configure do |config|
|
|
81
81
|
config.private_key = 'SAME PRIVATE KEY AS IN STEP 1'
|
82
82
|
# Used for response verification
|
83
83
|
config.server_public_key = 'THE CONTENTS OF THE PUBLIC KEY FILE RETURNED IN STEP 1'
|
84
|
-
|
84
|
+
config.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
|
85
85
|
end
|
86
86
|
|
87
87
|
certificate_of_you_callback_url = IO.read('path_to_pem_file')
|
@@ -96,7 +96,7 @@ Bunq.configure do |config|
|
|
96
96
|
config.private_key = 'SAME PRIVATE KEY AS IN STEP 1'
|
97
97
|
# Used for response verification
|
98
98
|
config.server_public_key = 'THE CONTENTS OF THE PUBLIC KEY FILE RETURNED IN STEP 1'
|
99
|
-
|
99
|
+
config.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
|
100
100
|
end
|
101
101
|
|
102
102
|
Bunq.client.me_as_user.notification_filter_url.create(
|
data/lib/bunq/resource.rb
CHANGED
@@ -98,13 +98,15 @@ module Bunq
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def verify_and_handle_response(response, request, result, &block)
|
101
|
-
|
102
|
-
client.signature.verify!(response) unless client.configuration.disable_response_signature_verification
|
101
|
+
client.signature.verify!(response) if verify_response_signature?(response)
|
103
102
|
handle_response(response, request, result, &block)
|
104
103
|
end
|
105
104
|
|
106
|
-
def
|
107
|
-
|
105
|
+
def verify_response_signature?(response)
|
106
|
+
return false if client.configuration.disable_response_signature_verification
|
107
|
+
return false if response.code == 491
|
108
|
+
|
109
|
+
(100..499).include?(response.code)
|
108
110
|
end
|
109
111
|
|
110
112
|
def handle_response(response, _request, _result, &block)
|
@@ -120,6 +122,8 @@ module Bunq
|
|
120
122
|
fail UnauthorisedResponse.new(code: response.code, headers: response.raw_headers, body: response.body)
|
121
123
|
elsif response.code == 404
|
122
124
|
fail ResourceNotFound.new(code: response.code, headers: response.raw_headers, body: response.body)
|
125
|
+
elsif [491, 503].include?(response.code)
|
126
|
+
fail MaintenanceResponse.new(code: response.code, headers: response.raw_headers, body: response.body)
|
123
127
|
else
|
124
128
|
fail UnexpectedResponse.new(code: response.code, headers: response.raw_headers, body: response.body)
|
125
129
|
end
|
data/lib/bunq/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunq-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lars Vonk
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-03-
|
14
|
+
date: 2020-03-31 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rest-client
|