onfido 2.8.0 → 3.0.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 +15 -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 +461 -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 +529 -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 +67 -29
- 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 -155
- 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 -17
- 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 -283
- 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/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
data/.github/workflows/ruby.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ master ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
test:
|
11
|
-
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
strategy:
|
14
|
-
matrix:
|
15
|
-
ruby-version: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1']
|
16
|
-
|
17
|
-
steps:
|
18
|
-
- uses: actions/checkout@v2
|
19
|
-
- name: Set up Ruby
|
20
|
-
uses: ruby/setup-ruby@v1
|
21
|
-
with:
|
22
|
-
ruby-version: ${{ matrix.ruby-version }}
|
23
|
-
bundler-cache: true
|
24
|
-
- name: Run tests
|
25
|
-
run: bundle exec rspec spec
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/lib/onfido/api.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class API
|
5
|
-
def initialize(api_key:, region:, **extra_options)
|
6
|
-
@options = Onfido::Options.new(api_key: api_key, region: region, **extra_options)
|
7
|
-
end
|
8
|
-
|
9
|
-
def applicant
|
10
|
-
@applicant ||= Onfido::Applicant.new(options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def check
|
14
|
-
@check ||= Onfido::Check.new(options)
|
15
|
-
end
|
16
|
-
|
17
|
-
def document
|
18
|
-
@document ||= Onfido::Document.new(options)
|
19
|
-
end
|
20
|
-
|
21
|
-
def live_photo
|
22
|
-
@live_photo ||= Onfido::LivePhoto.new(options)
|
23
|
-
end
|
24
|
-
|
25
|
-
def live_video
|
26
|
-
@live_video ||= Onfido::LiveVideo.new(options)
|
27
|
-
end
|
28
|
-
|
29
|
-
def monitor
|
30
|
-
@monitor ||= Onfido::Monitor.new(options)
|
31
|
-
end
|
32
|
-
|
33
|
-
def motion_capture
|
34
|
-
@motion_capture ||= Onfido::MotionCapture.new(options)
|
35
|
-
end
|
36
|
-
|
37
|
-
def report
|
38
|
-
@report ||= Onfido::Report.new(options)
|
39
|
-
end
|
40
|
-
|
41
|
-
def sdk_token
|
42
|
-
@sdk_token ||= Onfido::SdkToken.new(options)
|
43
|
-
end
|
44
|
-
|
45
|
-
def webhook
|
46
|
-
@webhook ||= Onfido::Webhook.new(options)
|
47
|
-
end
|
48
|
-
|
49
|
-
def address
|
50
|
-
@address ||= Onfido::Address.new(options)
|
51
|
-
end
|
52
|
-
|
53
|
-
def extraction
|
54
|
-
@extraction ||= Onfido::Extraction.new(options)
|
55
|
-
end
|
56
|
-
|
57
|
-
def workflow_run
|
58
|
-
@workflow_run ||= Onfido::WorkflowRun.new(options)
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
attr_reader :options
|
64
|
-
end
|
65
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class OnfidoError < StandardError
|
5
|
-
attr_accessor :response_code, :response_body
|
6
|
-
|
7
|
-
def initialize(message = nil,
|
8
|
-
response_code: nil,
|
9
|
-
response_body: nil)
|
10
|
-
@response_code = response_code
|
11
|
-
@response_body = response_body
|
12
|
-
|
13
|
-
super(message)
|
14
|
-
end
|
15
|
-
|
16
|
-
def json_body
|
17
|
-
JSON.parse(response_body.to_s)
|
18
|
-
rescue JSON::ParserError
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def type
|
23
|
-
json_body && json_body['error'] && json_body['error']['type']
|
24
|
-
end
|
25
|
-
|
26
|
-
def fields
|
27
|
-
json_body && json_body['error'] && json_body['error']['fields']
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/lib/onfido/options.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class Options
|
5
|
-
REGIONS = %w[eu us ca].freeze
|
6
|
-
|
7
|
-
def initialize(api_key:, region:, open_timeout: 10, read_timeout: 30, unknown_api_url: nil)
|
8
|
-
@api_key = api_key
|
9
|
-
@region = region.to_s.downcase
|
10
|
-
@open_timeout = open_timeout
|
11
|
-
@read_timeout = read_timeout
|
12
|
-
@unknown_api_url = unknown_api_url
|
13
|
-
|
14
|
-
raise "Unknown region #{@region}" unless REGIONS.include?(@region)
|
15
|
-
end
|
16
|
-
|
17
|
-
def rest_client
|
18
|
-
@rest_client ||= RestClient::Resource.new(
|
19
|
-
base_url,
|
20
|
-
read_timeout: read_timeout,
|
21
|
-
open_timeout: open_timeout,
|
22
|
-
headers: {
|
23
|
-
'Authorization' => "Token token=#{api_key}",
|
24
|
-
'Accept' => 'application/json',
|
25
|
-
'User-Agent' => "onfido-ruby/#{Onfido::VERSION}"
|
26
|
-
}
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
attr_reader :api_key, :open_timeout, :read_timeout
|
33
|
-
|
34
|
-
def base_url
|
35
|
-
@unknown_api_url || "https://api.#{@region}.onfido.com/v3.6/"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/onfido/resource.rb
DELETED
@@ -1,153 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class Resource # rubocop:todo Metrics/ClassLength
|
5
|
-
VALID_HTTP_METHODS = %i[get post put delete].freeze
|
6
|
-
REQUEST_TIMEOUT_HTTP_CODE = 408
|
7
|
-
ADDITIONAL_HEADERS = { 'Content-Type' => 'application/json; charset=utf-8' }.freeze
|
8
|
-
|
9
|
-
def initialize(options)
|
10
|
-
@rest_client = options.rest_client
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
attr_reader :rest_client
|
16
|
-
|
17
|
-
def get(path:)
|
18
|
-
handle_request { rest_client[path].get(ADDITIONAL_HEADERS) }
|
19
|
-
end
|
20
|
-
|
21
|
-
def post(path:, payload: nil, send_json: true)
|
22
|
-
parsed_payload = send_json ? payload.to_json : payload
|
23
|
-
additional_headers = send_json ? ADDITIONAL_HEADERS : {}
|
24
|
-
|
25
|
-
handle_request { rest_client[path].post(parsed_payload, additional_headers) }
|
26
|
-
end
|
27
|
-
|
28
|
-
def put(path:, payload: nil)
|
29
|
-
handle_request { rest_client[path].put(payload.to_json, ADDITIONAL_HEADERS) }
|
30
|
-
end
|
31
|
-
|
32
|
-
def patch(path:, payload: nil)
|
33
|
-
handle_request { rest_client[path].patch(payload.to_json, ADDITIONAL_HEADERS) }
|
34
|
-
end
|
35
|
-
|
36
|
-
def delete(path:)
|
37
|
-
handle_request { rest_client[path].delete(ADDITIONAL_HEADERS) }
|
38
|
-
end
|
39
|
-
|
40
|
-
def handle_request
|
41
|
-
response = yield
|
42
|
-
|
43
|
-
# response should be parsed only when there is a response expected
|
44
|
-
parse(response) unless response.code == 204 # no_content
|
45
|
-
rescue RestClient::ExceptionWithResponse => e
|
46
|
-
if e.response && !timeout_response?(e.response)
|
47
|
-
handle_api_error(e.response)
|
48
|
-
else
|
49
|
-
handle_restclient_error(e)
|
50
|
-
end
|
51
|
-
rescue RestClient::Exception, Errno::ECONNREFUSED => e
|
52
|
-
handle_restclient_error(e)
|
53
|
-
end
|
54
|
-
|
55
|
-
def parse(response)
|
56
|
-
content_type = response.headers[:content_type]
|
57
|
-
if content_type&.include?('application/json')
|
58
|
-
JSON.parse(response.body.to_s)
|
59
|
-
else
|
60
|
-
response.body
|
61
|
-
end
|
62
|
-
rescue JSON::ParserError
|
63
|
-
general_api_error(response.code, response.body)
|
64
|
-
end
|
65
|
-
|
66
|
-
def timeout_response?(response)
|
67
|
-
response.code.to_i == REQUEST_TIMEOUT_HTTP_CODE
|
68
|
-
end
|
69
|
-
|
70
|
-
# There seems to be a serialization issue with the HTTP client
|
71
|
-
# which does not serialize the payload properly.
|
72
|
-
# Have a look here https://gist.github.com/PericlesTheo/cb35139c57107ab3c84a
|
73
|
-
|
74
|
-
def build_query(payload)
|
75
|
-
if payload[:file]
|
76
|
-
payload
|
77
|
-
else
|
78
|
-
Rack::Utils.build_nested_query(payload)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def handle_api_error(response)
|
83
|
-
parsed_response = parse(response)
|
84
|
-
|
85
|
-
general_api_error(response.code, response.body) unless parsed_response['error']
|
86
|
-
|
87
|
-
error_class = response.code.to_i >= 500 ? ServerError : RequestError
|
88
|
-
|
89
|
-
raise error_class.new(
|
90
|
-
parsed_response['error']['message'],
|
91
|
-
response_code: response.code,
|
92
|
-
response_body: response.body
|
93
|
-
)
|
94
|
-
end
|
95
|
-
|
96
|
-
def general_api_error(response_code, response_body)
|
97
|
-
error_class = response_code.to_i >= 500 ? ServerError : RequestError
|
98
|
-
|
99
|
-
raise error_class.new(
|
100
|
-
"Invalid response object from API: #{response_body} " \
|
101
|
-
"(HTTP response code was #{response_code})",
|
102
|
-
response_code: response_code,
|
103
|
-
response_body: response_body
|
104
|
-
)
|
105
|
-
end
|
106
|
-
|
107
|
-
def handle_restclient_error(error) # rubocop:todo Metrics/MethodLength
|
108
|
-
connection_message =
|
109
|
-
'Please check your internet connection and try again. ' \
|
110
|
-
'If this problem persists, you should let us know at info@onfido.com.'
|
111
|
-
|
112
|
-
message =
|
113
|
-
case error
|
114
|
-
when RestClient::RequestTimeout
|
115
|
-
"Could not connect to Onfido . #{connection_message}"
|
116
|
-
|
117
|
-
when RestClient::ServerBrokeConnection
|
118
|
-
"The connection to the server broke before the request completed. #{connection_message}"
|
119
|
-
|
120
|
-
when RestClient::SSLCertificateNotVerified
|
121
|
-
"Could not verify Onfido's SSL certificate. Please make sure " \
|
122
|
-
'that your network is not intercepting certificates. '
|
123
|
-
|
124
|
-
when RestClient::BadGateway
|
125
|
-
"Could not connect to Onfido. Server may be overloaded." \
|
126
|
-
|
127
|
-
when SocketError
|
128
|
-
'Unexpected error when trying to connect to Onfido. ' \
|
129
|
-
'You may be seeing this message because your DNS is not working. ' \
|
130
|
-
"To check, try running 'host onfido.com' from the command line."
|
131
|
-
|
132
|
-
else
|
133
|
-
'Unexpected error communicating with Onfido. ' \
|
134
|
-
'If this problem persists, let us know at info@onfido.com.'
|
135
|
-
end
|
136
|
-
|
137
|
-
full_message = message + "\n\n(Network error: #{error.message})"
|
138
|
-
|
139
|
-
raise ConnectionError, full_message
|
140
|
-
end
|
141
|
-
|
142
|
-
def validate_file!(file)
|
143
|
-
return if file.respond_to?(:read) && file.respond_to?(:path)
|
144
|
-
|
145
|
-
raise ArgumentError, 'File must be a `File`-like object which responds to ' \
|
146
|
-
'`#read` and `#path`'
|
147
|
-
end
|
148
|
-
|
149
|
-
def stringify_query_params(hashed_params)
|
150
|
-
URI.encode_www_form_component(hashed_params.map{ |k,v| "#{k}=#{v}" }.join("&"))
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class Applicant < Resource
|
5
|
-
def create(payload)
|
6
|
-
post(path: 'applicants', payload: payload)
|
7
|
-
end
|
8
|
-
|
9
|
-
def update(applicant_id, payload)
|
10
|
-
put(path: "applicants/#{applicant_id}", payload: payload)
|
11
|
-
end
|
12
|
-
|
13
|
-
def destroy(applicant_id)
|
14
|
-
delete(path: "applicants/#{applicant_id}")
|
15
|
-
end
|
16
|
-
|
17
|
-
def find(applicant_id)
|
18
|
-
get(path: "applicants/#{applicant_id}")
|
19
|
-
end
|
20
|
-
|
21
|
-
def all(page: 1, per_page: 20)
|
22
|
-
get(path: "applicants?page=#{page}&per_page=#{per_page}")
|
23
|
-
end
|
24
|
-
|
25
|
-
def restore(applicant_id)
|
26
|
-
post(path: "applicants/#{applicant_id}/restore")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class Check < Resource
|
5
|
-
def create(applicant_id:, report_names:, **payload)
|
6
|
-
payload[:applicant_id] = applicant_id
|
7
|
-
payload[:report_names] = report_names
|
8
|
-
|
9
|
-
post(path: 'checks', payload: payload)
|
10
|
-
end
|
11
|
-
|
12
|
-
def find(check_id)
|
13
|
-
get(path: "checks/#{check_id}")
|
14
|
-
end
|
15
|
-
|
16
|
-
def all(applicant_id)
|
17
|
-
get(path: "checks?applicant_id=#{applicant_id}")
|
18
|
-
end
|
19
|
-
|
20
|
-
def resume(check_id)
|
21
|
-
post(path: "checks/#{check_id}/resume")
|
22
|
-
end
|
23
|
-
|
24
|
-
def download(check_id)
|
25
|
-
get(path: "checks/#{check_id}/download")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class Document < Resource
|
5
|
-
# with open-uri the file can be a link or an actual file
|
6
|
-
|
7
|
-
def create(applicant_id:, file:, type:, **payload)
|
8
|
-
validate_file!(file)
|
9
|
-
payload[:applicant_id] = applicant_id
|
10
|
-
payload[:file] = file
|
11
|
-
payload[:type] = type
|
12
|
-
|
13
|
-
post(path: 'documents', payload: payload, send_json: false)
|
14
|
-
end
|
15
|
-
|
16
|
-
def find(document_id)
|
17
|
-
get(path: "documents/#{document_id}")
|
18
|
-
end
|
19
|
-
|
20
|
-
def download(document_id)
|
21
|
-
get(path: "documents/#{document_id}/download")
|
22
|
-
end
|
23
|
-
|
24
|
-
def all(applicant_id)
|
25
|
-
get(path: "documents?applicant_id=#{applicant_id}")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class LivePhoto < Resource
|
5
|
-
# with open-uri the file can be a link or an actual file
|
6
|
-
|
7
|
-
def create(applicant_id:, file:, **payload)
|
8
|
-
validate_file!(file)
|
9
|
-
payload[:applicant_id] = applicant_id
|
10
|
-
payload[:file] = file
|
11
|
-
|
12
|
-
post(path: 'live_photos', payload: payload, send_json: false)
|
13
|
-
end
|
14
|
-
|
15
|
-
def find(live_photo_id)
|
16
|
-
get(path: "live_photos/#{live_photo_id}")
|
17
|
-
end
|
18
|
-
|
19
|
-
def download(live_photo_id)
|
20
|
-
get(path: "live_photos/#{live_photo_id}/download")
|
21
|
-
end
|
22
|
-
|
23
|
-
def all(applicant_id)
|
24
|
-
get(path: "live_photos?applicant_id=#{applicant_id}")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class LiveVideo < Resource
|
5
|
-
def find(live_video_id)
|
6
|
-
get(path: "live_videos/#{live_video_id}")
|
7
|
-
end
|
8
|
-
|
9
|
-
def download(live_video_id)
|
10
|
-
get(path: "live_videos/#{live_video_id}/download")
|
11
|
-
end
|
12
|
-
|
13
|
-
def all(applicant_id)
|
14
|
-
get(path: "live_videos?applicant_id=#{applicant_id}")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class Monitor < Resource
|
5
|
-
def create(applicant_id:, report_name:, **payload)
|
6
|
-
payload[:applicant_id] = applicant_id
|
7
|
-
payload[:report_name] = report_name
|
8
|
-
|
9
|
-
post(path: 'watchlist_monitors', payload: payload)
|
10
|
-
end
|
11
|
-
|
12
|
-
def find(monitor_id)
|
13
|
-
get(path: "watchlist_monitors/#{monitor_id}")
|
14
|
-
end
|
15
|
-
|
16
|
-
def all(applicant_id)
|
17
|
-
get(path: "watchlist_monitors?applicant_id=#{applicant_id}")
|
18
|
-
end
|
19
|
-
|
20
|
-
def destroy(monitor_id)
|
21
|
-
delete(path: "watchlist_monitors/#{monitor_id}")
|
22
|
-
end
|
23
|
-
|
24
|
-
def list_matches(monitor_id)
|
25
|
-
get(path: "watchlist_monitors/#{monitor_id}/matches")
|
26
|
-
end
|
27
|
-
|
28
|
-
def set_match_status(monitor_id, **payload)
|
29
|
-
patch(path: "watchlist_monitors/#{monitor_id}/matches", payload: payload)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class MotionCapture < Resource
|
5
|
-
def find(motion_capture_id)
|
6
|
-
get(path: "motion_captures/#{motion_capture_id}")
|
7
|
-
end
|
8
|
-
|
9
|
-
def download(motion_capture_id)
|
10
|
-
get(path: "motion_captures/#{motion_capture_id}/download")
|
11
|
-
end
|
12
|
-
|
13
|
-
def frame(motion_capture_id)
|
14
|
-
get(path: "motion_captures/#{motion_capture_id}/frame")
|
15
|
-
end
|
16
|
-
|
17
|
-
def all(applicant_id)
|
18
|
-
get(path: "motion_captures?applicant_id=#{applicant_id}")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class Report < Resource
|
5
|
-
def find(report_id)
|
6
|
-
get(path: "reports/#{report_id}")
|
7
|
-
end
|
8
|
-
|
9
|
-
def all(check_id)
|
10
|
-
get(path: "reports?check_id=#{check_id}")
|
11
|
-
end
|
12
|
-
|
13
|
-
def resume(report_id)
|
14
|
-
post(path: "reports/#{report_id}/resume")
|
15
|
-
end
|
16
|
-
|
17
|
-
def cancel(report_id)
|
18
|
-
post(path: "reports/#{report_id}/cancel")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class Webhook < Resource
|
5
|
-
def create(url:, **payload)
|
6
|
-
payload[:url] = url
|
7
|
-
post(path: 'webhooks', payload: payload)
|
8
|
-
end
|
9
|
-
|
10
|
-
def find(webhooks_id)
|
11
|
-
get(path: "webhooks/#{webhooks_id}")
|
12
|
-
end
|
13
|
-
|
14
|
-
def all
|
15
|
-
get(path: 'webhooks')
|
16
|
-
end
|
17
|
-
|
18
|
-
def destroy(webhook_id)
|
19
|
-
delete(path: "webhooks/#{webhook_id}")
|
20
|
-
end
|
21
|
-
|
22
|
-
# As well as being a normal resource, Onfido::Webhook also supports
|
23
|
-
# verifying the authenticity of a webhook by comparing the signature on the
|
24
|
-
# request to one computed from the body
|
25
|
-
def self.valid?(request_body, request_signature, token)
|
26
|
-
if [request_body, request_signature, token].any?(&:nil?)
|
27
|
-
raise ArgumentError, 'A request body, request signature and token ' \
|
28
|
-
'must be provided'
|
29
|
-
end
|
30
|
-
|
31
|
-
computed_signature = generate_signature(request_body, token)
|
32
|
-
Rack::Utils.secure_compare(request_signature, computed_signature)
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.generate_signature(request_body, token)
|
36
|
-
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, request_body)
|
37
|
-
end
|
38
|
-
private_class_method :generate_signature
|
39
|
-
end
|
40
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Onfido
|
4
|
-
class WorkflowRun < Resource
|
5
|
-
def create(payload)
|
6
|
-
post(path: 'workflow_runs', payload: payload)
|
7
|
-
end
|
8
|
-
|
9
|
-
def find(workflow_run_id)
|
10
|
-
get(path: "workflow_runs/#{workflow_run_id}")
|
11
|
-
end
|
12
|
-
|
13
|
-
def all(query_params = {})
|
14
|
-
get(path: "workflow_runs?#{stringify_query_params(query_params)}")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|