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