active_call-doc_fox 0.1.0

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 (35) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +70 -0
  4. data/CHANGELOG.md +5 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +355 -0
  7. data/Rakefile +12 -0
  8. data/lib/active_call-doc_fox.rb +3 -0
  9. data/lib/doc_fox/access_token/facade.rb +12 -0
  10. data/lib/doc_fox/access_token/get_service.rb +62 -0
  11. data/lib/doc_fox/authentication/facade.rb +12 -0
  12. data/lib/doc_fox/authentication/get_service.rb +41 -0
  13. data/lib/doc_fox/base_service.rb +79 -0
  14. data/lib/doc_fox/concerns/enumerable.rb +65 -0
  15. data/lib/doc_fox/error.rb +67 -0
  16. data/lib/doc_fox/kyc_application/approve_service.rb +53 -0
  17. data/lib/doc_fox/kyc_application/archive_service.rb +43 -0
  18. data/lib/doc_fox/kyc_application/create_service.rb +61 -0
  19. data/lib/doc_fox/kyc_application/delete_service.rb +29 -0
  20. data/lib/doc_fox/kyc_application/facade.rb +22 -0
  21. data/lib/doc_fox/kyc_application/get_service.rb +52 -0
  22. data/lib/doc_fox/kyc_application/list_service.rb +46 -0
  23. data/lib/doc_fox/kyc_application/transfer_service.rb +56 -0
  24. data/lib/doc_fox/kyc_application/unapprove_service.rb +56 -0
  25. data/lib/doc_fox/kyc_application/unarchive_service.rb +43 -0
  26. data/lib/doc_fox/kyc_entity_template/facade.rb +17 -0
  27. data/lib/doc_fox/kyc_entity_template/get_service.rb +43 -0
  28. data/lib/doc_fox/kyc_entity_template/list_service.rb +28 -0
  29. data/lib/doc_fox/user/facade.rb +16 -0
  30. data/lib/doc_fox/user/get_service.rb +43 -0
  31. data/lib/doc_fox/user/list_service.rb +28 -0
  32. data/lib/doc_fox/version.rb +5 -0
  33. data/lib/doc_fox.rb +16 -0
  34. data/sig/doc_fox.rbs +4 -0
  35. metadata +109 -0
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DocFox::User::Facade
4
+ attr_reader :id, :attributes, :deactivated, :deactivation_date, :email, :first_names, :last_names
5
+
6
+ def initialize(hash)
7
+ @id = hash.dig('data', 'id') || hash['id']
8
+ @attributes = hash.dig('data', 'attributes') || hash['attributes']
9
+
10
+ @deactivated = attributes['deactivated']
11
+ @deactivation_date = attributes['deactivation_date']
12
+ @email = attributes['email']
13
+ @first_names = attributes['first_names']
14
+ @last_names = attributes['last_names']
15
+ end
16
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DocFox::User::GetService < DocFox::BaseService
4
+ attr_reader :id
5
+
6
+ after_call :set_facade
7
+
8
+ delegate_missing_to :@facade
9
+
10
+ validates :id, presence: true
11
+
12
+ def initialize(id:)
13
+ @id = id
14
+ end
15
+
16
+ # Get a user.
17
+ #
18
+ # ==== Examples
19
+ #
20
+ # service = DocFox::User::GetService.call(id: '')
21
+ #
22
+ # service.success? # => true
23
+ # service.errors # => #<ActiveModel::Errors []>
24
+ #
25
+ # service.response # => #<Faraday::Response ...>
26
+ # service.response.status # => 200
27
+ # service.response.body # => {}
28
+ #
29
+ # service.facade # => #<DocFox::User::Facade ...>
30
+ # service.facade.id
31
+ # service.id
32
+ #
33
+ # GET /api/v2/users/:id
34
+ def call
35
+ connection.get("users/#{id}")
36
+ end
37
+
38
+ private
39
+
40
+ def set_facade
41
+ @facade = DocFox::User::Facade.new(response.body)
42
+ end
43
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DocFox::User::ListService < DocFox::BaseService
4
+ include DocFox::Enumerable
5
+
6
+ # List users.
7
+ #
8
+ # ==== Examples
9
+ #
10
+ # service = DocFox::User::ListService.call.first
11
+ # service.id
12
+ # service.email
13
+ #
14
+ # If you don't provide the `per_page` argument, multiple API requests will be made untill all records have been
15
+ # returned. You could be rate limited, so use wisely.
16
+ #
17
+ # DocFox::User::ListService.call(page: 1, per_page: 10).map { _1 }
18
+ #
19
+ # GET /api/v2/users
20
+ def initialize(page: 1, per_page: Float::INFINITY)
21
+ super(
22
+ path: 'users',
23
+ facade_klass: DocFox::User::Facade,
24
+ page: page,
25
+ per_page: per_page
26
+ )
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DocFox
4
+ VERSION = '0.1.0'
5
+ end
data/lib/doc_fox.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_call'
4
+ require 'active_call/api'
5
+ require 'active_support/core_ext/time'
6
+
7
+ loader = Zeitwerk::Loader.for_gem
8
+ loader.ignore("#{__dir__}/active_call-doc_fox.rb")
9
+ loader.ignore("#{__dir__}/doc_fox/error.rb")
10
+ loader.collapse("#{__dir__}/doc_fox/concerns")
11
+ loader.setup
12
+
13
+ require_relative 'doc_fox/error'
14
+ require_relative 'doc_fox/version'
15
+
16
+ module DocFox; end
data/sig/doc_fox.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module DocFox
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_call-doc_fox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kobus Joubert
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-04-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: active_call-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: openssl
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.3'
41
+ description: DocFox exposes the nCino KYC DocFox API endpoints through service objects.
42
+ email:
43
+ - kobus@translate3d.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".rspec"
49
+ - ".rubocop.yml"
50
+ - CHANGELOG.md
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - lib/active_call-doc_fox.rb
55
+ - lib/doc_fox.rb
56
+ - lib/doc_fox/access_token/facade.rb
57
+ - lib/doc_fox/access_token/get_service.rb
58
+ - lib/doc_fox/authentication/facade.rb
59
+ - lib/doc_fox/authentication/get_service.rb
60
+ - lib/doc_fox/base_service.rb
61
+ - lib/doc_fox/concerns/enumerable.rb
62
+ - lib/doc_fox/error.rb
63
+ - lib/doc_fox/kyc_application/approve_service.rb
64
+ - lib/doc_fox/kyc_application/archive_service.rb
65
+ - lib/doc_fox/kyc_application/create_service.rb
66
+ - lib/doc_fox/kyc_application/delete_service.rb
67
+ - lib/doc_fox/kyc_application/facade.rb
68
+ - lib/doc_fox/kyc_application/get_service.rb
69
+ - lib/doc_fox/kyc_application/list_service.rb
70
+ - lib/doc_fox/kyc_application/transfer_service.rb
71
+ - lib/doc_fox/kyc_application/unapprove_service.rb
72
+ - lib/doc_fox/kyc_application/unarchive_service.rb
73
+ - lib/doc_fox/kyc_entity_template/facade.rb
74
+ - lib/doc_fox/kyc_entity_template/get_service.rb
75
+ - lib/doc_fox/kyc_entity_template/list_service.rb
76
+ - lib/doc_fox/user/facade.rb
77
+ - lib/doc_fox/user/get_service.rb
78
+ - lib/doc_fox/user/list_service.rb
79
+ - lib/doc_fox/version.rb
80
+ - sig/doc_fox.rbs
81
+ homepage: https://github.com/kobusjoubert/doc_fox
82
+ licenses:
83
+ - MIT
84
+ metadata:
85
+ allowed_push_host: https://rubygems.org
86
+ rubygems_mfa_required: 'true'
87
+ homepage_uri: https://github.com/kobusjoubert/doc_fox
88
+ source_code_uri: https://github.com/kobusjoubert/dox_fox
89
+ changelog_uri: https://github.com/kobusjoubert/dox_fox/blob/main/CHANGELOG.md
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 3.1.0
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.3.27
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: DocFox
109
+ test_files: []