onfido 2.9.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -4
- data/Gemfile +5 -4
- data/LICENSE +5 -7
- data/README.md +69 -51
- data/Rakefile +10 -0
- data/lib/onfido/api/default_api.rb +4233 -0
- data/lib/onfido/api_client.rb +431 -0
- data/lib/onfido/api_error.rb +58 -0
- data/lib/onfido/configuration.rb +420 -0
- data/lib/onfido/models/address.rb +422 -0
- data/lib/onfido/models/address_builder.rb +422 -0
- data/lib/onfido/models/address_shared.rb +415 -0
- data/lib/onfido/models/addresses_list.rb +216 -0
- data/lib/onfido/models/applicant.rb +390 -0
- data/lib/onfido/models/applicant_builder.rb +358 -0
- data/lib/onfido/models/applicant_create.rb +281 -0
- data/lib/onfido/models/applicant_request.rb +232 -0
- data/lib/onfido/models/applicant_response.rb +341 -0
- data/lib/onfido/models/applicant_shared.rb +246 -0
- data/lib/onfido/models/applicant_update.rb +267 -0
- data/lib/onfido/models/applicant_updater.rb +344 -0
- data/lib/onfido/models/applicants_list.rb +223 -0
- data/lib/onfido/models/check.rb +419 -0
- data/lib/onfido/models/check_builder.rb +360 -0
- data/lib/onfido/models/check_request.rb +301 -0
- data/lib/onfido/models/check_response.rb +350 -0
- data/lib/onfido/models/check_shared.rb +266 -0
- data/lib/onfido/models/checks_list.rb +223 -0
- data/lib/onfido/models/complete_task_builder.rb +221 -0
- data/lib/onfido/models/complete_task_data_builder.rb +106 -0
- data/lib/onfido/models/consent_item.rb +272 -0
- data/lib/onfido/models/consents_builder.rb +205 -0
- data/lib/onfido/models/country_codes.rb +289 -0
- data/lib/onfido/models/device_intelligence_breakdown.rb +223 -0
- data/lib/onfido/models/device_intelligence_breakdown_breakdown.rb +214 -0
- data/lib/onfido/models/device_intelligence_breakdown_breakdown_device.rb +215 -0
- data/lib/onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.rb +232 -0
- data/lib/onfido/models/device_intelligence_breakdown_properties.rb +232 -0
- data/lib/onfido/models/device_intelligence_breakdown_properties_device.rb +468 -0
- data/lib/onfido/models/device_intelligence_breakdown_properties_geolocation.rb +257 -0
- data/lib/onfido/models/device_intelligence_breakdown_properties_ip.rb +245 -0
- data/lib/onfido/models/device_intelligence_report.rb +345 -0
- data/lib/onfido/models/document.rb +376 -0
- data/lib/onfido/models/document_breakdown.rb +286 -0
- data/lib/onfido/models/document_breakdown_age_validation.rb +224 -0
- data/lib/onfido/models/document_breakdown_age_validation_breakdown.rb +214 -0
- data/lib/onfido/models/document_breakdown_compromised_document.rb +224 -0
- data/lib/onfido/models/document_breakdown_compromised_document_breakdown.rb +223 -0
- data/lib/onfido/models/document_breakdown_data_comparison.rb +224 -0
- data/lib/onfido/models/document_breakdown_data_comparison_breakdown.rb +277 -0
- data/lib/onfido/models/document_breakdown_data_comparison_breakdown_issuing_country.rb +223 -0
- data/lib/onfido/models/document_breakdown_data_consistency.rb +224 -0
- data/lib/onfido/models/document_breakdown_data_consistency_breakdown.rb +295 -0
- data/lib/onfido/models/document_breakdown_data_validation.rb +224 -0
- data/lib/onfido/models/document_breakdown_data_validation_breakdown.rb +268 -0
- data/lib/onfido/models/document_breakdown_data_validation_breakdown_document_expiration.rb +224 -0
- data/lib/onfido/models/document_breakdown_data_validation_breakdown_expiry_date.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown.rb +241 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown_colour_picture.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown_conclusive_document_quality.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown_image_quality.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown_supported_document.rb +224 -0
- data/lib/onfido/models/document_breakdown_issuing_authority.rb +224 -0
- data/lib/onfido/models/document_breakdown_issuing_authority_breakdown.rb +223 -0
- data/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_active_authentication.rb +224 -0
- data/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_passive_authentication.rb +224 -0
- data/lib/onfido/models/document_breakdown_police_record.rb +215 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown.rb +277 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_digital_tampering.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_face_detection.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_fonts.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_original_document_present.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_other.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_picture_face_integrity.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_security_features.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_template.rb +224 -0
- data/lib/onfido/models/document_cdq_reasons.rb +285 -0
- data/lib/onfido/models/document_iq_reasons.rb +305 -0
- data/lib/onfido/models/document_odp_reasons.rb +245 -0
- data/lib/onfido/models/document_properties.rb +663 -0
- data/lib/onfido/models/document_properties_address_lines.rb +259 -0
- data/lib/onfido/models/document_properties_barcode_inner.rb +367 -0
- data/lib/onfido/models/document_properties_document_classification.rb +232 -0
- data/lib/onfido/models/document_properties_document_numbers_inner.rb +223 -0
- data/lib/onfido/models/document_properties_driving_licence_information.rb +241 -0
- data/lib/onfido/models/document_properties_extracted_data.rb +394 -0
- data/lib/onfido/models/document_properties_nfc.rb +322 -0
- data/lib/onfido/models/document_report.rb +354 -0
- data/lib/onfido/models/document_response.rb +272 -0
- data/lib/onfido/models/document_shared.rb +301 -0
- data/lib/onfido/models/document_types.rb +64 -0
- data/lib/onfido/models/document_video_report.rb +354 -0
- data/lib/onfido/models/document_video_with_address_information_report.rb +354 -0
- data/lib/onfido/models/document_with_address_information_report.rb +354 -0
- data/lib/onfido/models/document_with_driver_verification_report.rb +354 -0
- data/lib/onfido/models/document_with_driver_verification_report_all_of_properties.rb +731 -0
- data/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle.rb +236 -0
- data/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_vehicle_class_details_inner.rb +245 -0
- data/lib/onfido/models/document_with_driving_licence_information_report.rb +354 -0
- data/lib/onfido/models/documents_list.rb +223 -0
- data/lib/onfido/models/error.rb +214 -0
- data/lib/onfido/models/error1.rb +224 -0
- data/lib/onfido/models/error_properties.rb +234 -0
- data/lib/onfido/models/error_properties1.rb +223 -0
- data/lib/onfido/models/extract_request.rb +222 -0
- data/lib/onfido/models/extraction.rb +233 -0
- data/lib/onfido/models/extraction_document_classification.rb +289 -0
- data/lib/onfido/models/extraction_extracted_data.rb +530 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown.rb +232 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_face_comparison.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_motion_report.rb +354 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown.rb +232 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown.rb +214 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match_properties.rb +225 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown.rb +214 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown.rb +232 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_report.rb +354 -0
- data/lib/onfido/models/facial_similarity_photo_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_photo_report.rb +354 -0
- data/lib/onfido/models/facial_similarity_video_breakdown.rb +232 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_face_comparison.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_video_report.rb +354 -0
- data/lib/onfido/models/id_number.rb +269 -0
- data/lib/onfido/models/id_photo.rb +289 -0
- data/lib/onfido/models/id_photo_response.rb +282 -0
- data/lib/onfido/models/id_photos_list.rb +223 -0
- data/lib/onfido/models/identity_enhanced_breakdown.rb +241 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown.rb +232 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies_properties.rb +214 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_telephone_database.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_voting_register.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown.rb +223 -0
- data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_credit_agencies.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_voting_register.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_mortality.rb +215 -0
- data/lib/onfido/models/identity_enhanced_breakdown_sources.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown.rb +214 -0
- data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources_properties.rb +214 -0
- data/lib/onfido/models/identity_enhanced_properties.rb +227 -0
- data/lib/onfido/models/identity_enhanced_properties_matched_addresses_inner.rb +227 -0
- data/lib/onfido/models/identity_enhanced_report.rb +354 -0
- data/lib/onfido/models/india_pan_report.rb +354 -0
- data/lib/onfido/models/india_pan_report_all_of_breakdown.rb +214 -0
- data/lib/onfido/models/india_pan_report_all_of_breakdown_device.rb +214 -0
- data/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown.rb +223 -0
- data/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid.rb +214 -0
- data/lib/onfido/models/india_pan_report_all_of_properties.rb +214 -0
- data/lib/onfido/models/india_pan_report_all_of_properties_device.rb +225 -0
- data/lib/onfido/models/known_faces_breakdown.rb +223 -0
- data/lib/onfido/models/known_faces_breakdown_image_integrity.rb +215 -0
- data/lib/onfido/models/known_faces_breakdown_previously_seen_faces.rb +215 -0
- data/lib/onfido/models/known_faces_properties.rb +217 -0
- data/lib/onfido/models/known_faces_properties_matches_inner.rb +255 -0
- data/lib/onfido/models/known_faces_report.rb +354 -0
- data/lib/onfido/models/live_photo.rb +289 -0
- data/lib/onfido/models/live_photo_response.rb +282 -0
- data/lib/onfido/models/live_photos_list.rb +223 -0
- data/lib/onfido/models/live_video.rb +287 -0
- data/lib/onfido/models/live_videos_list.rb +223 -0
- data/lib/onfido/models/location.rb +254 -0
- data/lib/onfido/models/location_builder.rb +254 -0
- data/lib/onfido/models/location_shared.rb +247 -0
- data/lib/onfido/models/motion_capture.rb +275 -0
- data/lib/onfido/models/motion_captures_list.rb +223 -0
- data/lib/onfido/models/photo_auto_reasons.rb +255 -0
- data/lib/onfido/models/photo_reasons.rb +255 -0
- data/lib/onfido/models/proof_of_address_breakdown.rb +232 -0
- data/lib/onfido/models/proof_of_address_breakdown_data_comparison.rb +224 -0
- data/lib/onfido/models/proof_of_address_breakdown_data_comparison_breakdown.rb +232 -0
- data/lib/onfido/models/proof_of_address_breakdown_document_classification.rb +224 -0
- data/lib/onfido/models/proof_of_address_breakdown_document_classification_breakdown.rb +214 -0
- data/lib/onfido/models/proof_of_address_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/proof_of_address_breakdown_image_integrity_breakdown.rb +214 -0
- data/lib/onfido/models/proof_of_address_properties.rb +319 -0
- data/lib/onfido/models/proof_of_address_report.rb +354 -0
- data/lib/onfido/models/repeat_attempts_list.rb +292 -0
- data/lib/onfido/models/repeat_attempts_list_repeat_attempts_inner.rb +333 -0
- data/lib/onfido/models/report.rb +93 -0
- data/lib/onfido/models/report_document.rb +222 -0
- data/lib/onfido/models/report_name.rb +60 -0
- data/lib/onfido/models/report_result.rb +42 -0
- data/lib/onfido/models/report_shared.rb +329 -0
- data/lib/onfido/models/report_status.rb +44 -0
- data/lib/onfido/models/report_sub_result.rb +43 -0
- data/lib/onfido/models/reports_list.rb +223 -0
- data/lib/onfido/models/results_feedback.rb +279 -0
- data/lib/onfido/models/sdk_token.rb +229 -0
- data/lib/onfido/models/sdk_token_builder.rb +259 -0
- data/lib/onfido/models/sdk_token_request.rb +252 -0
- data/lib/onfido/models/sdk_token_response.rb +222 -0
- data/lib/onfido/models/task.rb +329 -0
- data/lib/onfido/models/task_item.rb +287 -0
- data/lib/onfido/models/timeline_file_reference.rb +239 -0
- data/lib/onfido/models/us_driving_licence_breakdown.rb +232 -0
- data/lib/onfido/models/us_driving_licence_breakdown_address.rb +224 -0
- data/lib/onfido/models/us_driving_licence_breakdown_address_breakdown.rb +259 -0
- data/lib/onfido/models/us_driving_licence_breakdown_document.rb +224 -0
- data/lib/onfido/models/us_driving_licence_breakdown_document_breakdown.rb +241 -0
- data/lib/onfido/models/us_driving_licence_breakdown_personal.rb +224 -0
- data/lib/onfido/models/us_driving_licence_breakdown_personal_breakdown.rb +322 -0
- data/lib/onfido/models/us_driving_licence_builder.rb +505 -0
- data/lib/onfido/models/us_driving_licence_report.rb +354 -0
- data/lib/onfido/models/us_driving_licence_shared.rb +499 -0
- data/lib/onfido/models/video_reasons.rb +245 -0
- data/lib/onfido/models/watchlist_aml_breakdown.rb +241 -0
- data/lib/onfido/models/watchlist_aml_breakdown_adverse_media.rb +215 -0
- data/lib/onfido/models/watchlist_aml_breakdown_legal_and_regulatory_warnings.rb +215 -0
- data/lib/onfido/models/watchlist_aml_breakdown_politically_exposed_person.rb +215 -0
- data/lib/onfido/models/watchlist_aml_breakdown_sanction.rb +215 -0
- data/lib/onfido/models/watchlist_aml_properties.rb +217 -0
- data/lib/onfido/models/watchlist_aml_report.rb +354 -0
- data/lib/onfido/models/watchlist_enhanced_breakdown.rb +241 -0
- data/lib/onfido/models/watchlist_enhanced_properties.rb +217 -0
- data/lib/onfido/models/watchlist_enhanced_report.rb +354 -0
- data/lib/onfido/models/watchlist_monitor.rb +342 -0
- data/lib/onfido/models/watchlist_monitor_builder.rb +292 -0
- data/lib/onfido/models/watchlist_monitor_match.rb +225 -0
- data/lib/onfido/models/watchlist_monitor_matches_list.rb +223 -0
- data/lib/onfido/models/watchlist_monitor_matches_updater.rb +227 -0
- data/lib/onfido/models/watchlist_monitor_response.rb +254 -0
- data/lib/onfido/models/watchlist_monitor_shared.rb +285 -0
- data/lib/onfido/models/watchlist_monitors_list.rb +223 -0
- data/lib/onfido/models/watchlist_peps_only_report.rb +354 -0
- data/lib/onfido/models/watchlist_sanctions_only_report.rb +354 -0
- data/lib/onfido/models/watchlist_standard_breakdown.rb +232 -0
- data/lib/onfido/models/watchlist_standard_properties.rb +217 -0
- data/lib/onfido/models/watchlist_standard_report.rb +354 -0
- data/lib/onfido/models/webhook.rb +304 -0
- data/lib/onfido/models/webhook_builder.rb +274 -0
- data/lib/onfido/models/webhook_create.rb +222 -0
- data/lib/onfido/models/webhook_event.rb +214 -0
- data/lib/onfido/models/webhook_event_payload.rb +273 -0
- data/lib/onfido/models/webhook_event_payload_object.rb +260 -0
- data/lib/onfido/models/webhook_event_type.rb +56 -0
- data/lib/onfido/models/webhook_resend.rb +216 -0
- data/lib/onfido/models/webhook_response.rb +252 -0
- data/lib/onfido/models/webhook_shared.rb +249 -0
- data/lib/onfido/models/webhook_update.rb +215 -0
- data/lib/onfido/models/webhook_updater.rb +267 -0
- data/lib/onfido/models/webhooks_list.rb +223 -0
- data/lib/onfido/models/webhooks_resend_item.rb +261 -0
- data/lib/onfido/models/workflow_run.rb +416 -0
- data/lib/onfido/models/workflow_run_builder.rb +316 -0
- data/lib/onfido/models/workflow_run_request.rb +217 -0
- data/lib/onfido/models/workflow_run_response.rb +317 -0
- data/lib/onfido/models/workflow_run_response_error.rb +226 -0
- data/lib/onfido/models/workflow_run_shared.rb +296 -0
- data/lib/onfido/models/workflow_run_shared_link.rb +290 -0
- data/lib/onfido/version.rb +12 -2
- data/lib/onfido/webhook_event_verifier.rb +20 -0
- data/lib/onfido.rb +309 -25
- data/onfido.gemspec +42 -33
- data/spec/integrations/address_picker_spec.rb +16 -0
- data/spec/integrations/applicant_spec.rb +73 -95
- data/spec/integrations/check_spec.rb +60 -41
- data/spec/integrations/document_spec.rb +28 -57
- data/spec/integrations/extraction_spec.rb +27 -12
- data/spec/integrations/id_photo_spec.rb +55 -0
- data/spec/integrations/live_photo_spec.rb +28 -45
- data/spec/integrations/live_video_spec.rb +33 -19
- data/spec/integrations/media/sample_driving_licence.png +0 -0
- data/spec/integrations/media/sample_photo.png +0 -0
- data/spec/integrations/motion_capture_spec.rb +30 -24
- data/spec/integrations/report_schema_spec.rb +45 -0
- data/spec/integrations/report_spec.rb +34 -25
- data/spec/integrations/sdk_token_spec.rb +12 -10
- data/spec/integrations/tasks_spec.rb +45 -0
- data/spec/integrations/watchlist_monitor_spec.rb +73 -0
- data/spec/integrations/webhook_spec.rb +40 -88
- data/spec/integrations/workflow_run_output_spec.rb +117 -0
- data/spec/integrations/workflow_run_spec.rb +64 -34
- data/spec/shared_contexts/with_applicant.rb +24 -0
- data/spec/shared_contexts/with_check.rb +18 -0
- data/spec/shared_contexts/with_document.rb +13 -0
- data/spec/shared_contexts/with_live_photo.rb +18 -0
- data/spec/shared_contexts/with_onfido.rb +14 -0
- data/spec/shared_contexts/with_workflow_run.rb +19 -0
- data/spec/spec_helper.rb +73 -11
- data/spec/webhook_event_verifier_spec.rb +29 -0
- metadata +367 -157
- data/.github/workflows/gem-push.yml +0 -31
- data/.github/workflows/ruby.yml +0 -25
- data/.gitignore +0 -19
- data/.rspec +0 -2
- data/.rubocop.yml +0 -13
- data/lib/onfido/api.rb +0 -65
- data/lib/onfido/errors/connection_error.rb +0 -6
- data/lib/onfido/errors/onfido_error.rb +0 -30
- data/lib/onfido/errors/request_error.rb +0 -6
- data/lib/onfido/errors/server_error.rb +0 -6
- data/lib/onfido/options.rb +0 -38
- data/lib/onfido/resource.rb +0 -153
- data/lib/onfido/resources/address.rb +0 -9
- data/lib/onfido/resources/applicant.rb +0 -29
- data/lib/onfido/resources/check.rb +0 -28
- data/lib/onfido/resources/document.rb +0 -28
- data/lib/onfido/resources/extraction.rb +0 -11
- data/lib/onfido/resources/live_photo.rb +0 -27
- data/lib/onfido/resources/live_video.rb +0 -17
- data/lib/onfido/resources/monitor.rb +0 -32
- data/lib/onfido/resources/motion_capture.rb +0 -21
- data/lib/onfido/resources/report.rb +0 -21
- data/lib/onfido/resources/sdk_token.rb +0 -10
- data/lib/onfido/resources/webhook.rb +0 -40
- data/lib/onfido/resources/workflow_run.rb +0 -21
- data/spec/integrations/address_spec.rb +0 -13
- data/spec/integrations/monitor_spec.rb +0 -100
- data/spec/integrations/resource_spec.rb +0 -106
- data/spec/onfido/api_spec.rb +0 -22
- data/spec/onfido/connection_error_spec.rb +0 -20
- data/spec/onfido/options_spec.rb +0 -39
- data/spec/onfido/request_error_spec.rb +0 -36
- data/spec/support/fake_onfido_api.rb +0 -295
- data/spec/support/fixtures/4xx_response.json +0 -14
- data/spec/support/fixtures/addresses.json +0 -24
- data/spec/support/fixtures/applicant.json +0 -28
- data/spec/support/fixtures/applicants.json +0 -12
- data/spec/support/fixtures/check.json +0 -12
- data/spec/support/fixtures/checks.json +0 -16
- data/spec/support/fixtures/document.json +0 -10
- data/spec/support/fixtures/documents.json +0 -23
- data/spec/support/fixtures/extraction.json +0 -23
- data/spec/support/fixtures/live_photo.json +0 -9
- data/spec/support/fixtures/live_photos.json +0 -22
- data/spec/support/fixtures/live_video.json +0 -23
- data/spec/support/fixtures/live_videos.json +0 -27
- data/spec/support/fixtures/monitor.json +0 -8
- data/spec/support/fixtures/monitor_matches.json +0 -12
- data/spec/support/fixtures/monitors.json +0 -12
- data/spec/support/fixtures/motion_capture.json +0 -9
- data/spec/support/fixtures/motion_captures.json +0 -13
- data/spec/support/fixtures/not_scheduled_for_deletion_error.json +0 -7
- data/spec/support/fixtures/report.json +0 -10
- data/spec/support/fixtures/reports.json +0 -24
- data/spec/support/fixtures/sdk_token.json +0 -3
- data/spec/support/fixtures/signed_workflow_run.pdf +0 -0
- data/spec/support/fixtures/unexpected_error_format.json +0 -3
- data/spec/support/fixtures/webhook.json +0 -14
- data/spec/support/fixtures/webhooks.json +0 -31
- data/spec/support/fixtures/workflow_run.json +0 -20
- data/spec/support/fixtures/workflow_runs.json +0 -42
@@ -1,64 +1,83 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
include_context 'fake onfido api'
|
5
|
-
|
6
|
-
subject(:check) { onfido.check }
|
3
|
+
require_relative '../shared_contexts/with_check'
|
7
4
|
|
8
|
-
|
9
|
-
|
5
|
+
describe Onfido::Check do
|
6
|
+
describe 'Checks' do
|
7
|
+
include_context 'with check'
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
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
|
-
|
29
|
-
|
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
|
-
|
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
|
-
|
36
|
-
|
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
|
-
|
41
|
-
|
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 '
|
45
|
-
|
46
|
-
|
47
|
-
expect(
|
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
|
-
|
52
|
-
|
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
|
-
|
58
|
-
|
59
|
-
response = check.download(check_id)
|
77
|
+
it 'downloads a check' do
|
78
|
+
file = onfido_api.download_check(check_id)
|
60
79
|
|
61
|
-
expect(
|
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
|
-
|
3
|
+
require_relative '../shared_contexts/with_document'
|
4
4
|
|
5
5
|
describe Onfido::Document do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
25
|
-
|
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
|
-
|
33
|
-
|
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
|
-
|
40
|
-
|
23
|
+
it 'finds a document' do
|
24
|
+
get_document = onfido_api.find_document(document_id)
|
41
25
|
|
42
|
-
|
43
|
-
|
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
|
-
|
50
|
-
|
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(
|
33
|
+
expect(file.size).to be > 0
|
55
34
|
end
|
56
|
-
end
|
57
35
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
3
|
+
require_relative '../shared_contexts/with_document'
|
4
4
|
|
5
5
|
describe Onfido::Extraction do
|
6
|
-
|
6
|
+
describe 'Extraction' do
|
7
|
+
include_context 'with document'
|
7
8
|
|
8
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
18
|
-
|
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
|
-
|
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
|
-
|
3
|
+
require_relative '../shared_contexts/with_live_photo'
|
4
4
|
|
5
5
|
describe Onfido::LivePhoto do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
29
|
-
|
16
|
+
it 'lists live photos' do
|
17
|
+
live_photos = onfido_api.list_live_photos(applicant_id)
|
30
18
|
|
31
|
-
|
32
|
-
|
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
|
-
|
39
|
-
|
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(
|
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
|
-
|
48
|
-
|
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(
|
33
|
+
expect(file.length).to be > 0
|
53
34
|
end
|
54
|
-
end
|
55
35
|
|
56
|
-
|
57
|
-
|
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
|
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
|
-
|
3
|
+
require_relative '../shared_contexts/with_onfido'
|
4
4
|
|
5
5
|
describe Onfido::LiveVideo do
|
6
|
-
|
6
|
+
describe 'Live Video' do
|
7
|
+
include_context 'with onfido'
|
7
8
|
|
8
|
-
|
9
|
+
let(:applicant_id) { ENV['ONFIDO_SAMPLE_APPLICANT_ID'] }
|
10
|
+
let(:live_video_id) { ENV['ONFIDO_SAMPLE_VIDEO_ID_1'] }
|
9
11
|
|
10
|
-
|
12
|
+
it 'lists live videos' do
|
13
|
+
live_videos = onfido_api.list_live_videos(applicant_id)
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
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(
|
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
|
-
|
21
|
-
|
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(
|
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
|
-
|
30
|
-
|
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
|
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
|
Binary file
|
Binary file
|
@@ -1,44 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative '../shared_contexts/with_onfido'
|
4
4
|
|
5
5
|
describe Onfido::MotionCapture do
|
6
|
-
|
6
|
+
describe 'Motion Capture' do
|
7
|
+
include_context 'with onfido'
|
7
8
|
|
8
|
-
|
9
|
+
let(:applicant_id) { ENV['ONFIDO_SAMPLE_APPLICANT_ID'] }
|
10
|
+
let(:motion_id) { ENV['ONFIDO_SAMPLE_MOTION_ID_1'] }
|
9
11
|
|
10
|
-
|
12
|
+
it 'lists motion captures' do
|
13
|
+
motion_captures = onfido_api.list_motion_captures(applicant_id)
|
11
14
|
|
12
|
-
|
13
|
-
|
14
|
-
|
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(
|
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
|
-
|
21
|
-
|
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(
|
30
|
+
expect(file.length).to be > 0
|
26
31
|
end
|
27
|
-
end
|
28
32
|
|
29
|
-
|
30
|
-
|
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(
|
36
|
+
expect(file.length).to be > 0
|
34
37
|
end
|
35
|
-
end
|
36
38
|
|
37
|
-
|
38
|
-
|
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
|
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
|