active_call-doc_fox 0.1.1 → 0.2.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -0
  3. data/CHANGELOG.md +17 -2
  4. data/README.md +445 -17
  5. data/lib/doc_fox/access_token/get_service.rb +5 -1
  6. data/lib/doc_fox/authentication/get_service.rb +7 -1
  7. data/lib/doc_fox/base_service.rb +25 -8
  8. data/lib/doc_fox/concerns/enumerable.rb +3 -1
  9. data/lib/doc_fox/data_requirement/facade.rb +25 -0
  10. data/lib/doc_fox/data_requirement/get_service.rb +53 -0
  11. data/lib/doc_fox/data_requirement/list_service.rb +67 -0
  12. data/lib/doc_fox/document/download_service.rb +81 -0
  13. data/lib/doc_fox/document/facade.rb +22 -0
  14. data/lib/doc_fox/document/get_service.rb +54 -0
  15. data/lib/doc_fox/document/list_service.rb +36 -0
  16. data/lib/doc_fox/document/upload_service.rb +62 -0
  17. data/lib/doc_fox/document_token/create_service.rb +57 -0
  18. data/lib/doc_fox/document_token/facade.rb +15 -0
  19. data/lib/doc_fox/document_token/get_service.rb +46 -0
  20. data/lib/doc_fox/document_token/list_service.rb +36 -0
  21. data/lib/doc_fox/evidence_submission/approve_service.rb +54 -0
  22. data/lib/doc_fox/evidence_submission/facade.rb +20 -0
  23. data/lib/doc_fox/evidence_submission/get_service.rb +54 -0
  24. data/lib/doc_fox/evidence_submission/list_service.rb +36 -0
  25. data/lib/doc_fox/evidence_submission/reject_service.rb +58 -0
  26. data/lib/doc_fox/evidence_submission/replace_service.rb +54 -0
  27. data/lib/doc_fox/evidence_submission/update_service.rb +95 -0
  28. data/lib/doc_fox/kyc_application/approve_service.rb +2 -0
  29. data/lib/doc_fox/kyc_application/archive_service.rb +2 -0
  30. data/lib/doc_fox/kyc_application/create_service.rb +2 -0
  31. data/lib/doc_fox/kyc_application/delete_service.rb +2 -0
  32. data/lib/doc_fox/kyc_application/get_service.rb +5 -3
  33. data/lib/doc_fox/kyc_application/list_service.rb +2 -0
  34. data/lib/doc_fox/kyc_application/transfer_service.rb +2 -0
  35. data/lib/doc_fox/kyc_application/unapprove_service.rb +2 -0
  36. data/lib/doc_fox/kyc_application/unarchive_service.rb +2 -0
  37. data/lib/doc_fox/kyc_entity_template/get_service.rb +4 -2
  38. data/lib/doc_fox/kyc_entity_template/list_service.rb +2 -0
  39. data/lib/doc_fox/profile/facade.rb +15 -0
  40. data/lib/doc_fox/profile/get_service.rb +53 -0
  41. data/lib/doc_fox/profile/list_service.rb +36 -0
  42. data/lib/doc_fox/status_summary/facade.rb +14 -0
  43. data/lib/doc_fox/status_summary/get_service.rb +47 -0
  44. data/lib/doc_fox/user/get_service.rb +4 -2
  45. data/lib/doc_fox/user/list_service.rb +2 -0
  46. data/lib/doc_fox/version.rb +1 -1
  47. data/lib/doc_fox.rb +1 -0
  48. metadata +40 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 628b59bc4c362f6a5caab2386b8016e4d1fcfe4e75dd5b99dd0ba008533b2c80
4
- data.tar.gz: c067179a7335e1cb214f42770bd58caaede0579a37df5c5295a16333c705b943
3
+ metadata.gz: 03e0ba0383b10c32d4db8d54c218218af2a0b88c7c424a55962a66030dd2759a
4
+ data.tar.gz: e3a1da533e017f392cdc428e37f1c5142a25105aaeb32b8f04224bffe499bcb7
5
5
  SHA512:
6
- metadata.gz: 9d066ed5880a5d588fd6bd17c9ac98c09eb112b03909d97fb07675fd4252520b5facbbf062788ffc85b81eebd837da3c0e6519f2e8ed4feca3b224a168251632
7
- data.tar.gz: b7e3b3d89e1ef3482de466858b020767103ad34ab310e350e8d0c6449327986d8ce1e8ab1c894bd526688c01feea2be089c5d836b91e45917049e2101465d443
6
+ metadata.gz: 59c45a9756e5dece42d132e3cb4dd14af215454c6811874a804e5608e5693f5213a747fd00db86d2d60477cf7c2febb7c8df821f4a2afaea10c278c9d44ab42f
7
+ data.tar.gz: '080c8f01dd88a9dd8ba3a136d7e763d0d4599077f02bfc4f3572a4594937d19859bf3da7b188f1c22d2607bbc6448fd4ad12dded10a718539d4f1528b80bee59'
data/.rubocop.yml CHANGED
@@ -19,6 +19,11 @@ Layout/HashAlignment:
19
19
  EnforcedHashRocketStyle: table
20
20
  EnforcedColonStyle: table
21
21
 
22
+ Layout/LineLength:
23
+ AllowedPatterns:
24
+ - initialize
25
+ - '#'
26
+
22
27
  Lint/MissingSuper:
23
28
  Enabled: false
24
29
 
@@ -39,6 +44,13 @@ Metrics/CyclomaticComplexity:
39
44
  Metrics/MethodLength:
40
45
  Enabled: false
41
46
 
47
+ Metrics/ParameterLists:
48
+ Enabled: false
49
+
50
+ Metrics/PerceivedComplexity:
51
+ Exclude:
52
+ - lib/doc_fox/concerns/enumerable.rb
53
+
42
54
  Naming/FileName:
43
55
  Exclude:
44
56
  - lib/active_call-doc_fox.rb
data/CHANGELOG.md CHANGED
@@ -1,8 +1,23 @@
1
- ## [0.1.1] - 2025-03-23
1
+ ## [0.2.0] - 2025-04-15
2
+
3
+ - DocFox::StatusSummary service objects
4
+ - DocFox::Profile service objects
5
+ - DocFox::DataRequirement service objects
6
+ - DocFox::EvidenceSubmission service objects
7
+ - DocFox::Document service objects
8
+ - README update with new added services
9
+ - Bug fix on DocFox::Authentication::GetService when no api_key
10
+
11
+ ## [0.1.2] - 2025-04-05
12
+
13
+ - Set access token in before_call hook instead of lambda so we can capture errors from the access token service objects.
14
+ - Fixed empty list enumerable errors.
15
+
16
+ ## [0.1.1] - 2025-04-02
2
17
 
3
18
  - Fix `source_code_uri` and `changelog_uri` link in gemspec.
4
19
 
5
- ## [0.1.0] - 2025-03-23
20
+ ## [0.1.0] - 2025-04-02
6
21
 
7
22
  - Initial release
8
23
  - 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
+ [![Gem Version](https://badge.fury.io/rb/active_call-doc_fox.svg?icon=si%3Arubygems)](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
- - [KYC Applications](#kyc-applications)
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
30
+ gem install active_call-doc_fox
33
31
  ```
34
32
 
35
33
  ## Configuration
@@ -205,12 +203,19 @@ 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
211
214
 
212
215
  ```ruby
213
- service = DocFox::KycApplication::ListService.call(page: 1, per_page: 10).each do |facade|
216
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications/get
217
+
218
+ DocFox::KycApplication::ListService.call(page: 1, per_page: 10).each do |facade|
214
219
  facade.id
215
220
  end
216
221
  ```
@@ -224,6 +229,8 @@ DocFox::KycApplication::ListService.call(search_term: 'eric.cartman@example.com'
224
229
  #### Get a KYC application
225
230
 
226
231
  ```ruby
232
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D/get
233
+
227
234
  service = DocFox::KycApplication::GetService.call(id: '')
228
235
  service.id
229
236
  service.approved_at
@@ -237,6 +244,8 @@ service.relationships.dig('data_requirements', 'links', 'related')
237
244
 
238
245
  Include related resources.
239
246
 
247
+ `managed_by`, `profile.additional_details`, `profile.addresses`, `profile.contacts`, `profile.names`, `profile.numbers`, `parent_related_entities`, `onboarding_token_summary`, `onboarding_token_summary.status_summaries`, `onboarding_token_summary.data_requirement_summaries`, `onboarding_token_summary.kyc_entity_template_designation_schema`, `onboarding_token_summary.parent_related_entity_designation_summary`, `onboarding_token_summary.parent_onboarding_token_summary`, `onboarding_token_summary.relationship_builder_config`
248
+
240
249
  ```ruby
241
250
  service = DocFox::KycApplication::GetService.call(id: '', params: { include: 'managed_by,profile.names' })
242
251
  service.included
@@ -245,7 +254,9 @@ service.included
245
254
  #### Create a KYC application
246
255
 
247
256
  ```ruby
248
- service = DocFox::KycApplication::CreateService.call(
257
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications/post
258
+
259
+ DocFox::KycApplication::CreateService.call(
249
260
  data: {
250
261
  type: 'kyc_application',
251
262
  attributes: {
@@ -263,45 +274,184 @@ service = DocFox::KycApplication::CreateService.call(
263
274
  #### Approve a KYC application
264
275
 
265
276
  ```ruby
266
- service = DocFox::KycApplication::ApproveService.call(id: '')
277
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D~1approve/patch
278
+
279
+ DocFox::KycApplication::ApproveService.call(id: '')
267
280
  ```
268
281
 
269
282
  #### Unapprove a KYC application
270
283
 
271
284
  ```ruby
272
- service = DocFox::KycApplication::UnapproveService.call(id: '', reason: '')
285
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D~1unapprove/patch
286
+
287
+ DocFox::KycApplication::UnapproveService.call(id: '', reason: '')
273
288
  ```
274
289
 
275
290
  #### Transfer a KYC application
276
291
 
277
292
  ```ruby
278
- service = DocFox::KycApplication::TransferService.call(id: '', transfer_to_user_id: '')
293
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D~1transfer/patch
294
+
295
+ DocFox::KycApplication::TransferService.call(id: '', transfer_to_user_id: '')
279
296
  ```
280
297
 
281
298
  #### Archive a KYC application
282
299
 
283
300
  ```ruby
284
- service = DocFox::KycApplication::ArchiveService.call(id: '', reason: '')
301
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D~1archive/post
302
+
303
+ DocFox::KycApplication::ArchiveService.call(id: '', reason: '')
285
304
  ```
286
305
 
287
306
  #### Unarchive a KYC application
288
307
 
289
308
  ```ruby
290
- service = DocFox::KycApplication::UnarchiveService.call(id: '', reason: '')
309
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D~1unarchive/post
310
+
311
+ DocFox::KycApplication::UnarchiveService.call(id: '', reason: '')
291
312
  ```
292
313
 
293
314
  #### Delete a KYC application
294
315
 
295
316
  ```ruby
296
- service = DocFox::KycApplication::DeleteService.call(id: '')
317
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Applications/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D/delete
318
+
319
+ DocFox::KycApplication::DeleteService.call(id: '')
320
+ ```
321
+
322
+ </details>
323
+
324
+ <details>
325
+ <summary>Status Summaries</summary>
326
+
327
+ ### Status Summaries
328
+
329
+ #### Get a status summary of a KYC application
330
+
331
+ ```ruby
332
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Status-Summaries/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D~1status_summaries/get
333
+
334
+ service = DocFox::StatusSummary::GetService.call(id: '')
335
+ service.id
336
+ service.overall_kyc_application_status
337
+ service.module_statuses
338
+ ...
339
+ ```
340
+
341
+ </details>
342
+
343
+ <details>
344
+ <summary>Profiles</summary>
345
+
346
+ ### Profiles
347
+
348
+ #### List profiles
349
+
350
+ ```ruby
351
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Profiles/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D~1profiles/get
352
+
353
+ DocFox::Profile::ListService.call(kyc_application_id: '', page: 1, per_page: 10).each do |facade|
354
+ facade.id
355
+ end
356
+ ```
357
+
358
+ #### Get a profile
359
+
360
+ ```ruby
361
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Profiles/paths/~1api~1v2~1profiles~1%7Bprofile_id%7D/get
362
+
363
+ service = DocFox::Profile::GetService.call(id: '')
364
+ service.id
365
+ service.created_at
366
+ ...
367
+ ```
368
+
369
+ Include related resources.
370
+
371
+ `additional_details`, `addresses`, `contacts`, `contacts.invitation_tokens`, `names`, `numbers`
372
+
373
+ ```ruby
374
+ service = DocFox::Profile::GetService.call(id: '', params: { include: 'names,numbers,additional_details' })
375
+ service.included
376
+ ```
377
+
378
+ </details>
379
+
380
+ <details>
381
+ <summary>Data Requirements</summary>
382
+
383
+ ### Data Requirements
384
+
385
+ #### List data requirements
386
+
387
+ ```ruby
388
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Data-Requirements/paths/~1api~1v2~1kyc_applications~1%7Bkyc_application_id%7D~1data_requirements/get
389
+
390
+ DocFox::DataRequirement::ListService.call(kyc_application_id: '', page: 1, per_page: 10).each do |facade|
391
+ facade.id
392
+ end
393
+ ```
394
+
395
+ List only data requirements for forms.
396
+
397
+ ```ruby
398
+ DocFox::DataRequirement::ListService.call(kyc_application_id: '', forms: true).map { _1 }
399
+ ```
400
+
401
+ #### List data requirements associated with an account application
402
+
403
+ ```ruby
404
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Data-Requirements/paths/~1api~1v2~1account_applications~1%7Baccount_application_id%7D~1data_requirements/get
405
+
406
+ DocFox::DataRequirement::ListService.call(account_application_id: '', page: 1, per_page: 10).each do |facade|
407
+ facade.id
408
+ end
409
+ ```
410
+
411
+ List only data requirements for forms.
412
+
413
+ ```ruby
414
+ DocFox::DataRequirement::ListService.call(account_application_id: '', forms: true).map { _1 }
415
+ ```
416
+
417
+ #### Get a data requirement
418
+
419
+ ```ruby
420
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Data-Requirements/paths/~1api~1v2~1data_requirements~1%7Bdata_requirement_id%7D/get
421
+
422
+ service = DocFox::DataRequirement::GetService.call(id: '')
423
+ service.id
424
+ service.created_at
425
+ service.form
426
+ service.name
427
+ service.required
428
+ service.slug
429
+ service.valid_evidence_types
430
+ ...
431
+ ```
432
+
433
+ Include related resources.
434
+
435
+ `evidence_submissions`, `active_evidence_submission`, `active_evidence_submission.form`, `active_evidence_submission.form.active_form_datum`
436
+
437
+ ```ruby
438
+ service = DocFox::DataRequirement::GetService.call(id: '', params: { include: 'evidence_submissions,active_evidence_submission' })
439
+ service.included
297
440
  ```
298
441
 
442
+ </details>
443
+
444
+ <details>
445
+ <summary>KYC Entity Templates</summary>
446
+
299
447
  ### KYC Entity Templates
300
448
 
301
449
  #### List KYC entity templates
302
450
 
303
451
  ```ruby
304
- service = DocFox::KycEntityTemplate::ListService.call(page: 1, per_page: 10).each do |facade|
452
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Entity-Templates/paths/~1api~1v2~1kyc_entity_templates/get
453
+
454
+ DocFox::KycEntityTemplate::ListService.call(page: 1, per_page: 10).each do |facade|
305
455
  facade.id
306
456
  end
307
457
  ```
@@ -309,6 +459,8 @@ end
309
459
  #### Get a KYC entity template
310
460
 
311
461
  ```ruby
462
+ # https://www.docfoxapp.com/api/v2/documentation#tag/KYC-Entity-Templates/paths/~1api~1v2~1kyc_entity_templates~1%7Bkyc_entity_template_id%7D/get
463
+
312
464
  service = DocFox::KycEntityTemplate::GetService.call(id: '')
313
465
  service.id
314
466
  service.kyc_entity_type_name
@@ -318,12 +470,284 @@ service.profile_schema
318
470
  ...
319
471
  ```
320
472
 
473
+ </details>
474
+
475
+ <details>
476
+ <summary>Evidence Submissions</summary>
477
+
478
+ ### Evidence Submissions
479
+
480
+ #### List evidence submissions
481
+
482
+ ```ruby
483
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Evidence-Submissions/paths/~1api~1v2~1data_requirements~1%7Bdata_requirement_id%7D~1evidence_submissions/get
484
+
485
+ DocFox::EvidenceSubmission::ListService.call(data_requirement_id: '', page: 1, per_page: 10).each do |facade|
486
+ facade.id
487
+ end
488
+ ```
489
+
490
+ #### Get an evidence submission
491
+
492
+ ```ruby
493
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Evidence-Submissions/paths/~1api~1v2~1evidence_submissions~1%7Bevidence_submission_id%7D/get
494
+
495
+ service = DocFox::EvidenceSubmission::GetService.call(id: '')
496
+ service.id
497
+ service.evidence_type
498
+ service.form
499
+ service.status
500
+ service.created_at
501
+ service.attributes
502
+ ...
503
+ ```
504
+
505
+ Include related resources.
506
+
507
+ `document`: the related document, for document evidence submission
508
+ `qualitative_checks`: the related qualitative checks, for document evidence submission
509
+ `rejection_reasons`: the related rejection reasons
510
+ `form`: the related form, for form evidence submission
511
+ `form.active_form_datum`: the related form and its latest data submission, for form evidence submission
512
+
513
+ ```ruby
514
+ service = DocFox::EvidenceSubmission::GetService.call(id: '', params: { include: 'document,qualitative_checks' })
515
+ service.included
516
+ ```
517
+
518
+ #### Update an evidence submission
519
+
520
+ At the moment this is used only to add third party data to an external evidence submission for a specific third party provider.
521
+
522
+ ```ruby
523
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Evidence-Submissions/paths/~1api~1v2~1evidence_submissions~1%7Bevidence_submission_id%7D/patch
524
+
525
+ DocFox::EvidenceSubmission::UpdateService.call(
526
+ id: '',
527
+ data: {
528
+ type: 'evidence_submission',
529
+ id: '',
530
+ attributes: {
531
+ results: {
532
+ dob: '1984-01-01',
533
+ gender: 'M',
534
+ surname: 'Cartman',
535
+ forename1: 'Eric',
536
+ forename2: nil,
537
+ id_number: '8401017223183',
538
+ addresses: {
539
+ address: [
540
+ {
541
+ addr_type: 'R',
542
+ addr_line1: '28201 E. Bonanza St.',
543
+ addr_line2: '',
544
+ addr_line3: '',
545
+ addr_line4: 'South Park',
546
+ addr_postal_code: '8000',
547
+ addr_update_date: '2017-11-21'
548
+ }
549
+ ]
550
+ },
551
+ telephones: {
552
+ telephone: [
553
+ {
554
+ tel_num: '27715555555',
555
+ tel_type: 'Cell',
556
+ tel_update_date: '2017-09-05'
557
+ }
558
+ ]
559
+ },
560
+ deceased_date: nil,
561
+ deceased_flag: 'N',
562
+ verified_date: '2015-06-23',
563
+ verified_flag: 'Y',
564
+ deceased_reason: nil
565
+ }
566
+ }
567
+ }
568
+ )
569
+ ```
570
+
571
+ #### Reject an active evidence submission
572
+
573
+ ```ruby
574
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Evidence-Submissions/paths/~1api~1v2~1evidence_submissions~1%7Bevidence_submission_id%7D~1reject/patch
575
+
576
+ DocFox::EvidenceSubmission::RejectService.call(id: '', reason: '')
577
+ ```
578
+
579
+ #### Approve an active evidence submission
580
+
581
+ ```ruby
582
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Evidence-Submissions/paths/~1api~1v2~1evidence_submissions~1%7Bevidence_submission_id%7D~1approve/patch
583
+
584
+ DocFox::EvidenceSubmission::ApproveService.call(id: '')
585
+ ```
586
+
587
+ #### Replace an active evidence submission
588
+
589
+ ```ruby
590
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Evidence-Submissions/paths/~1api~1v2~1evidence_submissions~1%7Bevidence_submission_id%7D~1replace/patch
591
+
592
+ DocFox::EvidenceSubmission::ReplaceService.call(id: '')
593
+ ```
594
+
595
+ </details>
596
+
597
+ <details>
598
+ <summary>Documents</summary>
599
+
600
+ ### Documents
601
+
602
+ #### List documents
603
+
604
+ ```ruby
605
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Documents/paths/~1api~1v2~1evidence_submissions~1%7Bevidence_submission_id%7D~1documents/get
606
+
607
+ DocFox::Document::ListService.call(evidence_submission_id: '', page: 1, per_page: 10).each do |facade|
608
+ facade.id
609
+ end
610
+ ```
611
+
612
+ #### Get a document
613
+
614
+ ```ruby
615
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Documents/paths/~1api~1v2~1documents~1%7Bdocument_id%7D/get
616
+
617
+ service = DocFox::Document::GetService.call(id: '')
618
+ service.id
619
+ service.created_at
620
+ service.content_type
621
+ service.filename
622
+ service.token
623
+ service.token_expiry
624
+ service.uploaded_by
625
+ ...
626
+ ```
627
+
628
+ Include related resources.
629
+
630
+ `evidence_submissions`
631
+
632
+ ```ruby
633
+ service = DocFox::Document::GetService.call(id: '', params: { include: 'evidence_submissions' })
634
+ service.included
635
+ ```
636
+
637
+ </details>
638
+
639
+ <details>
640
+
641
+ <summary>Document Tokens</summary>
642
+
643
+ ### Document Tokens
644
+
645
+ #### List document tokens
646
+
647
+ ```ruby
648
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Document-Tokens/paths/~1api~1v2~1documents~1%7Bdocument_id%7D~1document_tokens/get
649
+
650
+ DocFox::DocumentToken::ListService.call(document_id: '', page: 1, per_page: 10).each do |facade|
651
+ facade.id
652
+ end
653
+ ```
654
+
655
+ #### Get a document token
656
+
657
+ ```ruby
658
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Document-Tokens/paths/~1api~1v2~1document_tokens~1%7Bdocument_token_id%7D/get
659
+
660
+ service = DocFox::DocumentToken::GetService.call(id: '')
661
+ service.id
662
+ service.created_at
663
+ service.expiry
664
+ service.content_type
665
+ ...
666
+ ```
667
+
668
+ #### Create a document token
669
+
670
+ ```ruby
671
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Document-Tokens/paths/~1api~1v2~1documents~1%7Bdocument_id%7D~1document_tokens/post
672
+
673
+ DocFox::DocumentToken::CreateService.call(
674
+ document_id: '',
675
+ data: {
676
+ type: 'document_token'
677
+ }
678
+ )
679
+ ```
680
+
681
+ </details>
682
+
683
+ <details>
684
+
685
+ <summary>Download Documents</summary>
686
+
687
+ ### Download Documents
688
+
689
+ #### Download a document file
690
+
691
+ ```ruby
692
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Download-Documents/paths/~1api~1v2~1document_file_downloads~1%7Bdocument_token_id%7D/get
693
+
694
+ service = DocFox::Document::DownloadService.call(document_token_id: '', content_type: 'image/jpeg')
695
+ service.response.body # => "\xFF\xD8\xFF\xDB\x00\x84\x00\x04\x05\x..."
696
+ ```
697
+
698
+ Possible values for `content_type`.
699
+
700
+ - `image/jpeg`
701
+ - `image/png`
702
+ - `application/pdf`
703
+
704
+ You can also provide just the `document_id` and the service will automatically request the `document_token_id` and `content_type` for you.
705
+
706
+ ```ruby
707
+ service = DocFox::Document::DownloadService.call(document_id: '')
708
+ service.response.body # => "\xFF\xD8\xFF\xDB\x00\x84\x00\x04\x05\x..."
709
+ ```
710
+
711
+ </details>
712
+
713
+ <details>
714
+
715
+ <summary>Document Uploads</summary>
716
+
717
+ ### Document Uploads
718
+
719
+ #### Upload a document file
720
+
721
+ ```ruby
722
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Document-Uploads/paths/~1api~1v2~1evidence_submissions~1%7Bevidence_submission_id%7D~1documents/post
723
+
724
+ DocFox::Document::UploadService.call(
725
+ evidence_submission_id: '',
726
+ data: {
727
+ type: 'document',
728
+ attributes: {
729
+ evidence_type: 'taxes_paid_in_prior_quarter',
730
+ filename: 'taxes_paid.png',
731
+ document_data: "data:image/png;base64,#{Base64.encode64(File.read('/path/to/taxes_paid.png'))}"
732
+ }
733
+ }
734
+ )
735
+ ```
736
+ </details>
737
+
738
+ </details>
739
+
740
+ <details>
741
+ <summary>Users</summary>
742
+
321
743
  ### Users
322
744
 
323
745
  #### List users
324
746
 
325
747
  ```ruby
326
- service = DocFox::User::ListService.call(page: 1, per_page: 10).each do |facade|
748
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Users/paths/~1api~1v2~1users/get
749
+
750
+ DocFox::User::ListService.call(page: 1, per_page: 10).each do |facade|
327
751
  facade.id
328
752
  end
329
753
  ```
@@ -331,6 +755,8 @@ end
331
755
  #### Get a user
332
756
 
333
757
  ```ruby
758
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Users/paths/~1api~1v2~1users~1%7Buser_id%7D/get
759
+
334
760
  service = DocFox::User::GetService.call(id: '')
335
761
  service.id
336
762
  service.email
@@ -340,6 +766,8 @@ service.deactivated
340
766
  ...
341
767
  ```
342
768
 
769
+ </details>
770
+
343
771
  ## Development
344
772
 
345
773
  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
@@ -15,6 +17,8 @@ class DocFox::AccessToken::GetService < DocFox::BaseService
15
17
 
16
18
  # Get access token.
17
19
  #
20
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Authentication/paths/~1api~1v2~1tokens~1new/get
21
+ #
18
22
  # ==== Examples
19
23
  #
20
24
  # service = DocFox::AccessToken::GetService.call
@@ -30,7 +34,6 @@ class DocFox::AccessToken::GetService < DocFox::BaseService
30
34
 
31
35
  def connection
32
36
  @_connection ||= Faraday.new do |conn|
33
- conn.adapter Faraday.default_adapter
34
37
  conn.url_prefix = base_url
35
38
  conn.headers['X-Client-Api-Key'] = api_key
36
39
  conn.headers['X-Client-Signature'] = signature
@@ -42,6 +45,7 @@ class DocFox::AccessToken::GetService < DocFox::BaseService
42
45
  logger.filter(/(X-Client-Signature:).*"(.+)."/i, '\1 [FILTERED]')
43
46
  logger.filter(/"token":"([^"]+)"/i, '"token":"[FILTERED]"')
44
47
  end
48
+ conn.adapter Faraday.default_adapter
45
49
  end
46
50
  end
47
51