bunq-client 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd7688576042b6d4767eeb9f3ba6a5571a296070b44cf3da4aabcc221eb83b3c
4
- data.tar.gz: d81a7e0a729a790315ea24fc630815c2145c89fea9ac577e7ff80e40f1bf4096
3
+ metadata.gz: 04c107e325b51afce818d5381d4ce6ddcd86c6307f80e187bb6de26fcbc2ccff
4
+ data.tar.gz: 55187a4b44972380ff11d8464749fbb06bd40d5b93c726f5dcafe96cd0759ce3
5
5
  SHA512:
6
- metadata.gz: 40cc75610a053e7cf0476ee8f752333041f3e8d777ad58d29632dcfe8ae4a961888e41d4a8cfd9ff9cbbabfd6c4265902d0f787e2fb5628e2f7667c2b568c530
7
- data.tar.gz: 7c78e3b0840ad09acc5060bb2b509655032c73f39b4fc540b5ba16764413216e8d4a87d4ea362a977eacda744859988a9888848c441e2d4ec142319fdd40746b
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
- cofig.installation_token = nil # this MUST be nil for creating installations
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
- cofig.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
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
- cofig.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
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
- cofig.installation_token = 'THE INSTALLATION TOKEN RETURNED IN STEP 1'
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(
@@ -98,13 +98,15 @@ module Bunq
98
98
  end
99
99
 
100
100
  def verify_and_handle_response(response, request, result, &block)
101
- handle_maintenance(response) if [491, 503].include?(response.code)
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 handle_maintenance(response)
107
- fail MaintenanceResponse.new(code: response.code, headers: response.raw_headers, body: response.body)
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
@@ -1,3 +1,3 @@
1
1
  module Bunq
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
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.0
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-10 00:00:00.000000000 Z
14
+ date: 2020-03-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client