onfido 2.9.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (378) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -4
  3. data/Gemfile +5 -4
  4. data/LICENSE +5 -7
  5. data/README.md +69 -51
  6. data/Rakefile +10 -0
  7. data/lib/onfido/api/default_api.rb +4233 -0
  8. data/lib/onfido/api_client.rb +431 -0
  9. data/lib/onfido/api_error.rb +58 -0
  10. data/lib/onfido/configuration.rb +420 -0
  11. data/lib/onfido/models/address.rb +422 -0
  12. data/lib/onfido/models/address_builder.rb +422 -0
  13. data/lib/onfido/models/address_shared.rb +415 -0
  14. data/lib/onfido/models/addresses_list.rb +216 -0
  15. data/lib/onfido/models/applicant.rb +390 -0
  16. data/lib/onfido/models/applicant_builder.rb +358 -0
  17. data/lib/onfido/models/applicant_create.rb +281 -0
  18. data/lib/onfido/models/applicant_request.rb +232 -0
  19. data/lib/onfido/models/applicant_response.rb +341 -0
  20. data/lib/onfido/models/applicant_shared.rb +246 -0
  21. data/lib/onfido/models/applicant_update.rb +267 -0
  22. data/lib/onfido/models/applicant_updater.rb +344 -0
  23. data/lib/onfido/models/applicants_list.rb +223 -0
  24. data/lib/onfido/models/check.rb +419 -0
  25. data/lib/onfido/models/check_builder.rb +360 -0
  26. data/lib/onfido/models/check_request.rb +301 -0
  27. data/lib/onfido/models/check_response.rb +350 -0
  28. data/lib/onfido/models/check_shared.rb +266 -0
  29. data/lib/onfido/models/checks_list.rb +223 -0
  30. data/lib/onfido/models/complete_task_builder.rb +221 -0
  31. data/lib/onfido/models/complete_task_data_builder.rb +106 -0
  32. data/lib/onfido/models/consent_item.rb +272 -0
  33. data/lib/onfido/models/consents_builder.rb +205 -0
  34. data/lib/onfido/models/country_codes.rb +289 -0
  35. data/lib/onfido/models/device_intelligence_breakdown.rb +223 -0
  36. data/lib/onfido/models/device_intelligence_breakdown_breakdown.rb +214 -0
  37. data/lib/onfido/models/device_intelligence_breakdown_breakdown_device.rb +215 -0
  38. data/lib/onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.rb +232 -0
  39. data/lib/onfido/models/device_intelligence_breakdown_properties.rb +232 -0
  40. data/lib/onfido/models/device_intelligence_breakdown_properties_device.rb +468 -0
  41. data/lib/onfido/models/device_intelligence_breakdown_properties_geolocation.rb +257 -0
  42. data/lib/onfido/models/device_intelligence_breakdown_properties_ip.rb +245 -0
  43. data/lib/onfido/models/device_intelligence_report.rb +345 -0
  44. data/lib/onfido/models/document.rb +376 -0
  45. data/lib/onfido/models/document_breakdown.rb +286 -0
  46. data/lib/onfido/models/document_breakdown_age_validation.rb +224 -0
  47. data/lib/onfido/models/document_breakdown_age_validation_breakdown.rb +214 -0
  48. data/lib/onfido/models/document_breakdown_compromised_document.rb +224 -0
  49. data/lib/onfido/models/document_breakdown_compromised_document_breakdown.rb +223 -0
  50. data/lib/onfido/models/document_breakdown_data_comparison.rb +224 -0
  51. data/lib/onfido/models/document_breakdown_data_comparison_breakdown.rb +277 -0
  52. data/lib/onfido/models/document_breakdown_data_comparison_breakdown_issuing_country.rb +223 -0
  53. data/lib/onfido/models/document_breakdown_data_consistency.rb +224 -0
  54. data/lib/onfido/models/document_breakdown_data_consistency_breakdown.rb +295 -0
  55. data/lib/onfido/models/document_breakdown_data_validation.rb +224 -0
  56. data/lib/onfido/models/document_breakdown_data_validation_breakdown.rb +268 -0
  57. data/lib/onfido/models/document_breakdown_data_validation_breakdown_document_expiration.rb +224 -0
  58. data/lib/onfido/models/document_breakdown_data_validation_breakdown_expiry_date.rb +224 -0
  59. data/lib/onfido/models/document_breakdown_image_integrity.rb +224 -0
  60. data/lib/onfido/models/document_breakdown_image_integrity_breakdown.rb +241 -0
  61. data/lib/onfido/models/document_breakdown_image_integrity_breakdown_colour_picture.rb +224 -0
  62. data/lib/onfido/models/document_breakdown_image_integrity_breakdown_conclusive_document_quality.rb +224 -0
  63. data/lib/onfido/models/document_breakdown_image_integrity_breakdown_image_quality.rb +224 -0
  64. data/lib/onfido/models/document_breakdown_image_integrity_breakdown_supported_document.rb +224 -0
  65. data/lib/onfido/models/document_breakdown_issuing_authority.rb +224 -0
  66. data/lib/onfido/models/document_breakdown_issuing_authority_breakdown.rb +223 -0
  67. data/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_active_authentication.rb +224 -0
  68. data/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_passive_authentication.rb +224 -0
  69. data/lib/onfido/models/document_breakdown_police_record.rb +215 -0
  70. data/lib/onfido/models/document_breakdown_visual_authenticity.rb +224 -0
  71. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown.rb +277 -0
  72. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_digital_tampering.rb +224 -0
  73. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_face_detection.rb +224 -0
  74. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_fonts.rb +224 -0
  75. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_original_document_present.rb +224 -0
  76. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_other.rb +224 -0
  77. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_picture_face_integrity.rb +224 -0
  78. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_security_features.rb +224 -0
  79. data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_template.rb +224 -0
  80. data/lib/onfido/models/document_cdq_reasons.rb +285 -0
  81. data/lib/onfido/models/document_iq_reasons.rb +305 -0
  82. data/lib/onfido/models/document_odp_reasons.rb +245 -0
  83. data/lib/onfido/models/document_properties.rb +663 -0
  84. data/lib/onfido/models/document_properties_address_lines.rb +259 -0
  85. data/lib/onfido/models/document_properties_barcode_inner.rb +367 -0
  86. data/lib/onfido/models/document_properties_document_classification.rb +232 -0
  87. data/lib/onfido/models/document_properties_document_numbers_inner.rb +223 -0
  88. data/lib/onfido/models/document_properties_driving_licence_information.rb +241 -0
  89. data/lib/onfido/models/document_properties_extracted_data.rb +394 -0
  90. data/lib/onfido/models/document_properties_nfc.rb +322 -0
  91. data/lib/onfido/models/document_report.rb +354 -0
  92. data/lib/onfido/models/document_response.rb +272 -0
  93. data/lib/onfido/models/document_shared.rb +301 -0
  94. data/lib/onfido/models/document_types.rb +64 -0
  95. data/lib/onfido/models/document_video_report.rb +354 -0
  96. data/lib/onfido/models/document_video_with_address_information_report.rb +354 -0
  97. data/lib/onfido/models/document_with_address_information_report.rb +354 -0
  98. data/lib/onfido/models/document_with_driver_verification_report.rb +354 -0
  99. data/lib/onfido/models/document_with_driver_verification_report_all_of_properties.rb +731 -0
  100. data/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle.rb +236 -0
  101. data/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_vehicle_class_details_inner.rb +245 -0
  102. data/lib/onfido/models/document_with_driving_licence_information_report.rb +354 -0
  103. data/lib/onfido/models/documents_list.rb +223 -0
  104. data/lib/onfido/models/error.rb +214 -0
  105. data/lib/onfido/models/error1.rb +224 -0
  106. data/lib/onfido/models/error_properties.rb +234 -0
  107. data/lib/onfido/models/error_properties1.rb +223 -0
  108. data/lib/onfido/models/extract_request.rb +222 -0
  109. data/lib/onfido/models/extraction.rb +233 -0
  110. data/lib/onfido/models/extraction_document_classification.rb +289 -0
  111. data/lib/onfido/models/extraction_extracted_data.rb +530 -0
  112. data/lib/onfido/models/facial_similarity_motion_breakdown.rb +232 -0
  113. data/lib/onfido/models/facial_similarity_motion_breakdown_face_comparison.rb +224 -0
  114. data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity.rb +224 -0
  115. data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown.rb +223 -0
  116. data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
  117. data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
  118. data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity.rb +224 -0
  119. data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown.rb +223 -0
  120. data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
  121. data/lib/onfido/models/facial_similarity_motion_properties.rb +215 -0
  122. data/lib/onfido/models/facial_similarity_motion_report.rb +354 -0
  123. data/lib/onfido/models/facial_similarity_photo_breakdown.rb +232 -0
  124. data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison.rb +224 -0
  125. data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown.rb +214 -0
  126. data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match.rb +224 -0
  127. data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match_properties.rb +225 -0
  128. data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity.rb +224 -0
  129. data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown.rb +223 -0
  130. data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
  131. data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
  132. data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity.rb +224 -0
  133. data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown.rb +214 -0
  134. data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
  135. data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection_properties.rb +215 -0
  136. data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown.rb +232 -0
  137. data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity.rb +224 -0
  138. data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown.rb +223 -0
  139. data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
  140. data/lib/onfido/models/facial_similarity_photo_fully_auto_properties.rb +215 -0
  141. data/lib/onfido/models/facial_similarity_photo_fully_auto_report.rb +354 -0
  142. data/lib/onfido/models/facial_similarity_photo_properties.rb +215 -0
  143. data/lib/onfido/models/facial_similarity_photo_report.rb +354 -0
  144. data/lib/onfido/models/facial_similarity_video_breakdown.rb +232 -0
  145. data/lib/onfido/models/facial_similarity_video_breakdown_face_comparison.rb +224 -0
  146. data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity.rb +224 -0
  147. data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown.rb +223 -0
  148. data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
  149. data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
  150. data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity.rb +224 -0
  151. data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown.rb +223 -0
  152. data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected.rb +224 -0
  153. data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
  154. data/lib/onfido/models/facial_similarity_video_properties.rb +215 -0
  155. data/lib/onfido/models/facial_similarity_video_report.rb +354 -0
  156. data/lib/onfido/models/id_number.rb +269 -0
  157. data/lib/onfido/models/id_photo.rb +289 -0
  158. data/lib/onfido/models/id_photo_response.rb +282 -0
  159. data/lib/onfido/models/id_photos_list.rb +223 -0
  160. data/lib/onfido/models/identity_enhanced_breakdown.rb +241 -0
  161. data/lib/onfido/models/identity_enhanced_breakdown_address.rb +224 -0
  162. data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown.rb +232 -0
  163. data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies.rb +224 -0
  164. data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies_properties.rb +214 -0
  165. data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_telephone_database.rb +224 -0
  166. data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_voting_register.rb +224 -0
  167. data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth.rb +224 -0
  168. data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown.rb +223 -0
  169. data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_credit_agencies.rb +224 -0
  170. data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_voting_register.rb +224 -0
  171. data/lib/onfido/models/identity_enhanced_breakdown_mortality.rb +215 -0
  172. data/lib/onfido/models/identity_enhanced_breakdown_sources.rb +224 -0
  173. data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown.rb +214 -0
  174. data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources.rb +224 -0
  175. data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources_properties.rb +214 -0
  176. data/lib/onfido/models/identity_enhanced_properties.rb +227 -0
  177. data/lib/onfido/models/identity_enhanced_properties_matched_addresses_inner.rb +227 -0
  178. data/lib/onfido/models/identity_enhanced_report.rb +354 -0
  179. data/lib/onfido/models/india_pan_report.rb +354 -0
  180. data/lib/onfido/models/india_pan_report_all_of_breakdown.rb +214 -0
  181. data/lib/onfido/models/india_pan_report_all_of_breakdown_device.rb +214 -0
  182. data/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown.rb +223 -0
  183. data/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid.rb +214 -0
  184. data/lib/onfido/models/india_pan_report_all_of_properties.rb +214 -0
  185. data/lib/onfido/models/india_pan_report_all_of_properties_device.rb +225 -0
  186. data/lib/onfido/models/known_faces_breakdown.rb +223 -0
  187. data/lib/onfido/models/known_faces_breakdown_image_integrity.rb +215 -0
  188. data/lib/onfido/models/known_faces_breakdown_previously_seen_faces.rb +215 -0
  189. data/lib/onfido/models/known_faces_properties.rb +217 -0
  190. data/lib/onfido/models/known_faces_properties_matches_inner.rb +255 -0
  191. data/lib/onfido/models/known_faces_report.rb +354 -0
  192. data/lib/onfido/models/live_photo.rb +289 -0
  193. data/lib/onfido/models/live_photo_response.rb +282 -0
  194. data/lib/onfido/models/live_photos_list.rb +223 -0
  195. data/lib/onfido/models/live_video.rb +287 -0
  196. data/lib/onfido/models/live_videos_list.rb +223 -0
  197. data/lib/onfido/models/location.rb +254 -0
  198. data/lib/onfido/models/location_builder.rb +254 -0
  199. data/lib/onfido/models/location_shared.rb +247 -0
  200. data/lib/onfido/models/motion_capture.rb +275 -0
  201. data/lib/onfido/models/motion_captures_list.rb +223 -0
  202. data/lib/onfido/models/photo_auto_reasons.rb +255 -0
  203. data/lib/onfido/models/photo_reasons.rb +255 -0
  204. data/lib/onfido/models/proof_of_address_breakdown.rb +232 -0
  205. data/lib/onfido/models/proof_of_address_breakdown_data_comparison.rb +224 -0
  206. data/lib/onfido/models/proof_of_address_breakdown_data_comparison_breakdown.rb +232 -0
  207. data/lib/onfido/models/proof_of_address_breakdown_document_classification.rb +224 -0
  208. data/lib/onfido/models/proof_of_address_breakdown_document_classification_breakdown.rb +214 -0
  209. data/lib/onfido/models/proof_of_address_breakdown_image_integrity.rb +224 -0
  210. data/lib/onfido/models/proof_of_address_breakdown_image_integrity_breakdown.rb +214 -0
  211. data/lib/onfido/models/proof_of_address_properties.rb +319 -0
  212. data/lib/onfido/models/proof_of_address_report.rb +354 -0
  213. data/lib/onfido/models/repeat_attempts_list.rb +292 -0
  214. data/lib/onfido/models/repeat_attempts_list_repeat_attempts_inner.rb +333 -0
  215. data/lib/onfido/models/report.rb +93 -0
  216. data/lib/onfido/models/report_document.rb +222 -0
  217. data/lib/onfido/models/report_name.rb +60 -0
  218. data/lib/onfido/models/report_result.rb +42 -0
  219. data/lib/onfido/models/report_shared.rb +329 -0
  220. data/lib/onfido/models/report_status.rb +44 -0
  221. data/lib/onfido/models/report_sub_result.rb +43 -0
  222. data/lib/onfido/models/reports_list.rb +223 -0
  223. data/lib/onfido/models/results_feedback.rb +279 -0
  224. data/lib/onfido/models/sdk_token.rb +229 -0
  225. data/lib/onfido/models/sdk_token_builder.rb +259 -0
  226. data/lib/onfido/models/sdk_token_request.rb +252 -0
  227. data/lib/onfido/models/sdk_token_response.rb +222 -0
  228. data/lib/onfido/models/task.rb +329 -0
  229. data/lib/onfido/models/task_item.rb +287 -0
  230. data/lib/onfido/models/timeline_file_reference.rb +239 -0
  231. data/lib/onfido/models/us_driving_licence_breakdown.rb +232 -0
  232. data/lib/onfido/models/us_driving_licence_breakdown_address.rb +224 -0
  233. data/lib/onfido/models/us_driving_licence_breakdown_address_breakdown.rb +259 -0
  234. data/lib/onfido/models/us_driving_licence_breakdown_document.rb +224 -0
  235. data/lib/onfido/models/us_driving_licence_breakdown_document_breakdown.rb +241 -0
  236. data/lib/onfido/models/us_driving_licence_breakdown_personal.rb +224 -0
  237. data/lib/onfido/models/us_driving_licence_breakdown_personal_breakdown.rb +322 -0
  238. data/lib/onfido/models/us_driving_licence_builder.rb +505 -0
  239. data/lib/onfido/models/us_driving_licence_report.rb +354 -0
  240. data/lib/onfido/models/us_driving_licence_shared.rb +499 -0
  241. data/lib/onfido/models/video_reasons.rb +245 -0
  242. data/lib/onfido/models/watchlist_aml_breakdown.rb +241 -0
  243. data/lib/onfido/models/watchlist_aml_breakdown_adverse_media.rb +215 -0
  244. data/lib/onfido/models/watchlist_aml_breakdown_legal_and_regulatory_warnings.rb +215 -0
  245. data/lib/onfido/models/watchlist_aml_breakdown_politically_exposed_person.rb +215 -0
  246. data/lib/onfido/models/watchlist_aml_breakdown_sanction.rb +215 -0
  247. data/lib/onfido/models/watchlist_aml_properties.rb +217 -0
  248. data/lib/onfido/models/watchlist_aml_report.rb +354 -0
  249. data/lib/onfido/models/watchlist_enhanced_breakdown.rb +241 -0
  250. data/lib/onfido/models/watchlist_enhanced_properties.rb +217 -0
  251. data/lib/onfido/models/watchlist_enhanced_report.rb +354 -0
  252. data/lib/onfido/models/watchlist_monitor.rb +342 -0
  253. data/lib/onfido/models/watchlist_monitor_builder.rb +292 -0
  254. data/lib/onfido/models/watchlist_monitor_match.rb +225 -0
  255. data/lib/onfido/models/watchlist_monitor_matches_list.rb +223 -0
  256. data/lib/onfido/models/watchlist_monitor_matches_updater.rb +227 -0
  257. data/lib/onfido/models/watchlist_monitor_response.rb +254 -0
  258. data/lib/onfido/models/watchlist_monitor_shared.rb +285 -0
  259. data/lib/onfido/models/watchlist_monitors_list.rb +223 -0
  260. data/lib/onfido/models/watchlist_peps_only_report.rb +354 -0
  261. data/lib/onfido/models/watchlist_sanctions_only_report.rb +354 -0
  262. data/lib/onfido/models/watchlist_standard_breakdown.rb +232 -0
  263. data/lib/onfido/models/watchlist_standard_properties.rb +217 -0
  264. data/lib/onfido/models/watchlist_standard_report.rb +354 -0
  265. data/lib/onfido/models/webhook.rb +304 -0
  266. data/lib/onfido/models/webhook_builder.rb +274 -0
  267. data/lib/onfido/models/webhook_create.rb +222 -0
  268. data/lib/onfido/models/webhook_event.rb +214 -0
  269. data/lib/onfido/models/webhook_event_payload.rb +273 -0
  270. data/lib/onfido/models/webhook_event_payload_object.rb +260 -0
  271. data/lib/onfido/models/webhook_event_type.rb +56 -0
  272. data/lib/onfido/models/webhook_resend.rb +216 -0
  273. data/lib/onfido/models/webhook_response.rb +252 -0
  274. data/lib/onfido/models/webhook_shared.rb +249 -0
  275. data/lib/onfido/models/webhook_update.rb +215 -0
  276. data/lib/onfido/models/webhook_updater.rb +267 -0
  277. data/lib/onfido/models/webhooks_list.rb +223 -0
  278. data/lib/onfido/models/webhooks_resend_item.rb +261 -0
  279. data/lib/onfido/models/workflow_run.rb +416 -0
  280. data/lib/onfido/models/workflow_run_builder.rb +316 -0
  281. data/lib/onfido/models/workflow_run_request.rb +217 -0
  282. data/lib/onfido/models/workflow_run_response.rb +317 -0
  283. data/lib/onfido/models/workflow_run_response_error.rb +226 -0
  284. data/lib/onfido/models/workflow_run_shared.rb +296 -0
  285. data/lib/onfido/models/workflow_run_shared_link.rb +290 -0
  286. data/lib/onfido/version.rb +12 -2
  287. data/lib/onfido/webhook_event_verifier.rb +20 -0
  288. data/lib/onfido.rb +309 -25
  289. data/onfido.gemspec +42 -33
  290. data/spec/integrations/address_picker_spec.rb +16 -0
  291. data/spec/integrations/applicant_spec.rb +73 -95
  292. data/spec/integrations/check_spec.rb +60 -41
  293. data/spec/integrations/document_spec.rb +28 -57
  294. data/spec/integrations/extraction_spec.rb +27 -12
  295. data/spec/integrations/id_photo_spec.rb +55 -0
  296. data/spec/integrations/live_photo_spec.rb +28 -45
  297. data/spec/integrations/live_video_spec.rb +33 -19
  298. data/spec/integrations/media/sample_driving_licence.png +0 -0
  299. data/spec/integrations/media/sample_photo.png +0 -0
  300. data/spec/integrations/motion_capture_spec.rb +30 -24
  301. data/spec/integrations/report_schema_spec.rb +45 -0
  302. data/spec/integrations/report_spec.rb +34 -25
  303. data/spec/integrations/sdk_token_spec.rb +12 -10
  304. data/spec/integrations/tasks_spec.rb +45 -0
  305. data/spec/integrations/watchlist_monitor_spec.rb +73 -0
  306. data/spec/integrations/webhook_spec.rb +40 -88
  307. data/spec/integrations/workflow_run_output_spec.rb +117 -0
  308. data/spec/integrations/workflow_run_spec.rb +64 -34
  309. data/spec/shared_contexts/with_applicant.rb +24 -0
  310. data/spec/shared_contexts/with_check.rb +18 -0
  311. data/spec/shared_contexts/with_document.rb +13 -0
  312. data/spec/shared_contexts/with_live_photo.rb +18 -0
  313. data/spec/shared_contexts/with_onfido.rb +14 -0
  314. data/spec/shared_contexts/with_workflow_run.rb +19 -0
  315. data/spec/spec_helper.rb +73 -11
  316. data/spec/webhook_event_verifier_spec.rb +29 -0
  317. metadata +367 -157
  318. data/.github/workflows/gem-push.yml +0 -31
  319. data/.github/workflows/ruby.yml +0 -25
  320. data/.gitignore +0 -19
  321. data/.rspec +0 -2
  322. data/.rubocop.yml +0 -13
  323. data/lib/onfido/api.rb +0 -65
  324. data/lib/onfido/errors/connection_error.rb +0 -6
  325. data/lib/onfido/errors/onfido_error.rb +0 -30
  326. data/lib/onfido/errors/request_error.rb +0 -6
  327. data/lib/onfido/errors/server_error.rb +0 -6
  328. data/lib/onfido/options.rb +0 -38
  329. data/lib/onfido/resource.rb +0 -153
  330. data/lib/onfido/resources/address.rb +0 -9
  331. data/lib/onfido/resources/applicant.rb +0 -29
  332. data/lib/onfido/resources/check.rb +0 -28
  333. data/lib/onfido/resources/document.rb +0 -28
  334. data/lib/onfido/resources/extraction.rb +0 -11
  335. data/lib/onfido/resources/live_photo.rb +0 -27
  336. data/lib/onfido/resources/live_video.rb +0 -17
  337. data/lib/onfido/resources/monitor.rb +0 -32
  338. data/lib/onfido/resources/motion_capture.rb +0 -21
  339. data/lib/onfido/resources/report.rb +0 -21
  340. data/lib/onfido/resources/sdk_token.rb +0 -10
  341. data/lib/onfido/resources/webhook.rb +0 -40
  342. data/lib/onfido/resources/workflow_run.rb +0 -21
  343. data/spec/integrations/address_spec.rb +0 -13
  344. data/spec/integrations/monitor_spec.rb +0 -100
  345. data/spec/integrations/resource_spec.rb +0 -106
  346. data/spec/onfido/api_spec.rb +0 -22
  347. data/spec/onfido/connection_error_spec.rb +0 -20
  348. data/spec/onfido/options_spec.rb +0 -39
  349. data/spec/onfido/request_error_spec.rb +0 -36
  350. data/spec/support/fake_onfido_api.rb +0 -295
  351. data/spec/support/fixtures/4xx_response.json +0 -14
  352. data/spec/support/fixtures/addresses.json +0 -24
  353. data/spec/support/fixtures/applicant.json +0 -28
  354. data/spec/support/fixtures/applicants.json +0 -12
  355. data/spec/support/fixtures/check.json +0 -12
  356. data/spec/support/fixtures/checks.json +0 -16
  357. data/spec/support/fixtures/document.json +0 -10
  358. data/spec/support/fixtures/documents.json +0 -23
  359. data/spec/support/fixtures/extraction.json +0 -23
  360. data/spec/support/fixtures/live_photo.json +0 -9
  361. data/spec/support/fixtures/live_photos.json +0 -22
  362. data/spec/support/fixtures/live_video.json +0 -23
  363. data/spec/support/fixtures/live_videos.json +0 -27
  364. data/spec/support/fixtures/monitor.json +0 -8
  365. data/spec/support/fixtures/monitor_matches.json +0 -12
  366. data/spec/support/fixtures/monitors.json +0 -12
  367. data/spec/support/fixtures/motion_capture.json +0 -9
  368. data/spec/support/fixtures/motion_captures.json +0 -13
  369. data/spec/support/fixtures/not_scheduled_for_deletion_error.json +0 -7
  370. data/spec/support/fixtures/report.json +0 -10
  371. data/spec/support/fixtures/reports.json +0 -24
  372. data/spec/support/fixtures/sdk_token.json +0 -3
  373. data/spec/support/fixtures/signed_workflow_run.pdf +0 -0
  374. data/spec/support/fixtures/unexpected_error_format.json +0 -3
  375. data/spec/support/fixtures/webhook.json +0 -14
  376. data/spec/support/fixtures/webhooks.json +0 -31
  377. data/spec/support/fixtures/workflow_run.json +0 -20
  378. data/spec/support/fixtures/workflow_runs.json +0 -42
@@ -1,64 +1,83 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- describe Onfido::Check do
4
- include_context 'fake onfido api'
5
-
6
- subject(:check) { onfido.check }
3
+ require_relative '../shared_contexts/with_check'
7
4
 
8
- let(:applicant_id) { '61f659cb-c90b-4067-808a-6136b5c01351' }
9
- let(:check_id) { '8546921-123123-123123' }
5
+ describe Onfido::Check do
6
+ describe 'Checks' do
7
+ include_context 'with check'
10
8
 
11
- describe '#create' do
12
- it 'creates a new check for an applicant' do
13
- response = check.create(
14
- applicant_id: applicant_id,
15
- report_names: ['identity_enhanced']
16
- )
17
- expect(response['id']).not_to be_nil
9
+ it 'creates a check' do
10
+ expect(check).not_to be_nil
11
+ expect(check).to be_an_instance_of Onfido::Check
12
+ expect(check.applicant_id).to eq applicant_id
13
+ expect(check.report_ids.size).to eq 2
14
+ expect(check.status).to eq 'in_progress'
18
15
  end
19
- end
20
16
 
21
- describe '#find' do
22
- it 'returns an existing check for the applicant' do
23
- response = check.find(check_id)
17
+ context 'consider check' do
18
+ let(:check_builder) do
19
+ check_builder = Onfido::CheckBuilder.new({
20
+ applicant_id: applicant_id,
21
+ document_ids: [document_id],
22
+ report_names: [Onfido::ReportName::DOCUMENT],
23
+ consider: [Onfido::ReportName::DOCUMENT],
24
+ })
25
+ end
24
26
 
25
- expect(response['id']).to eq(check_id)
27
+ it 'creates a consider check' do
28
+ expect(check).not_to be_nil
29
+ expect(check).to be_an_instance_of Onfido::Check
30
+ expect(check.applicant_id).to eq applicant_id
31
+ end
26
32
  end
27
33
 
28
- it 'returns report_ids' do
29
- response = check.find(check_id)
34
+ context 'US driving licence check' do
35
+ let(:us_driving_licence_builder) do
36
+ Onfido::UsDrivingLicenceBuilder.new({
37
+ id_number: '12345',
38
+ issue_state: 'GA',
39
+ })
40
+ end
30
41
 
31
- expect(response['report_ids'].first).to be_a(String)
42
+ let(:check_builder) do
43
+ Onfido::CheckBuilder.new({
44
+ applicant_id: applicant_id,
45
+ document_ids: [document_id],
46
+ report_names: [Onfido::ReportName::DOCUMENT],
47
+ us_driving_licence: us_driving_licence_builder,
48
+ })
49
+ end
50
+
51
+ it 'creates a driving licence check' do
52
+ expect(check).not_to be_nil
53
+ expect(check).to be_an_instance_of Onfido::Check
54
+ expect(check.applicant_id).to eq applicant_id
55
+ end
32
56
  end
33
- end
34
57
 
35
- describe '#all' do
36
- context 'with the default page and per page params' do
37
- it 'returns all existing checks for the applicant' do
38
- response = check.all(applicant_id)
58
+ it 'lists checks' do
59
+ list_of_checks = onfido_api.list_checks(applicant_id)
39
60
 
40
- expect(response['checks'].size).to eq(1)
41
- end
61
+ expect(list_of_checks).not_to be_nil
62
+ expect(list_of_checks).to be_an_instance_of Onfido::ChecksList
63
+ expect(list_of_checks.checks.size).to be > 0
42
64
  end
43
65
 
44
- it 'returns report_ids' do
45
- response = check.all(applicant_id)
46
-
47
- expect(response['checks'].first['report_ids'].first).to be_a(String)
66
+ it 'finds a check' do
67
+ get_check = onfido_api.find_check(check_id)
68
+
69
+ expect(get_check).to be_an_instance_of(Onfido::Check)
70
+ expect(get_check.id).to eq check_id
48
71
  end
49
- end
50
72
 
51
- describe '#resume' do
52
- it 'returns success response' do
53
- expect { check.resume(check_id) }.not_to raise_error
73
+ it 'restarts a check' do
74
+ onfido_api.resume_check(check_id)
54
75
  end
55
- end
56
76
 
57
- describe '#download' do
58
- it 'returns the file data' do
59
- response = check.download(check_id)
77
+ it 'downloads a check' do
78
+ file = onfido_api.download_check(check_id)
60
79
 
61
- expect(response).not_to be_nil
80
+ expect(file.size).to be > 0
62
81
  end
63
82
  end
64
83
  end
@@ -1,75 +1,46 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'tempfile'
3
+ require_relative '../shared_contexts/with_document'
4
4
 
5
5
  describe Onfido::Document do
6
- include_context 'fake onfido api'
7
-
8
- subject(:document) { onfido.document }
9
-
10
- describe '#create' do
11
- let(:params) do
12
- {
13
- applicant_id: '1030303-123123-123123',
14
- type: 'driving_licence',
15
- file: file,
16
- side: 'front',
17
- location: {
18
- ip_address: '127.0.0.1',
19
- country_of_residence: 'GBR'
20
- }
21
- }
6
+ describe 'Documents' do
7
+ include_context 'with document'
8
+
9
+ it 'uploads a document' do
10
+ expect(document).not_to be_nil
11
+ expect(document.id).not_to be_empty
12
+ expect(document.file_name).to eq('sample_driving_licence.png')
13
+ expect(document).to be_an_instance_of(Onfido::Document)
22
14
  end
23
15
 
24
- context 'with a File-like object to upload' do
25
- let(:file) { Tempfile.new(['driving_licence', '.jpg']) }
26
-
27
- after do
28
- file.close
29
- file.unlink
30
- end
16
+ it 'lists documents' do
17
+ list_of_documents = onfido_api.list_documents(applicant_id)
31
18
 
32
- it 'creates a new document' do
33
- response = document.create(**params)
34
-
35
- expect(response['id']).not_to be_nil
36
- end
19
+ expect(list_of_documents).to be_an_instance_of(Onfido::DocumentsList)
20
+ expect(list_of_documents.documents.size).to be > 0
37
21
  end
38
22
 
39
- context 'passing in a non-File-like file to upload' do
40
- let(:file) { 'https://onfido.com/images/logo.png' }
23
+ it 'finds a document' do
24
+ get_document = onfido_api.find_document(document_id)
41
25
 
42
- it 'raises an ArgumentError' do
43
- expect { document.create(**params) }
44
- .to raise_error(ArgumentError, /must be a `File`-like object/)
45
- end
26
+ expect(get_document).to be_an_instance_of(Onfido::Document)
27
+ expect(get_document.id).to eq document_id
46
28
  end
47
- end
48
29
 
49
- describe '#find' do
50
- it 'returns the expected document' do
51
- document_id = '7568415-123123-123123'
52
- response = document.find(document_id)
30
+ it 'downloads a document' do
31
+ file = onfido_api.download_document(document_id)
53
32
 
54
- expect(response['id']).to eq(document_id)
33
+ expect(file.size).to be > 0
55
34
  end
56
- end
57
35
 
58
- describe '#all' do
59
- it 'returns list of documents' do
60
- applicant_id = '1030303-123123-123123'
61
- response = document.all(applicant_id)
62
-
63
- expect(response['documents']).not_to be_empty
64
- end
65
- end
66
-
67
- describe '#download' do
68
- it 'returns the file data' do
69
- document_id = '1212121-123123-123123'
70
- response = document.download(document_id)
71
-
72
- expect(response).not_to be_nil
36
+ it 'cannot download an inexistent document' do
37
+ inexistent_document_id = '00000000-0000-0000-0000-000000000000'
38
+
39
+ expect {
40
+ onfido_api.download_document(inexistent_document_id)
41
+ }.to raise_error(Onfido::ApiError) { |e|
42
+ expect(e.code).to eq(404)
43
+ }
73
44
  end
74
45
  end
75
46
  end
@@ -1,23 +1,38 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'tempfile'
3
+ require_relative '../shared_contexts/with_document'
4
4
 
5
5
  describe Onfido::Extraction do
6
- include_context 'fake onfido api'
6
+ describe 'Extraction' do
7
+ include_context 'with document'
7
8
 
8
- subject(:extraction) { onfido.extraction }
9
+ it 'performs extraction on a document' do
10
+ extraction = onfido_api.extract(
11
+ Onfido::ExtractRequest.new({
12
+ 'document_id': document_id
13
+ })
14
+ )
9
15
 
10
- describe '#create' do
11
- let(:params) do
12
- {
13
- document_id: '7568415-123123-123123'
14
- }
15
- end
16
+ expect(extraction).not_to be_nil
17
+ expect(extraction).to be_an_instance_of Onfido::Extraction
18
+ expect(extraction.document_id).to eq document_id
19
+
20
+ document_classification = extraction.document_classification
21
+ extracted_data = extraction.extracted_data
16
22
 
17
- it 'creates a new extraction' do
18
- response = extraction.create(**params)
23
+ # Check response body: document classification
24
+ expect(document_classification).not_to be_nil
25
+ expect(document_classification.document_type).to eq Onfido::DocumentTypes::DRIVING_LICENCE
26
+ expect(document_classification.issuing_country).to eq Onfido::CountryCodes::GBR
19
27
 
20
- expect(response['document_id']).to eq('7568415-123123-123123')
28
+ # Check response body: extracted data
29
+ expect(extracted_data).not_to be_nil
30
+ expect(extracted_data.date_of_birth).to eq Date.parse('1976-03-11')
31
+ expect(extracted_data.date_of_expiry).to eq Date.parse('2031-05-28')
32
+ expect(extracted_data.document_number).to eq '200407512345'
33
+ expect(extracted_data.first_name).to eq 'SARAH'
34
+ expect(extracted_data.last_name).to eq 'MORGAN'
35
+ expect(extracted_data.gender).to eq 'Female'
21
36
  end
22
37
  end
23
38
  end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../shared_contexts/with_applicant'
4
+
5
+ describe Onfido::IdPhoto do
6
+ describe 'Id Photo' do
7
+ include_context 'with applicant'
8
+
9
+ let(:id_photo) do
10
+ onfido_api.upload_id_photo(
11
+ applicant_id: applicant_id,
12
+ file: File.new('spec/integrations/media/sample_photo.png')
13
+ )
14
+ end
15
+ let!(:id_photo_id) { id_photo.id }
16
+
17
+ it 'uploads a Id photo' do
18
+ expect(id_photo).not_to be_nil
19
+ expect(id_photo_id).not_to be_empty
20
+ expect(id_photo).to be_an_instance_of Onfido::IdPhoto
21
+ expect(id_photo.file_name).to eq "#{id_photo_id}.png"
22
+ end
23
+
24
+ it 'lists id photos' do
25
+ id_photos = onfido_api.list_id_photos(applicant_id)
26
+
27
+ expect(id_photos.id_photos.length).to be > 0
28
+ expect(id_photos).to be_an_instance_of Onfido::IdPhotosList
29
+ end
30
+
31
+ it 'retrieves id photo' do
32
+ get_id_photo = onfido_api.find_id_photo(id_photo_id)
33
+
34
+ expect(get_id_photo).to be_an_instance_of Onfido::IdPhoto
35
+ expect(get_id_photo.id).to eq id_photo_id
36
+ end
37
+
38
+ it 'downloads id photo' do
39
+ file = onfido_api.download_id_photo(id_photo_id)
40
+
41
+ expect(file.length).to be > 0
42
+ end
43
+
44
+ it 'raises an error with the correct status code when trying to download an inexistent id photo' do
45
+ inexistent_id_photo_id = '00000000-0000-0000-0000-000000000000'
46
+
47
+ expect {
48
+ onfido_api.download_id_photo(inexistent_id_photo_id)
49
+ }.to raise_error(Onfido::ApiError) { |e|
50
+ expect(e.message).to match(/the server returns an error/)
51
+ expect(e.code).to eq(404)
52
+ }
53
+ end
54
+ end
55
+ end
@@ -1,64 +1,47 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'tempfile'
3
+ require_relative '../shared_contexts/with_live_photo'
4
4
 
5
5
  describe Onfido::LivePhoto do
6
- include_context 'fake onfido api'
7
-
8
- subject(:live_photo) { onfido.live_photo }
9
-
10
- describe '#create' do
11
- let(:params) { { applicant_id: '123456', file: file } }
12
-
13
- context 'with a File-like object to upload' do
14
- let(:file) { Tempfile.new(['passport', '.jpg']) }
15
-
16
- after do
17
- file.close
18
- file.unlink
19
- end
20
-
21
- it 'creates a new photo' do
22
- response = live_photo.create(**params)
23
-
24
- expect(response['id']).not_to be_nil
25
- end
6
+ describe 'Live Photo' do
7
+ include_context 'with live photo'
8
+
9
+ it 'uploads a live photo' do
10
+ expect(live_photo).not_to be_nil
11
+ expect(live_photo_id).not_to be_empty
12
+ expect(live_photo.file_name).to eq('sample_photo.png')
13
+ expect(live_photo).to be_an_instance_of Onfido::LivePhoto
26
14
  end
27
15
 
28
- context 'passing in a non-File-like file to upload' do
29
- let(:file) { 'https://onfido.com/images/photo.jpg' }
16
+ it 'lists live photos' do
17
+ live_photos = onfido_api.list_live_photos(applicant_id)
30
18
 
31
- it 'raises an ArgumentError' do
32
- expect { live_photo.create(**params) }
33
- .to raise_error(ArgumentError, /must be a `File`-like object/)
34
- end
19
+ expect(live_photos.live_photos.length).to be > 0
20
+ expect(live_photos).to be_an_instance_of Onfido::LivePhotosList
35
21
  end
36
- end
37
22
 
38
- describe '#find' do
39
- it 'returns the expected live photo' do
40
- live_photo_id = '3538c8f6-fdce-4745-9d34-fc246bc05aa1'
41
- response = live_photo.find(live_photo_id)
23
+ it 'retrieves live photo' do
24
+ live_photo = onfido_api.find_live_photo(live_photo_id)
42
25
 
43
- expect(response['id']).to eq(live_photo_id)
26
+ expect(live_photo_id).to eq(live_photo_id)
27
+ expect(live_photo).to be_an_instance_of Onfido::LivePhoto
44
28
  end
45
- end
46
29
 
47
- describe '#all' do
48
- it 'returns list of documents' do
49
- applicant_id = '1030303-123123-123123'
50
- response = live_photo.all(applicant_id)
30
+ it 'downloads live photo' do
31
+ file = onfido_api.download_live_photo(live_photo_id)
51
32
 
52
- expect(response['live_photos']).not_to be_empty
33
+ expect(file.length).to be > 0
53
34
  end
54
- end
55
35
 
56
- describe '#download' do
57
- it 'returns the file data' do
58
- live_photo_id = '3538c8f6-fdce-4745-9d34-fc246bc05aa1'
59
- response = live_photo.download(live_photo_id)
36
+ it 'raises an error with the correct status code when trying to download an inexistent live photo' do
37
+ inexistent_live_photo_id = '00000000-0000-0000-0000-000000000000'
60
38
 
61
- expect(response).not_to be_nil
39
+ expect {
40
+ onfido_api.download_live_photo(inexistent_live_photo_id)
41
+ }.to raise_error(Onfido::ApiError) { |e|
42
+ expect(e.message).to match(/the server returns an error/)
43
+ expect(e.code).to eq(404)
44
+ }
62
45
  end
63
46
  end
64
47
  end
@@ -1,36 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'tempfile'
3
+ require_relative '../shared_contexts/with_onfido'
4
4
 
5
5
  describe Onfido::LiveVideo do
6
- include_context 'fake onfido api'
6
+ describe 'Live Video' do
7
+ include_context 'with onfido'
7
8
 
8
- subject(:live_video) { onfido.live_video }
9
+ let(:applicant_id) { ENV['ONFIDO_SAMPLE_APPLICANT_ID'] }
10
+ let(:live_video_id) { ENV['ONFIDO_SAMPLE_VIDEO_ID_1'] }
9
11
 
10
- let(:live_video_id) { 'c9701e9b-83aa-442f-995b-20320ee8fb01' }
12
+ it 'lists live videos' do
13
+ live_videos = onfido_api.list_live_videos(applicant_id)
11
14
 
12
- describe '#find' do
13
- it 'returns the expected live photo' do
14
- response = live_video.find(live_video_id)
15
+ expect(live_videos.live_videos.length).to be > 0
16
+ expect(live_videos).to be_an_instance_of Onfido::LiveVideosList
17
+ expect(live_videos.live_videos.first).to be_an_instance_of Onfido::LiveVideo
18
+ end
19
+
20
+ it 'retrieves live videos' do
21
+ get_live_video = onfido_api.find_live_video(live_video_id)
15
22
 
16
- expect(response['id']).to eq(live_video_id)
23
+ expect(get_live_video.id).to eq(live_video_id)
24
+ expect(get_live_video).to be_an_instance_of Onfido::LiveVideo
17
25
  end
18
- end
19
26
 
20
- describe '#all' do
21
- it 'returns list of documents' do
22
- applicant_id = '1030303-123123-123123'
23
- response = live_video.all(applicant_id)
27
+ it 'downloads live video' do
28
+ file = onfido_api.download_live_video(live_video_id)
24
29
 
25
- expect(response['live_videos']).not_to be_empty
30
+ expect(file.length).to be > 0
31
+ end
32
+
33
+ it 'downloads live video frame' do
34
+ file = onfido_api.download_live_video_frame(live_video_id)
35
+
36
+ expect(file.length).to be > 0
26
37
  end
27
- end
28
38
 
29
- describe '#download' do
30
- it 'returns the file data' do
31
- response = live_video.download(live_video_id)
39
+ it 'raises an error with the correct status code when trying to download an inexistent live video' do
40
+ inexistent_live_video_id = '00000000-0000-0000-0000-000000000000'
32
41
 
33
- expect(response).not_to be_nil
42
+ expect {
43
+ onfido_api.download_live_video(inexistent_live_video_id)
44
+ }.to raise_error(Onfido::ApiError) { |e|
45
+ expect(e.message).to match(/the server returns an error/)
46
+ expect(e.code).to eq(404)
47
+ }
34
48
  end
35
49
  end
36
50
  end
@@ -1,44 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'tempfile'
3
+ require_relative '../shared_contexts/with_onfido'
4
4
 
5
5
  describe Onfido::MotionCapture do
6
- include_context 'fake onfido api'
6
+ describe 'Motion Capture' do
7
+ include_context 'with onfido'
7
8
 
8
- subject(:motion_capture) { onfido.motion_capture }
9
+ let(:applicant_id) { ENV['ONFIDO_SAMPLE_APPLICANT_ID'] }
10
+ let(:motion_id) { ENV['ONFIDO_SAMPLE_MOTION_ID_1'] }
9
11
 
10
- let(:motion_capture_id) { 'b1ae05b7-fb12-47c3-971c-311b56fc8de6' }
12
+ it 'lists motion captures' do
13
+ motion_captures = onfido_api.list_motion_captures(applicant_id)
11
14
 
12
- describe '#find' do
13
- it 'returns the expected motion capture' do
14
- response = motion_capture.find(motion_capture_id)
15
+ expect(motion_captures.motion_captures.length).to be > 0
16
+ expect(motion_captures).to be_an_instance_of Onfido::MotionCapturesList
17
+ expect(motion_captures.motion_captures.first).to be_an_instance_of Onfido::MotionCapture
18
+ end
19
+
20
+ it 'retrieves motion capture' do
21
+ get_motion_capture = onfido_api.find_motion_capture(motion_id)
15
22
 
16
- expect(response['id']).to eq(motion_capture_id)
23
+ expect(get_motion_capture.id).to eq(motion_id)
24
+ expect(get_motion_capture).to be_an_instance_of Onfido::MotionCapture
17
25
  end
18
- end
19
26
 
20
- describe '#all' do
21
- it 'returns list of motion captures' do
22
- applicant_id = '1030303-123123-123123'
23
- response = motion_capture.all(applicant_id)
27
+ it 'downloads motion capture' do
28
+ file = onfido_api.download_motion_capture(motion_id)
24
29
 
25
- expect(response['motion_captures']).not_to be_empty
30
+ expect(file.length).to be > 0
26
31
  end
27
- end
28
32
 
29
- describe '#download' do
30
- it 'returns the file data' do
31
- response = motion_capture.download(motion_capture_id)
33
+ it 'downloads motion capture frame' do
34
+ file = onfido_api.download_motion_capture_frame(motion_id)
32
35
 
33
- expect(response).not_to be_nil
36
+ expect(file.length).to be > 0
34
37
  end
35
- end
36
38
 
37
- describe '#frame' do
38
- it 'returns the frame data' do
39
- response = motion_capture.frame(motion_capture_id)
39
+ it 'raises an error with the correct status code when trying to download an inexistent motion capture' do
40
+ inexistent_motion_id = '00000000-0000-0000-0000-000000000000'
40
41
 
41
- expect(response).not_to be_nil
42
+ expect {
43
+ onfido_api.download_motion_capture(inexistent_motion_id)
44
+ }.to raise_error(Onfido::ApiError) { |e|
45
+ expect(e.message).to match(/the server returns an error/)
46
+ expect(e.code).to eq(404)
47
+ }
42
48
  end
43
49
  end
44
50
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../shared_contexts/with_document'
4
+ require_relative '../shared_contexts/with_live_photo'
5
+
6
+ describe Onfido::Report do
7
+ describe 'Report schemas' do
8
+ include_context 'with document'
9
+ include_context 'with live photo'
10
+
11
+ it 'schema of Document report is valid' do
12
+ document_report_id = onfido_api.create_check(
13
+ Onfido::CheckBuilder.new(
14
+ applicant_id: applicant_id,
15
+ document_ids: [document_id],
16
+ report_names: [Onfido::ReportName::DOCUMENT],
17
+ )).report_ids[0]
18
+
19
+ document_report = repeat_request_until_status_changes(
20
+ Onfido::ReportStatus::COMPLETE
21
+ ) { onfido_api.find_report(document_report_id) }
22
+
23
+ expect(document_report).to be_an_instance_of Onfido::DocumentReport
24
+
25
+ expect(document_report.name).to eq("document")
26
+ expect(document_report.breakdown.data_comparison.breakdown.issuing_country.result).to eq("clear")
27
+ expect(document_report.properties.date_of_birth).to eq(Date.parse("1990-01-01"))
28
+ end
29
+
30
+ it 'schema of Facial Similarity report is valid' do
31
+ facial_similarity_report_id = onfido_api.create_check(
32
+ Onfido::CheckBuilder.new(
33
+ applicant_id: applicant_id,
34
+ document_ids: [document_id],
35
+ report_names: [Onfido::ReportName::FACIAL_SIMILARITY_PHOTO],
36
+ )).report_ids[0]
37
+
38
+ facial_similarity_report = repeat_request_until_status_changes(
39
+ Onfido::ReportStatus::COMPLETE
40
+ ) { onfido_api.find_report(facial_similarity_report_id) }
41
+
42
+ expect(facial_similarity_report).to be_an_instance_of Onfido::FacialSimilarityPhotoReport
43
+ end
44
+ end
45
+ end