bridgeapi_client 1.0.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.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.env.example +2 -0
  3. data/.github/workflows/ci-analysis.yml +24 -0
  4. data/.github/workflows/rubocop-analysis.yml +24 -0
  5. data/.gitignore +11 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +50 -0
  8. data/CHANGELOG.md +24 -0
  9. data/Gemfile +23 -0
  10. data/Gemfile.lock +186 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +229 -0
  13. data/Rakefile +12 -0
  14. data/bin/bundle +114 -0
  15. data/bin/coderay +27 -0
  16. data/bin/console +21 -0
  17. data/bin/htmldiff +27 -0
  18. data/bin/ldiff +27 -0
  19. data/bin/pry +27 -0
  20. data/bin/racc +27 -0
  21. data/bin/rake +27 -0
  22. data/bin/rspec +27 -0
  23. data/bin/rubocop +27 -0
  24. data/bin/ruby-parse +27 -0
  25. data/bin/ruby-rewrite +27 -0
  26. data/bin/setup +8 -0
  27. data/bridge_api.gemspec +40 -0
  28. data/lib/bridge_api/account.rb +46 -0
  29. data/lib/bridge_api/api/client.rb +206 -0
  30. data/lib/bridge_api/api/error.rb +48 -0
  31. data/lib/bridge_api/api/resource.rb +25 -0
  32. data/lib/bridge_api/authorization.rb +44 -0
  33. data/lib/bridge_api/bank.rb +18 -0
  34. data/lib/bridge_api/bridge_object.rb +120 -0
  35. data/lib/bridge_api/category.rb +39 -0
  36. data/lib/bridge_api/configuration.rb +38 -0
  37. data/lib/bridge_api/connect.rb +59 -0
  38. data/lib/bridge_api/insight.rb +27 -0
  39. data/lib/bridge_api/item.rb +91 -0
  40. data/lib/bridge_api/object_types.rb +28 -0
  41. data/lib/bridge_api/payment.rb +260 -0
  42. data/lib/bridge_api/provider.rb +40 -0
  43. data/lib/bridge_api/resources.rb +15 -0
  44. data/lib/bridge_api/stock.rb +45 -0
  45. data/lib/bridge_api/transaction.rb +79 -0
  46. data/lib/bridge_api/transfer.rb +42 -0
  47. data/lib/bridge_api/user.rb +98 -0
  48. data/lib/bridge_api/version.rb +5 -0
  49. data/lib/bridge_api.rb +22 -0
  50. data/lib/bridgeapi_client.rb +3 -0
  51. metadata +97 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2747f2ce696db93a077c23a3b1ca5e50230c019989f215207847fdffe7b06d8d
4
+ data.tar.gz: 7ed8c29547e5291d66928c10949507affb204b12109ca3ba9f0cec0442f9d2be
5
+ SHA512:
6
+ metadata.gz: 117136501562fc77f7edc69f3e696853a429d1bbfed384e97c6b805e60933a1a89e88e2ab9d58a277ce48896959b17c36cb3b22d6ebf2c58765da907d3151235
7
+ data.tar.gz: e0bcc3cadc614398200961a7885c7b829866853088ddc86ea725c3586147be4b12e5d05ddb20779ef3dc32d89ca8f6b2cb2882d3a30fdf91701726eb5007b794
data/.env.example ADDED
@@ -0,0 +1,2 @@
1
+ BRIDGE_API_CLIENT_ID=
2
+ BRIDGE_API_CLIENT_SECRET=
@@ -0,0 +1,24 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - "*"
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: 3.3.4
20
+ - name: Run the default task
21
+ run: |
22
+ gem install bundler
23
+ bundle install
24
+ bundle exec rspec
@@ -0,0 +1,24 @@
1
+ # .github/workflows/rubocop-analysis.yml
2
+ name: "RuboCop"
3
+
4
+ on:
5
+ push:
6
+ branches:
7
+ - main
8
+ pull_request:
9
+ branches:
10
+ - "*"
11
+
12
+ jobs:
13
+ rubocop:
14
+ name: Guidelines checks
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: 3.3.4
24
+ bundler-cache: true
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ .env
2
+ .rspec_status
3
+ /_yardoc/
4
+ /.bundle/
5
+ /.yardoc
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ /.idea
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,50 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ NewCops: enable
7
+
8
+ Style/StringLiterals:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Style/StringLiteralsInInterpolation:
13
+ Enabled: true
14
+ EnforcedStyle: double_quotes
15
+
16
+ Layout/LineLength:
17
+ Max: 120
18
+
19
+ Metrics/BlockLength:
20
+ Enabled: false
21
+
22
+ Metrics/AbcSize:
23
+ Enabled: false
24
+
25
+ Metrics/CyclomaticComplexity:
26
+ Max: 10
27
+
28
+ Metrics/MethodLength:
29
+ Max: 25
30
+
31
+ RSpec/ExampleLength:
32
+ Enabled: false
33
+
34
+ RSpec/MessageSpies:
35
+ Enabled: false
36
+
37
+ RSpec/SubjectStub:
38
+ Enabled: false
39
+
40
+ RSpec/MultipleDescribes:
41
+ Enabled: false
42
+
43
+ RSpec/StubbedMock:
44
+ Enabled: false
45
+
46
+ RSpec/MultipleExpectations:
47
+ Enabled: false
48
+
49
+ Metrics/ClassLength:
50
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## [1.0.1] - 2026-02-07
4
+
5
+ ### Changed
6
+ - Renamed gem from `bridge_api` to `bridgeapi_client` (name conflict on RubyGems)
7
+
8
+ ### Added
9
+ - `debug` configuration option to toggle verbose HTTP request/response logging (default: `false`)
10
+
11
+ ## [1.0.0] - 2026-02-07
12
+
13
+ ### Changed
14
+ - Renamed gem from `bridge_bankin` to `bridge_api`
15
+ - Renamed module from `BridgeBankin` to `BridgeApi`
16
+ - Full compatibility with Bridge API v3 (2025-01-15)
17
+
18
+ ### Fixed
19
+ - Thread safety: API client now uses `Thread.current` storage
20
+ - Pagination: fixed order of appended data in `handle_paging`
21
+ - Authentication: `generate_token` supports `external_user_id` (v3)
22
+
23
+ ### Removed
24
+ - Deprecated v2 methods kept only for backward compatibility warnings
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ gem "awesome_print"
8
+ gem "pry"
9
+ gem "rake"
10
+ gem "rspec"
11
+ gem "rubocop"
12
+ gem "rubocop-rake"
13
+ gem "rubocop-rspec"
14
+ gem "shoulda-matchers"
15
+ gem "vcr"
16
+ gem "webmock"
17
+
18
+ # Specify your gem's dependencies in sisense.gemspec
19
+ gemspec
20
+
21
+ gem "bigdecimal", "~> 3.3"
22
+
23
+ gem "base64", "~> 0.3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,186 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bridgeapi_client (1.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (8.1.2)
10
+ base64
11
+ bigdecimal
12
+ concurrent-ruby (~> 1.0, >= 1.3.1)
13
+ connection_pool (>= 2.2.5)
14
+ drb
15
+ i18n (>= 1.6, < 2)
16
+ json
17
+ logger (>= 1.4.2)
18
+ minitest (>= 5.1)
19
+ securerandom (>= 0.3)
20
+ tzinfo (~> 2.0, >= 2.0.5)
21
+ uri (>= 0.13.1)
22
+ addressable (2.8.8)
23
+ public_suffix (>= 2.0.2, < 8.0)
24
+ ast (2.4.3)
25
+ awesome_print (1.9.2)
26
+ base64 (0.3.0)
27
+ bigdecimal (3.3.1)
28
+ coderay (1.1.3)
29
+ concurrent-ruby (1.3.6)
30
+ connection_pool (3.0.2)
31
+ crack (1.0.1)
32
+ bigdecimal
33
+ rexml
34
+ diff-lcs (1.6.2)
35
+ drb (2.2.3)
36
+ hashdiff (1.2.1)
37
+ i18n (1.14.8)
38
+ concurrent-ruby (~> 1.0)
39
+ io-console (0.8.2)
40
+ json (2.18.1)
41
+ language_server-protocol (3.17.0.5)
42
+ lint_roller (1.1.0)
43
+ logger (1.7.0)
44
+ method_source (1.1.0)
45
+ minitest (6.0.1)
46
+ prism (~> 1.5)
47
+ parallel (1.27.0)
48
+ parser (3.3.10.1)
49
+ ast (~> 2.4.1)
50
+ racc
51
+ prism (1.9.0)
52
+ pry (0.16.0)
53
+ coderay (~> 1.1)
54
+ method_source (~> 1.0)
55
+ reline (>= 0.6.0)
56
+ public_suffix (7.0.2)
57
+ racc (1.8.1)
58
+ rainbow (3.1.1)
59
+ rake (13.3.1)
60
+ regexp_parser (2.11.3)
61
+ reline (0.6.3)
62
+ io-console (~> 0.5)
63
+ rexml (3.4.4)
64
+ rspec (3.13.2)
65
+ rspec-core (~> 3.13.0)
66
+ rspec-expectations (~> 3.13.0)
67
+ rspec-mocks (~> 3.13.0)
68
+ rspec-core (3.13.6)
69
+ rspec-support (~> 3.13.0)
70
+ rspec-expectations (3.13.5)
71
+ diff-lcs (>= 1.2.0, < 2.0)
72
+ rspec-support (~> 3.13.0)
73
+ rspec-mocks (3.13.7)
74
+ diff-lcs (>= 1.2.0, < 2.0)
75
+ rspec-support (~> 3.13.0)
76
+ rspec-support (3.13.7)
77
+ rubocop (1.84.1)
78
+ json (~> 2.3)
79
+ language_server-protocol (~> 3.17.0.2)
80
+ lint_roller (~> 1.1.0)
81
+ parallel (~> 1.10)
82
+ parser (>= 3.3.0.2)
83
+ rainbow (>= 2.2.2, < 4.0)
84
+ regexp_parser (>= 2.9.3, < 3.0)
85
+ rubocop-ast (>= 1.49.0, < 2.0)
86
+ ruby-progressbar (~> 1.7)
87
+ unicode-display_width (>= 2.4.0, < 4.0)
88
+ rubocop-ast (1.49.0)
89
+ parser (>= 3.3.7.2)
90
+ prism (~> 1.7)
91
+ rubocop-rake (0.7.1)
92
+ lint_roller (~> 1.1)
93
+ rubocop (>= 1.72.1)
94
+ rubocop-rspec (3.9.0)
95
+ lint_roller (~> 1.1)
96
+ rubocop (~> 1.81)
97
+ ruby-progressbar (1.13.0)
98
+ securerandom (0.4.1)
99
+ shoulda-matchers (7.0.1)
100
+ activesupport (>= 7.1)
101
+ tzinfo (2.0.6)
102
+ concurrent-ruby (~> 1.0)
103
+ unicode-display_width (3.2.0)
104
+ unicode-emoji (~> 4.1)
105
+ unicode-emoji (4.2.0)
106
+ uri (1.1.1)
107
+ vcr (6.4.0)
108
+ webmock (3.26.1)
109
+ addressable (>= 2.8.0)
110
+ crack (>= 0.3.2)
111
+ hashdiff (>= 0.4.0, < 2.0.0)
112
+
113
+ PLATFORMS
114
+ arm64-darwin-25
115
+ ruby
116
+
117
+ DEPENDENCIES
118
+ awesome_print
119
+ base64 (~> 0.3.0)
120
+ bigdecimal (~> 3.3)
121
+ bridgeapi_client!
122
+ pry
123
+ rake
124
+ rspec
125
+ rubocop
126
+ rubocop-rake
127
+ rubocop-rspec
128
+ shoulda-matchers
129
+ vcr
130
+ webmock
131
+
132
+ CHECKSUMS
133
+ activesupport (8.1.2) sha256=88842578ccd0d40f658289b0e8c842acfe9af751afee2e0744a7873f50b6fdae
134
+ addressable (2.8.8) sha256=7c13b8f9536cf6364c03b9d417c19986019e28f7c00ac8132da4eb0fe393b057
135
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
136
+ awesome_print (1.9.2) sha256=e99b32b704acff16d768b3468680793ced40bfdc4537eb07e06a4be11133786e
137
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
138
+ bigdecimal (3.3.1) sha256=eaa01e228be54c4f9f53bf3cc34fe3d5e845c31963e7fcc5bedb05a4e7d52218
139
+ bridgeapi_client (1.0.1)
140
+ coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
141
+ concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
142
+ connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
143
+ crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e
144
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
145
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
146
+ hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1
147
+ i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
148
+ io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
149
+ json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
150
+ language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
151
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
152
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
153
+ method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
154
+ minitest (6.0.1) sha256=7854c74f48e2e975969062833adc4013f249a4b212f5e7b9d5c040bf838d54bb
155
+ parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
156
+ parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
157
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
158
+ pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
159
+ public_suffix (7.0.2) sha256=9114090c8e4e7135c1fd0e7acfea33afaab38101884320c65aaa0ffb8e26a857
160
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
161
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
162
+ rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
163
+ regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
164
+ reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
165
+ rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
166
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
167
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
168
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
169
+ rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
170
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
171
+ rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a
172
+ rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
173
+ rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
174
+ rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
175
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
176
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
177
+ shoulda-matchers (7.0.1) sha256=b4bfd8744c10e0a36c8ac1a687f921ee7e25ed529e50488d61b79a8688749c77
178
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
179
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
180
+ unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
181
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
182
+ vcr (6.4.0) sha256=077ac92cc16efc5904eb90492a18153b5e6ca5398046d8a249a7c96a9ea24ae6
183
+ webmock (3.26.1) sha256=4f696fb57c90a827c20aadb2d4f9058bbff10f7f043bd0d4c3f58791143b1cd7
184
+
185
+ BUNDLED WITH
186
+ 4.0.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Neatops
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,229 @@
1
+ <p align="center">
2
+ <img width="500" src="https://user-images.githubusercontent.com/112219/103307983-5fe04500-49df-11eb-9618-1f9704b2f460.png" alt="Bankin Bridge Logo">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://badge.fury.io/rb/bridge_api">
7
+ <img src="https://badge.fury.io/rb/bridge_api.svg" alt="Gem Version">
8
+ </a>
9
+ <a href="https://github.com/neatops/bridge_api/actions?query=workflow%3ACI">
10
+ <img src="https://github.com/neatops/bridge_api/workflows/CI/badge.svg" alt="CI Status">
11
+ </a>
12
+ <a href="https://github.com/neatops/bridge_api/actions?query=workflow%3ARuboCop">
13
+ <img src="https://github.com/neatops/bridge_api/workflows/RuboCop/badge.svg" alt="Rubocop Status">
14
+ </a>
15
+ <a href="https://rubydoc.info/github/neatops/bridge_api/main">
16
+ <img src="https://img.shields.io/badge/yard-docs-blue.svg" alt="RubyDoc Link">
17
+ </a>
18
+ </p>
19
+
20
+ <br />
21
+
22
+ This gem is an **unofficial Ruby client** that consumes the [Bridge by Bankin’ API](https://bridgeapi.io/).
23
+
24
+ Thanks to a safe and automated access to bank data, Bridge powered by Bankin’ provides
25
+ competitive and smart solutions to build conversion-driver financial services.
26
+
27
+ You'll find more information about Bridge API in the [official documentations](https://docs.bridgeapi.io/).
28
+
29
+ ## Installation
30
+
31
+ Add this line to your application’s Gemfile:
32
+
33
+ ```ruby
34
+ gem 'bridge_api'
35
+ ```
36
+
37
+ And then execute:
38
+
39
+ $ bundle install
40
+
41
+ Or install it yourself as:
42
+
43
+ $ gem install bridge_api
44
+
45
+ ## Usage
46
+
47
+ ### Requirements
48
+
49
+ To begin using the API with this gem, you need to create an account to the dashboard on the [Bridge website](https://dashboard.bridgeapi.io/signup).
50
+ Then you’ll have to create a new `application` and generate the required API credentials: a `client_id` and `client_secret`.
51
+ You can find more information about this process by visiting the [Bridge API Dashboard documentation](https://docs.bridgeapi.io/docs/dashboard).
52
+
53
+ ### Getting started
54
+
55
+ One you have your valid API credential you can now create an initializer in your app like this:
56
+
57
+ ```ruby
58
+ BridgeApi.configure do |config|
59
+ config.api_client_id = ENV["BRIDGE_API_CLIENT_ID"]
60
+ config.api_client_secret = ENV["BRIDGE_API_CLIENT_SECRET"]
61
+ config.follow_pages = true
62
+ end
63
+ ```
64
+
65
+ Feel free to replace those environment variables by whatever values that work for you.
66
+
67
+ Some resources are public (banks and categories) meaning that only provided the `client_id` and `client_secret` are required.
68
+ Here is an example on how you can use this gem to fetch the banks:
69
+
70
+ ```ruby
71
+ BridgeApi::Bank.list
72
+ => [#<BridgeApi::BridgeObject:0x00007fbb0727c620
73
+ @country_code="DE",
74
+ @parent_banks=
75
+ [#<BridgeApi::BridgeObject:0x00007fbb0727c148
76
+ @banks=
77
+ [#<BridgeApi::Bank:0x00007fbad702f6b8
78
+ @authentication_type="INTERNAL_CREDS",
79
+ @automatic_refresh=true,
80
+ @capabilities=["ais"],
81
+ @country_code="DE",
82
+ @deeplink_android=nil,
83
+ @deeplink_ios=nil,
84
+ @form=[#<BridgeApi::BridgeObject:0x00007fbad702cf30 @isNum="0", @label="Email", @maxLength=nil, @type="USER">, #<BridgeApi::BridgeObject:0x00007fbad702c648 @isNum="0", @label="Password", @maxLength=nil, @type="PWD">],
85
+ @id=457,
86
+ @logo_url="https://web.bankin.com/img/banks-logo/neo/04N26@2x.png",
87
+ @name="N26 (Number 26) DE",
88
+ @payment_enabled=false,
89
+ @primary_color=nil,
90
+ @secondary_color=nil,
91
+ @transfer_enabled=false>],
92
+ @display_order=0,
93
+ @is_highlighted=false,
94
+ @logo_url="https://web.bankin.com/img/banks-logo/neo/04N26@2x.png",
95
+ @name="N26 (Number 26) DE">,
96
+ ...]
97
+ ...]
98
+ ...]
99
+ ```
100
+
101
+ But the majority of the resources need a logged in user. Here is how to create one using the gem:
102
+
103
+ ```ruby
104
+ BridgeApi::User.create(email: "john.doe@email.com", password: "password123!")
105
+ => #<BridgeApi::User:0x00007fbb07c5e990 @email="john.doe@email.com", @uuid="f974389d-1442-48bb-bb5e-ac62d1a96984">
106
+ ```
107
+
108
+ Then you can generate an `access_token` for this user by using the `Authorization` class:
109
+
110
+ ```ruby
111
+ BridgeApi::Authorization.generate_token(email: "john.doe@email.com", password: "password123!")
112
+ => #<BridgeApi::Authorization:0x00007fbb07967f48 @access_token="58b0195d943f9a3e8433cda7dea48a70339eafc6-5fe7c375-873b-4b0d-bcff-4541c1e19488", @expires_at=2020-12-29 21:35:28.97 UTC>
113
+ ```
114
+
115
+ Since the majority of endpoints are private, you’ll need to pass a valid `access_token` each time you request them.
116
+ Here is how it works with the user we previously created:
117
+
118
+ ```ruby
119
+ BridgeApi::Transaction.list(access_token: auth.access_token)
120
+ => [#<BridgeApi::Transaction:0x00007fbb0002d948
121
+ @account=#<BridgeApi::Account:0x00007fbb0002c250 @id=22271302>,
122
+ @amount=-676.0,
123
+ @category=#<BridgeApi::Category:0x00007fbb0002c520 @id=79>,
124
+ @currency_code="EUR",
125
+ @date=#<Date: 2021-01-02 ((2459217j,0s,0n),+0s,2299161j)>,
126
+ @description="Achat De Titres",
127
+ @id=38000214608599,
128
+ @is_deleted=false,
129
+ @is_future=true,
130
+ @raw_description="ACHAT DE TITRES - 020121",
131
+ @show_client_side=true,
132
+ @updated_at=2020-12-29 19:40:50.942 UTC>,
133
+ #<BridgeApi::Transaction:0x00007fbb00023da8
134
+ @account=#<BridgeApi::Account:0x00007fbb000229f8 @id=22271298>,
135
+ @amount=170.0,
136
+ @category=#<BridgeApi::Category:0x00007fbb00022c50 @id=289>,
137
+ @currency_code="EUR",
138
+ @date=#<Date: 2021-01-02 ((2459217j,0s,0n),+0s,2299161j)>,
139
+ @description="Economies",
140
+ @id=38000214608462,
141
+ @is_deleted=false,
142
+ @is_future=true,
143
+ @raw_description="Economies - 020121",
144
+ @show_client_side=true,
145
+ @updated_at=2020-12-29 19:40:49.564 UTC>,
146
+ ...
147
+ ]
148
+ ```
149
+
150
+ If you need more information on how the API works or which parameters you can use for a specific query, we really encourage you to consult the great [official guides](https://docs.bridgeapi.io/docs).
151
+
152
+ ### Parameters
153
+
154
+ ##### Mandatory parameters
155
+
156
+ In some case you'll need to specify some parameters to complete your request.
157
+ For instance, in order to retrieve a specific `user`, it requires you to pass the user's `UUID`:
158
+
159
+ ```ruby
160
+ BridgeApi::User.find(uuid: "f974389d-1442-48bb-bb5e-ac62d1a96984")
161
+ => #<BridgeApi::User:0x00007fbb07febf90 @email="john.doe@email.com", @uuid="f974389d-1442-48bb-bb5e-ac62d1a96984">
162
+ ```
163
+
164
+ Note that in some case, the API uses basic sequential `IDs` instead of `UUIDs`. In that case just replace `uuid` key by `id`:
165
+
166
+ ```ruby
167
+ BridgeApi::Bank.find(id: 457)
168
+ => #<BridgeApi::Bank:0x00007fbb07ec64d0
169
+ @authentication_type="INTERNAL_CREDS",
170
+ @automatic_refresh=true,
171
+ @capabilities=["ais"],
172
+ @country_code="DE",
173
+ @deeplink_android=nil,
174
+ @deeplink_ios=nil,
175
+ @form=[#<BridgeApi::BridgeObject:0x00007fbb07ec5968 @isNum="0", @label="Email", @maxLength=nil, @type="USER">, #<BridgeApi::BridgeObject:0x00007fbb07ec54b8 @isNum="0", @label="Password", @maxLength=nil, @type="PWD">],
176
+ @id=457,
177
+ @logo_url="https://web.bankin.com/img/banks-logo/neo/04N26@2x.png",
178
+ @name="N26 (Number 26) DE",
179
+ @payment_enabled=false,
180
+ @primary_color=nil,
181
+ @secondary_color=nil,
182
+ @transfer_enabled=false>
183
+ ```
184
+
185
+ ##### Optional parameters
186
+
187
+ The gem resources also allows you to pass any optional parameters supported by the API (see [Official Documentation](https://docs.bridgeapi.io/docs/overview)).
188
+ To do so, just pass them as `named parameters` in corresponding resource class method:
189
+
190
+ ```ruby
191
+ BridgeApi::Bank.list(limit: 1)
192
+ => [#<BridgeApi::BridgeObject:0x00007fbb07b4c228
193
+ @country_code="FR",
194
+ @parent_banks=
195
+ [#<BridgeApi::BridgeObject:0x00007fbb07b4c070
196
+ @banks=
197
+ [#<BridgeApi::Bank:0x00007fbb07b27d38
198
+ @authentication_type="INTERNAL_CREDS",
199
+ @automatic_refresh=true,
200
+ @capabilities=["ais"],
201
+ @country_code="FR",
202
+ @deeplink_android=nil,
203
+ @deeplink_ios=nil,
204
+ @form=[#<BridgeApi::BridgeObject:0x00007fbb07b271a8 @isNum="1", @label="Identifiant", @maxLength=nil, @type="USER">, #<BridgeApi::BridgeObject:0x00007fbb07b26cd0 @isNum="0", @label="Mot de passe", @maxLength=nil, @type="PWD">],
205
+ @id=486,
206
+ @logo_url="https://web.bankin.com/img/banks-logo/france/themis.png",
207
+ @name="Themis Banque",
208
+ @payment_enabled=false,
209
+ @primary_color=nil,
210
+ @secondary_color=nil,
211
+ @transfer_enabled=false>],
212
+ @display_order=0,
213
+ @is_highlighted=false,
214
+ @logo_url="https://web.bankin.com/img/banks-logo/france/themis.png",
215
+ @name="Themis Banque">]>]
216
+ ```
217
+
218
+ ## Development
219
+
220
+ If you need more detailed informations regarding the gem source code you can find more in the official [RubyDoc](https://rubydoc.info/github/neatops/bridge_api/main).
221
+
222
+ ## Contributing
223
+
224
+ We're convinced this gem could be improved a lot or simply not cover every needs you have. That's why contributions of any kind is very encouraged.
225
+ Bug reports and pull requests are welcome on GitHub at https://github.com/neatops/bridge_api. This project is intended to be a safe, welcoming space for collaboration.
226
+
227
+ ## License
228
+
229
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]