active_call-doc_fox 0.1.2 → 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 +4 -0
  3. data/CHANGELOG.md +10 -0
  4. data/README.md +423 -10
  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 +40 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da9b1a766d5bdb3e7d9ead4e0bd2887b7beb0b7b09456c411b338d7ec76c19e0
4
- data.tar.gz: 99b83630296bc23024850639b8078a2d9662e85b41a5f0672929ae4b3e2cd0dd
3
+ metadata.gz: 03e0ba0383b10c32d4db8d54c218218af2a0b88c7c424a55962a66030dd2759a
4
+ data.tar.gz: e3a1da533e017f392cdc428e37f1c5142a25105aaeb32b8f04224bffe499bcb7
5
5
  SHA512:
6
- metadata.gz: 7638777bef5355e94885377332aad31c80fa7e3fd448c25572016eb3fd56812cb87992cc11e21ab00696bf34dfcf5181c58aaf16cea389fc639b203b411e70d6
7
- data.tar.gz: 3c06cda91a960387883b3ff239fbcdb80fc0a5aa789710a150e560e45e7336cdc6a7109a997b2742e01e5de5183f0e07be8e4cb9a6c3f2cf6322a0cb9f6704aa
6
+ metadata.gz: 59c45a9756e5dece42d132e3cb4dd14af215454c6811874a804e5608e5693f5213a747fd00db86d2d60477cf7c2febb7c8df821f4a2afaea10c278c9d44ab42f
7
+ data.tar.gz: '080c8f01dd88a9dd8ba3a136d7e763d0d4599077f02bfc4f3572a4594937d19859bf3da7b188f1c22d2607bbc6448fd4ad12dded10a718539d4f1528b80bee59'
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,13 @@
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
+
1
11
  ## [0.1.2] - 2025-04-05
2
12
 
3
13
  - 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
@@ -213,7 +213,9 @@ If you don't provide the `per_page` argument, multiple API requests will be made
213
213
  #### List KYC applications
214
214
 
215
215
  ```ruby
216
- 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|
217
219
  facade.id
218
220
  end
219
221
  ```
@@ -227,6 +229,8 @@ DocFox::KycApplication::ListService.call(search_term: 'eric.cartman@example.com'
227
229
  #### Get a KYC application
228
230
 
229
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
+
230
234
  service = DocFox::KycApplication::GetService.call(id: '')
231
235
  service.id
232
236
  service.approved_at
@@ -240,6 +244,8 @@ service.relationships.dig('data_requirements', 'links', 'related')
240
244
 
241
245
  Include related resources.
242
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
+
243
249
  ```ruby
244
250
  service = DocFox::KycApplication::GetService.call(id: '', params: { include: 'managed_by,profile.names' })
245
251
  service.included
@@ -248,7 +254,9 @@ service.included
248
254
  #### Create a KYC application
249
255
 
250
256
  ```ruby
251
- 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(
252
260
  data: {
253
261
  type: 'kyc_application',
254
262
  attributes: {
@@ -266,37 +274,169 @@ service = DocFox::KycApplication::CreateService.call(
266
274
  #### Approve a KYC application
267
275
 
268
276
  ```ruby
269
- 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: '')
270
280
  ```
271
281
 
272
282
  #### Unapprove a KYC application
273
283
 
274
284
  ```ruby
275
- 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: '')
276
288
  ```
277
289
 
278
290
  #### Transfer a KYC application
279
291
 
280
292
  ```ruby
281
- 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: '')
282
296
  ```
283
297
 
284
298
  #### Archive a KYC application
285
299
 
286
300
  ```ruby
287
- 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: '')
288
304
  ```
289
305
 
290
306
  #### Unarchive a KYC application
291
307
 
292
308
  ```ruby
293
- 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: '')
294
312
  ```
295
313
 
296
314
  #### Delete a KYC application
297
315
 
298
316
  ```ruby
299
- 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
300
440
  ```
301
441
 
302
442
  </details>
@@ -309,7 +449,9 @@ service = DocFox::KycApplication::DeleteService.call(id: '')
309
449
  #### List KYC entity templates
310
450
 
311
451
  ```ruby
312
- 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|
313
455
  facade.id
314
456
  end
315
457
  ```
@@ -317,6 +459,8 @@ end
317
459
  #### Get a KYC entity template
318
460
 
319
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
+
320
464
  service = DocFox::KycEntityTemplate::GetService.call(id: '')
321
465
  service.id
322
466
  service.kyc_entity_type_name
@@ -328,6 +472,271 @@ service.profile_schema
328
472
 
329
473
  </details>
330
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
+
331
740
  <details>
332
741
  <summary>Users</summary>
333
742
 
@@ -336,7 +745,9 @@ service.profile_schema
336
745
  #### List users
337
746
 
338
747
  ```ruby
339
- 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|
340
751
  facade.id
341
752
  end
342
753
  ```
@@ -344,6 +755,8 @@ end
344
755
  #### Get a user
345
756
 
346
757
  ```ruby
758
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Users/paths/~1api~1v2~1users~1%7Buser_id%7D/get
759
+
347
760
  service = DocFox::User::GetService.call(id: '')
348
761
  service.id
349
762
  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
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DocFox::DataRequirement::GetService < DocFox::BaseService
4
+ attr_reader :id, :params
5
+
6
+ validates :id, presence: true
7
+
8
+ after_call :set_facade
9
+
10
+ delegate_missing_to :@facade
11
+
12
+ def initialize(id:, params: {})
13
+ @id = id
14
+ @params = params
15
+ end
16
+
17
+ # Get a data requirement.
18
+ #
19
+ # https://www.docfoxapp.com/api/v2/documentation#tag/Data-Requirements/paths/~1api~1v2~1data_requirements~1%7Bdata_requirement_id%7D/get
20
+ #
21
+ # ==== Examples
22
+ #
23
+ # service = DocFox::DataRequirement::GetService.call(id: '')
24
+ #
25
+ # service.success? # => true
26
+ # service.errors # => #<ActiveModel::Errors []>
27
+ #
28
+ # service.response # => #<Faraday::Response ...>
29
+ # service.response.status # => 200
30
+ # service.response.body # => {}
31
+ #
32
+ # service.facade # => #<DocFox::DataRequirement::Facade ...>
33
+ # service.facade.id
34
+ # service.id
35
+ #
36
+ # service.relationships.dig('kyc_application', 'data', 'id')
37
+ # service.relationships.dig('active_evidence_submission', 'links', 'related')
38
+ #
39
+ # Include related resources.
40
+ #
41
+ # service = DocFox::DataRequirement::GetService.call(id: '', params: { include: 'evidence_submissions,active_evidence_submission' })
42
+ #
43
+ # GET /api/v2/data_requirements/:id
44
+ def call
45
+ connection.get("data_requirements/#{id}", **params)
46
+ end
47
+
48
+ private
49
+
50
+ def set_facade
51
+ @facade = DocFox::DataRequirement::Facade.new(response.body)
52
+ end
53
+ end