active_call-doc_fox 0.1.0 → 0.1.2
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/.rubocop.yml +8 -0
- data/CHANGELOG.md +10 -2
- data/README.md +22 -7
- data/lib/doc_fox/access_token/get_service.rb +3 -1
- data/lib/doc_fox/authentication/get_service.rb +3 -1
- data/lib/doc_fox/base_service.rb +24 -8
- data/lib/doc_fox/concerns/enumerable.rb +2 -0
- data/lib/doc_fox/kyc_application/get_service.rb +2 -2
- data/lib/doc_fox/kyc_entity_template/get_service.rb +2 -2
- data/lib/doc_fox/user/get_service.rb +2 -2
- data/lib/doc_fox/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da9b1a766d5bdb3e7d9ead4e0bd2887b7beb0b7b09456c411b338d7ec76c19e0
|
4
|
+
data.tar.gz: 99b83630296bc23024850639b8078a2d9662e85b41a5f0672929ae4b3e2cd0dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7638777bef5355e94885377332aad31c80fa7e3fd448c25572016eb3fd56812cb87992cc11e21ab00696bf34dfcf5181c58aaf16cea389fc639b203b411e70d6
|
7
|
+
data.tar.gz: 3c06cda91a960387883b3ff239fbcdb80fc0a5aa789710a150e560e45e7336cdc6a7109a997b2742e01e5de5183f0e07be8e4cb9a6c3f2cf6322a0cb9f6704aa
|
data/.rubocop.yml
CHANGED
@@ -19,6 +19,10 @@ Layout/HashAlignment:
|
|
19
19
|
EnforcedHashRocketStyle: table
|
20
20
|
EnforcedColonStyle: table
|
21
21
|
|
22
|
+
Layout/LineLength:
|
23
|
+
AllowedPatterns:
|
24
|
+
- initialize
|
25
|
+
|
22
26
|
Lint/MissingSuper:
|
23
27
|
Enabled: false
|
24
28
|
|
@@ -39,6 +43,10 @@ Metrics/CyclomaticComplexity:
|
|
39
43
|
Metrics/MethodLength:
|
40
44
|
Enabled: false
|
41
45
|
|
46
|
+
Metrics/PerceivedComplexity:
|
47
|
+
Exclude:
|
48
|
+
- lib/doc_fox/concerns/enumerable.rb
|
49
|
+
|
42
50
|
Naming/FileName:
|
43
51
|
Exclude:
|
44
52
|
- lib/active_call-doc_fox.rb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
-
## [
|
1
|
+
## [0.1.2] - 2025-04-05
|
2
2
|
|
3
|
-
|
3
|
+
- Set access token in before_call hook instead of lambda so we can capture errors from the access token service objects.
|
4
|
+
- Fixed empty list enumerable errors.
|
5
|
+
|
6
|
+
## [0.1.1] - 2025-04-02
|
7
|
+
|
8
|
+
- Fix `source_code_uri` and `changelog_uri` link in gemspec.
|
9
|
+
|
10
|
+
## [0.1.0] - 2025-04-02
|
4
11
|
|
5
12
|
- Initial release
|
13
|
+
- Intial `DocFox::KycApplication`, `DocFox::KycEntityTemplate` and `DocFox::User` service objects
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Active Call - nCino KYC DocFox
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/active_call-doc_fox)
|
4
|
+
|
3
5
|
DocFox exposes the [nCino KYC DocFox API](https://www.docfoxapp.com/api/v2/documentation) endpoints through service objects.
|
4
6
|
|
5
7
|
- [Installation](#installation)
|
@@ -9,27 +11,23 @@ DocFox exposes the [nCino KYC DocFox API](https://www.docfoxapp.com/api/v2/docum
|
|
9
11
|
- [Using call!](#using-call!)
|
10
12
|
- [When to use call or call!](#using-call-or-call!)
|
11
13
|
- [Using lists](#using-lists)
|
12
|
-
|
13
|
-
- [KYC Entity Templates](#kyc-entity-templates)
|
14
|
-
- [Users](#users)
|
14
|
+
- [Service Objects](#service-objects)
|
15
15
|
- [Development](#development)
|
16
16
|
- [Contributing](#contributing)
|
17
17
|
- [License](#license)
|
18
18
|
|
19
19
|
## Installation
|
20
20
|
|
21
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
22
|
-
|
23
21
|
Install the gem and add to the application's Gemfile by executing:
|
24
22
|
|
25
23
|
```bash
|
26
|
-
bundle add
|
24
|
+
bundle add active_call-doc_fox
|
27
25
|
```
|
28
26
|
|
29
27
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
30
28
|
|
31
29
|
```bash
|
32
|
-
gem install
|
30
|
+
gem install active_call-doc_fox
|
33
31
|
```
|
34
32
|
|
35
33
|
## Configuration
|
@@ -205,6 +203,11 @@ end
|
|
205
203
|
|
206
204
|
If you don't provide the `per_page` argument, multiple API requests will be made untill all records have been returned. You could be rate limited, so use wisely.
|
207
205
|
|
206
|
+
## Service Objects
|
207
|
+
|
208
|
+
<details open>
|
209
|
+
<summary>KYC Applications</summary>
|
210
|
+
|
208
211
|
### KYC Applications
|
209
212
|
|
210
213
|
#### List KYC applications
|
@@ -296,6 +299,11 @@ service = DocFox::KycApplication::UnarchiveService.call(id: '', reason: '')
|
|
296
299
|
service = DocFox::KycApplication::DeleteService.call(id: '')
|
297
300
|
```
|
298
301
|
|
302
|
+
</details>
|
303
|
+
|
304
|
+
<details>
|
305
|
+
<summary>KYC Entity Templates</summary>
|
306
|
+
|
299
307
|
### KYC Entity Templates
|
300
308
|
|
301
309
|
#### List KYC entity templates
|
@@ -318,6 +326,11 @@ service.profile_schema
|
|
318
326
|
...
|
319
327
|
```
|
320
328
|
|
329
|
+
</details>
|
330
|
+
|
331
|
+
<details>
|
332
|
+
<summary>Users</summary>
|
333
|
+
|
321
334
|
### Users
|
322
335
|
|
323
336
|
#### List users
|
@@ -340,6 +353,8 @@ service.deactivated
|
|
340
353
|
...
|
341
354
|
```
|
342
355
|
|
356
|
+
</details>
|
357
|
+
|
343
358
|
## Development
|
344
359
|
|
345
360
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -7,6 +7,8 @@ class DocFox::AccessToken::GetService < DocFox::BaseService
|
|
7
7
|
errors.merge!(authentication_service.errors) unless authentication_service.success?
|
8
8
|
end
|
9
9
|
|
10
|
+
skip_callback :call, :before, :set_access_token
|
11
|
+
|
10
12
|
before_call :authenticate
|
11
13
|
|
12
14
|
after_call :set_facade
|
@@ -30,7 +32,6 @@ class DocFox::AccessToken::GetService < DocFox::BaseService
|
|
30
32
|
|
31
33
|
def connection
|
32
34
|
@_connection ||= Faraday.new do |conn|
|
33
|
-
conn.adapter Faraday.default_adapter
|
34
35
|
conn.url_prefix = base_url
|
35
36
|
conn.headers['X-Client-Api-Key'] = api_key
|
36
37
|
conn.headers['X-Client-Signature'] = signature
|
@@ -42,6 +43,7 @@ class DocFox::AccessToken::GetService < DocFox::BaseService
|
|
42
43
|
logger.filter(/(X-Client-Signature:).*"(.+)."/i, '\1 [FILTERED]')
|
43
44
|
logger.filter(/"token":"([^"]+)"/i, '"token":"[FILTERED]"')
|
44
45
|
end
|
46
|
+
conn.adapter Faraday.default_adapter
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class DocFox::Authentication::GetService < DocFox::BaseService
|
4
|
+
skip_callback :call, :before, :set_access_token
|
5
|
+
|
4
6
|
after_call :set_facade
|
5
7
|
|
6
8
|
delegate_missing_to :@facade
|
@@ -22,7 +24,6 @@ class DocFox::Authentication::GetService < DocFox::BaseService
|
|
22
24
|
|
23
25
|
def connection
|
24
26
|
@_connection ||= Faraday.new do |conn|
|
25
|
-
conn.adapter Faraday.default_adapter
|
26
27
|
conn.url_prefix = base_url
|
27
28
|
conn.headers['X-Client-Api-Key'] = api_key
|
28
29
|
conn.request :json
|
@@ -32,6 +33,7 @@ class DocFox::Authentication::GetService < DocFox::BaseService
|
|
32
33
|
logger.filter(/(X-Client-Api-Key:).*"(.+)."/i, '\1 [FILTERED]')
|
33
34
|
logger.filter(/"nonce":"([^"]+)"/i, '"nonce":"[FILTERED]"')
|
34
35
|
end
|
36
|
+
conn.adapter Faraday.default_adapter
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
data/lib/doc_fox/base_service.rb
CHANGED
@@ -15,7 +15,15 @@ class DocFox::BaseService < ActiveCall::Base
|
|
15
15
|
config_accessor :log_bodies, default: false, instance_writer: false
|
16
16
|
config_accessor :api_key, :secret, instance_writer: false
|
17
17
|
|
18
|
-
attr_reader :facade
|
18
|
+
attr_reader :access_token, :facade
|
19
|
+
|
20
|
+
before_call :set_access_token
|
21
|
+
|
22
|
+
validate on: :request do
|
23
|
+
next if is_a?(DocFox::AccessToken::GetService) || is_a?(DocFox::Authentication::GetService)
|
24
|
+
|
25
|
+
errors.merge!(access_token_service.errors) if access_token.nil? && !access_token_service.success?
|
26
|
+
end
|
19
27
|
|
20
28
|
class << self
|
21
29
|
def exception_mapping
|
@@ -48,15 +56,15 @@ class DocFox::BaseService < ActiveCall::Base
|
|
48
56
|
|
49
57
|
def connection
|
50
58
|
@_connection ||= Faraday.new do |conn|
|
51
|
-
conn.adapter Faraday.default_adapter
|
52
59
|
conn.url_prefix = base_url
|
53
|
-
conn.request :authorization, 'Bearer',
|
60
|
+
conn.request :authorization, 'Bearer', access_token
|
54
61
|
conn.request :json
|
55
62
|
conn.request :retry
|
56
63
|
conn.response :json
|
57
64
|
conn.response :logger, logger, **logger_options do |logger|
|
58
65
|
logger.filter(/(Authorization:).*"(.+)."/i, '\1 [FILTERED]')
|
59
66
|
end
|
67
|
+
conn.adapter Faraday.default_adapter
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
@@ -69,11 +77,19 @@ class DocFox::BaseService < ActiveCall::Base
|
|
69
77
|
}
|
70
78
|
end
|
71
79
|
|
72
|
-
def
|
73
|
-
access_token = cache.read(CACHE_KEY[:access_token])
|
74
|
-
return
|
80
|
+
def set_access_token
|
81
|
+
@access_token = cache.read(CACHE_KEY[:access_token])
|
82
|
+
return if @access_token.present?
|
83
|
+
return unless access_token_service.success?
|
84
|
+
|
85
|
+
expires_at = Time.parse(access_token_service.expires_at)
|
86
|
+
|
87
|
+
@access_token = cache.fetch(CACHE_KEY[:access_token], expires_at: expires_at - 10) do
|
88
|
+
access_token_service.token
|
89
|
+
end
|
90
|
+
end
|
75
91
|
|
76
|
-
|
77
|
-
|
92
|
+
def access_token_service
|
93
|
+
@_access_token_service ||= DocFox::AccessToken::GetService.call
|
78
94
|
end
|
79
95
|
end
|
@@ -3,12 +3,12 @@
|
|
3
3
|
class DocFox::KycApplication::GetService < DocFox::BaseService
|
4
4
|
attr_reader :id, :params
|
5
5
|
|
6
|
+
validates :id, presence: true
|
7
|
+
|
6
8
|
after_call :set_facade
|
7
9
|
|
8
10
|
delegate_missing_to :@facade
|
9
11
|
|
10
|
-
validates :id, presence: true
|
11
|
-
|
12
12
|
def initialize(id:, params: {})
|
13
13
|
@id = id
|
14
14
|
@params = params
|
@@ -3,12 +3,12 @@
|
|
3
3
|
class DocFox::KycEntityTemplate::GetService < DocFox::BaseService
|
4
4
|
attr_reader :id
|
5
5
|
|
6
|
+
validates :id, presence: true
|
7
|
+
|
6
8
|
after_call :set_facade
|
7
9
|
|
8
10
|
delegate_missing_to :@facade
|
9
11
|
|
10
|
-
validates :id, presence: true
|
11
|
-
|
12
12
|
def initialize(id:)
|
13
13
|
@id = id
|
14
14
|
end
|
data/lib/doc_fox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_call-doc_fox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kobus Joubert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_call-api
|
@@ -85,8 +85,8 @@ metadata:
|
|
85
85
|
allowed_push_host: https://rubygems.org
|
86
86
|
rubygems_mfa_required: 'true'
|
87
87
|
homepage_uri: https://github.com/kobusjoubert/doc_fox
|
88
|
-
source_code_uri: https://github.com/kobusjoubert/
|
89
|
-
changelog_uri: https://github.com/kobusjoubert/
|
88
|
+
source_code_uri: https://github.com/kobusjoubert/doc_fox
|
89
|
+
changelog_uri: https://github.com/kobusjoubert/doc_fox/blob/main/CHANGELOG.md
|
90
90
|
post_install_message:
|
91
91
|
rdoc_options: []
|
92
92
|
require_paths:
|