bridge_bankin 0.1.4 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/bridge_bankin.gemspec +2 -2
- data/lib/bridge_bankin/api/client.rb +26 -1
- data/lib/bridge_bankin/configuration.rb +5 -4
- data/lib/bridge_bankin/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 884db3467ecb63e74c6ac601952f87f4c33296643fa841ba79ed89dac2c93e05
|
4
|
+
data.tar.gz: f0c85a9c23a113ca0832f10448b6dcdf5b2c908c4787d65a19bf1e6be2fb722d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 693ba76df3b7556fd0da4f716da6a595daf73cae4d87e0764efd33a10a81c03c3596f3606e0f2340a5255e9aac89eedf73376def58f5e4e73a7544b8895a364e
|
7
|
+
data.tar.gz: b32cdb23ebcb200cc407aa848e5a5be8d17679c23d6fd58c626984a88cec8d24ed5c1a16ff04dbf2d6cdd1136bee130a25a4b0a9b444a465cf1b1936ff54de69
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -58,6 +58,7 @@ One you have your valid API credential you can now create an initializer in your
|
|
58
58
|
BridgeBankin.configure do |config|
|
59
59
|
config.api_client_id = ENV["BRIDGE_API_CLIENT_ID"]
|
60
60
|
config.api_client_secret = ENV["BRIDGE_API_CLIENT_SECRET"]
|
61
|
+
config.follow_pages = true
|
61
62
|
end
|
62
63
|
```
|
63
64
|
|
data/bridge_bankin.gemspec
CHANGED
@@ -5,8 +5,8 @@ require_relative "lib/bridge_bankin/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "bridge_bankin"
|
7
7
|
spec.version = BridgeBankin::VERSION
|
8
|
-
spec.authors = ["Olivier Buffon"]
|
9
|
-
spec.email = ["olivier@buffon.dev"]
|
8
|
+
spec.authors = ["Olivier Buffon", "Thomas Andrieu"]
|
9
|
+
spec.email = ["olivier@buffon.dev", "t.andrieu@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "Unofficial Ruby client to consume Bridge by Bankin’ API"
|
12
12
|
|
@@ -91,7 +91,13 @@ module BridgeBankin
|
|
91
91
|
|
92
92
|
case api_response.code
|
93
93
|
when "200", "201"
|
94
|
-
parse_response_body(api_response.body)
|
94
|
+
data = parse_response_body(api_response.body)
|
95
|
+
|
96
|
+
if data.dig(:pagination, :next_uri) && follow_pages
|
97
|
+
handle_paging(data)
|
98
|
+
else
|
99
|
+
data
|
100
|
+
end
|
95
101
|
when "204", "202"
|
96
102
|
{}
|
97
103
|
else
|
@@ -108,6 +114,25 @@ module BridgeBankin
|
|
108
114
|
@uri ||= URI.parse(BridgeBankin.configuration.api_base_url)
|
109
115
|
end
|
110
116
|
|
117
|
+
def follow_pages
|
118
|
+
BridgeBankin.configuration.follow_pages
|
119
|
+
end
|
120
|
+
|
121
|
+
def handle_paging(data)
|
122
|
+
if follow_pages && data[:pagination][:next_uri]
|
123
|
+
page_uri = URI.parse(data[:pagination][:next_uri])
|
124
|
+
|
125
|
+
params = URI.decode_www_form(page_uri.query).to_h
|
126
|
+
|
127
|
+
next_page_data = get(page_uri.path, **params)
|
128
|
+
end
|
129
|
+
|
130
|
+
next_page_data[:resources] << data[:resources]
|
131
|
+
next_page_data[:resources] = next_page_data[:resources].flatten
|
132
|
+
|
133
|
+
next_page_data
|
134
|
+
end
|
135
|
+
|
111
136
|
def headers
|
112
137
|
headers =
|
113
138
|
{
|
@@ -21,16 +21,17 @@ module BridgeBankin
|
|
21
21
|
#
|
22
22
|
class Configuration
|
23
23
|
attr_reader :api_base_url, :api_version
|
24
|
-
attr_accessor :api_client_id, :api_client_secret
|
24
|
+
attr_accessor :api_client_id, :api_client_secret, :follow_pages
|
25
25
|
|
26
26
|
#
|
27
27
|
# Initializes Configuration
|
28
28
|
#
|
29
29
|
def initialize
|
30
|
-
@api_base_url = "https://
|
30
|
+
@api_base_url = "https://api.bridgeapi.io"
|
31
31
|
@api_version = "2019-02-18"
|
32
|
-
@api_client_id = "
|
33
|
-
@api_client_secret = "
|
32
|
+
@api_client_id = ""
|
33
|
+
@api_client_secret = ""
|
34
|
+
@follow_pages = false
|
34
35
|
end
|
35
36
|
end
|
36
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridge_bankin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier Buffon
|
8
|
+
- Thomas Andrieu
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-10-14 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: awesome_print
|
@@ -155,6 +156,7 @@ description: Thanks to a safe and automated access to bank data, Bridge powered
|
|
155
156
|
services.
|
156
157
|
email:
|
157
158
|
- olivier@buffon.dev
|
159
|
+
- t.andrieu@gmail.com
|
158
160
|
executables: []
|
159
161
|
extensions: []
|
160
162
|
extra_rdoc_files: []
|
@@ -214,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
216
|
- !ruby/object:Gem::Version
|
215
217
|
version: '0'
|
216
218
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
219
|
+
rubygems_version: 3.2.22
|
218
220
|
signing_key:
|
219
221
|
specification_version: 4
|
220
222
|
summary: Unofficial Ruby client to consume Bridge by Bankin’ API
|