bridge_bankin 0.1.4 → 0.1.6
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/lib/bridge_bankin/api/client.rb +26 -1
- data/lib/bridge_bankin/configuration.rb +4 -3
- data/lib/bridge_bankin/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 576c19dcf1c1f0187d6e86ff45a731415120f261e9a2495013b845b338ee0c3c
|
4
|
+
data.tar.gz: 41d2aba812b11af49117b1cfef28e338f067cb5c296bdaa0090886c74414f61c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a029a5962a1296a8ce4b40463e08091456771bfef0b2659f16add6e2c92f9b045150d4c39b55f2851e282ba28dde130d2bb51e51c077b930a567ad533b06293f
|
7
|
+
data.tar.gz: fb4bea9560b48b5f1aa563140fadf9032dbaa2d62012ecd7276190de922a709031bf0e2a33d51db81ac463669d73f2d38f0efe3a263c1b56b41285bff914017a
|
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
|
|
@@ -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,7 +21,7 @@ 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
|
@@ -29,8 +29,9 @@ module BridgeBankin
|
|
29
29
|
def initialize
|
30
30
|
@api_base_url = "https://sync.bankin.com"
|
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,14 @@
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier Buffon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
217
|
+
rubygems_version: 3.2.3
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: Unofficial Ruby client to consume Bridge by Bankin’ API
|