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
@@ -0,0 +1,415 @@
|
|
1
|
+
=begin
|
2
|
+
#Onfido API v3.6
|
3
|
+
|
4
|
+
#The Onfido API (v3.6)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3.6
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Onfido
|
17
|
+
class AddressShared
|
18
|
+
# The flat number of this address
|
19
|
+
attr_accessor :flat_number
|
20
|
+
|
21
|
+
# The building number of this address
|
22
|
+
attr_accessor :building_number
|
23
|
+
|
24
|
+
# The building name of this address
|
25
|
+
attr_accessor :building_name
|
26
|
+
|
27
|
+
# The street of the applicant's address
|
28
|
+
attr_accessor :street
|
29
|
+
|
30
|
+
# The sub-street of the applicant's address
|
31
|
+
attr_accessor :sub_street
|
32
|
+
|
33
|
+
# The town of the applicant's address
|
34
|
+
attr_accessor :town
|
35
|
+
|
36
|
+
# The postcode or ZIP of the applicant's address
|
37
|
+
attr_accessor :postcode
|
38
|
+
|
39
|
+
# The 3 character ISO country code of this address. For example, GBR is the country code for the United Kingdom
|
40
|
+
attr_accessor :country
|
41
|
+
|
42
|
+
# The address state. US states must use the USPS abbreviation (see also ISO 3166-2:US), for example AK, CA, or TX.
|
43
|
+
attr_accessor :state
|
44
|
+
|
45
|
+
# Line 1 of the applicant's address
|
46
|
+
attr_accessor :line1
|
47
|
+
|
48
|
+
# Line 2 of the applicant's address
|
49
|
+
attr_accessor :line2
|
50
|
+
|
51
|
+
# Line 3 of the applicant's address
|
52
|
+
attr_accessor :line3
|
53
|
+
|
54
|
+
class EnumAttributeValidator
|
55
|
+
attr_reader :datatype
|
56
|
+
attr_reader :allowable_values
|
57
|
+
|
58
|
+
def initialize(datatype, allowable_values)
|
59
|
+
@allowable_values = allowable_values.map do |value|
|
60
|
+
case datatype.to_s
|
61
|
+
when /Integer/i
|
62
|
+
value.to_i
|
63
|
+
when /Float/i
|
64
|
+
value.to_f
|
65
|
+
else
|
66
|
+
value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def valid?(value)
|
72
|
+
!value || allowable_values.include?(value)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
77
|
+
def self.attribute_map
|
78
|
+
{
|
79
|
+
:'flat_number' => :'flat_number',
|
80
|
+
:'building_number' => :'building_number',
|
81
|
+
:'building_name' => :'building_name',
|
82
|
+
:'street' => :'street',
|
83
|
+
:'sub_street' => :'sub_street',
|
84
|
+
:'town' => :'town',
|
85
|
+
:'postcode' => :'postcode',
|
86
|
+
:'country' => :'country',
|
87
|
+
:'state' => :'state',
|
88
|
+
:'line1' => :'line1',
|
89
|
+
:'line2' => :'line2',
|
90
|
+
:'line3' => :'line3'
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
# Returns all the JSON keys this model knows about
|
95
|
+
def self.acceptable_attributes
|
96
|
+
attribute_map.values
|
97
|
+
end
|
98
|
+
|
99
|
+
# Attribute type mapping.
|
100
|
+
def self.openapi_types
|
101
|
+
{
|
102
|
+
:'flat_number' => :'String',
|
103
|
+
:'building_number' => :'String',
|
104
|
+
:'building_name' => :'String',
|
105
|
+
:'street' => :'String',
|
106
|
+
:'sub_street' => :'String',
|
107
|
+
:'town' => :'String',
|
108
|
+
:'postcode' => :'String',
|
109
|
+
:'country' => :'CountryCodes',
|
110
|
+
:'state' => :'String',
|
111
|
+
:'line1' => :'String',
|
112
|
+
:'line2' => :'String',
|
113
|
+
:'line3' => :'String'
|
114
|
+
}
|
115
|
+
end
|
116
|
+
|
117
|
+
# List of attributes with nullable: true
|
118
|
+
def self.openapi_nullable
|
119
|
+
Set.new([
|
120
|
+
:'line1',
|
121
|
+
:'line2',
|
122
|
+
:'line3'
|
123
|
+
])
|
124
|
+
end
|
125
|
+
|
126
|
+
# Initializes the object
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
+
def initialize(attributes = {})
|
129
|
+
if (!attributes.is_a?(Hash))
|
130
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::AddressShared` initialize method"
|
131
|
+
end
|
132
|
+
|
133
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
134
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
135
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
136
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::AddressShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
137
|
+
end
|
138
|
+
h[k.to_sym] = v
|
139
|
+
}
|
140
|
+
|
141
|
+
if attributes.key?(:'flat_number')
|
142
|
+
self.flat_number = attributes[:'flat_number']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'building_number')
|
146
|
+
self.building_number = attributes[:'building_number']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.key?(:'building_name')
|
150
|
+
self.building_name = attributes[:'building_name']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'street')
|
154
|
+
self.street = attributes[:'street']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'sub_street')
|
158
|
+
self.sub_street = attributes[:'sub_street']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.key?(:'town')
|
162
|
+
self.town = attributes[:'town']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.key?(:'postcode')
|
166
|
+
self.postcode = attributes[:'postcode']
|
167
|
+
else
|
168
|
+
self.postcode = nil
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'country')
|
172
|
+
self.country = attributes[:'country']
|
173
|
+
else
|
174
|
+
self.country = nil
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.key?(:'state')
|
178
|
+
self.state = attributes[:'state']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.key?(:'line1')
|
182
|
+
self.line1 = attributes[:'line1']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.key?(:'line2')
|
186
|
+
self.line2 = attributes[:'line2']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.key?(:'line3')
|
190
|
+
self.line3 = attributes[:'line3']
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
195
|
+
# @return Array for valid properties with the reasons
|
196
|
+
def list_invalid_properties
|
197
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
198
|
+
invalid_properties = Array.new
|
199
|
+
if @postcode.nil?
|
200
|
+
invalid_properties.push('invalid value for "postcode", postcode cannot be nil.')
|
201
|
+
end
|
202
|
+
|
203
|
+
if @country.nil?
|
204
|
+
invalid_properties.push('invalid value for "country", country cannot be nil.')
|
205
|
+
end
|
206
|
+
|
207
|
+
pattern = Regexp.new(/^[^!$%^*=<>]*$/)
|
208
|
+
if !@line1.nil? && @line1 !~ pattern
|
209
|
+
invalid_properties.push("invalid value for \"line1\", must conform to the pattern #{pattern}.")
|
210
|
+
end
|
211
|
+
|
212
|
+
pattern = Regexp.new(/^[^!$%^*=<>]*$/)
|
213
|
+
if !@line2.nil? && @line2 !~ pattern
|
214
|
+
invalid_properties.push("invalid value for \"line2\", must conform to the pattern #{pattern}.")
|
215
|
+
end
|
216
|
+
|
217
|
+
pattern = Regexp.new(/^[^!$%^*=<>]*$/)
|
218
|
+
if !@line3.nil? && @line3 !~ pattern
|
219
|
+
invalid_properties.push("invalid value for \"line3\", must conform to the pattern #{pattern}.")
|
220
|
+
end
|
221
|
+
|
222
|
+
invalid_properties
|
223
|
+
end
|
224
|
+
|
225
|
+
# Check to see if the all the properties in the model are valid
|
226
|
+
# @return true if the model is valid
|
227
|
+
def valid?
|
228
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
229
|
+
return false if @postcode.nil?
|
230
|
+
return false if @country.nil?
|
231
|
+
return false if !@line1.nil? && @line1 !~ Regexp.new(/^[^!$%^*=<>]*$/)
|
232
|
+
return false if !@line2.nil? && @line2 !~ Regexp.new(/^[^!$%^*=<>]*$/)
|
233
|
+
return false if !@line3.nil? && @line3 !~ Regexp.new(/^[^!$%^*=<>]*$/)
|
234
|
+
true
|
235
|
+
end
|
236
|
+
|
237
|
+
# Custom attribute writer method with validation
|
238
|
+
# @param [Object] line1 Value to be assigned
|
239
|
+
def line1=(line1)
|
240
|
+
pattern = Regexp.new(/^[^!$%^*=<>]*$/)
|
241
|
+
if !line1.nil? && line1 !~ pattern
|
242
|
+
fail ArgumentError, "invalid value for \"line1\", must conform to the pattern #{pattern}."
|
243
|
+
end
|
244
|
+
|
245
|
+
@line1 = line1
|
246
|
+
end
|
247
|
+
|
248
|
+
# Custom attribute writer method with validation
|
249
|
+
# @param [Object] line2 Value to be assigned
|
250
|
+
def line2=(line2)
|
251
|
+
pattern = Regexp.new(/^[^!$%^*=<>]*$/)
|
252
|
+
if !line2.nil? && line2 !~ pattern
|
253
|
+
fail ArgumentError, "invalid value for \"line2\", must conform to the pattern #{pattern}."
|
254
|
+
end
|
255
|
+
|
256
|
+
@line2 = line2
|
257
|
+
end
|
258
|
+
|
259
|
+
# Custom attribute writer method with validation
|
260
|
+
# @param [Object] line3 Value to be assigned
|
261
|
+
def line3=(line3)
|
262
|
+
pattern = Regexp.new(/^[^!$%^*=<>]*$/)
|
263
|
+
if !line3.nil? && line3 !~ pattern
|
264
|
+
fail ArgumentError, "invalid value for \"line3\", must conform to the pattern #{pattern}."
|
265
|
+
end
|
266
|
+
|
267
|
+
@line3 = line3
|
268
|
+
end
|
269
|
+
|
270
|
+
# Checks equality by comparing each attribute.
|
271
|
+
# @param [Object] Object to be compared
|
272
|
+
def ==(o)
|
273
|
+
return true if self.equal?(o)
|
274
|
+
self.class == o.class &&
|
275
|
+
flat_number == o.flat_number &&
|
276
|
+
building_number == o.building_number &&
|
277
|
+
building_name == o.building_name &&
|
278
|
+
street == o.street &&
|
279
|
+
sub_street == o.sub_street &&
|
280
|
+
town == o.town &&
|
281
|
+
postcode == o.postcode &&
|
282
|
+
country == o.country &&
|
283
|
+
state == o.state &&
|
284
|
+
line1 == o.line1 &&
|
285
|
+
line2 == o.line2 &&
|
286
|
+
line3 == o.line3
|
287
|
+
end
|
288
|
+
|
289
|
+
# @see the `==` method
|
290
|
+
# @param [Object] Object to be compared
|
291
|
+
def eql?(o)
|
292
|
+
self == o
|
293
|
+
end
|
294
|
+
|
295
|
+
# Calculates hash code according to all attributes.
|
296
|
+
# @return [Integer] Hash code
|
297
|
+
def hash
|
298
|
+
[flat_number, building_number, building_name, street, sub_street, town, postcode, country, state, line1, line2, line3].hash
|
299
|
+
end
|
300
|
+
|
301
|
+
# Builds the object from hash
|
302
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
303
|
+
# @return [Object] Returns the model itself
|
304
|
+
def self.build_from_hash(attributes)
|
305
|
+
return nil unless attributes.is_a?(Hash)
|
306
|
+
attributes = attributes.transform_keys(&:to_sym)
|
307
|
+
transformed_hash = {}
|
308
|
+
openapi_types.each_pair do |key, type|
|
309
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
310
|
+
transformed_hash["#{key}"] = nil
|
311
|
+
elsif type =~ /\AArray<(.*)>/i
|
312
|
+
# check to ensure the input is an array given that the attribute
|
313
|
+
# is documented as an array but the input is not
|
314
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
315
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
316
|
+
end
|
317
|
+
elsif !attributes[attribute_map[key]].nil?
|
318
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
319
|
+
end
|
320
|
+
end
|
321
|
+
new(transformed_hash)
|
322
|
+
end
|
323
|
+
|
324
|
+
# Deserializes the data based on type
|
325
|
+
# @param string type Data type
|
326
|
+
# @param string value Value to be deserialized
|
327
|
+
# @return [Object] Deserialized data
|
328
|
+
def self._deserialize(type, value)
|
329
|
+
case type.to_sym
|
330
|
+
when :Time
|
331
|
+
Time.parse(value)
|
332
|
+
when :Date
|
333
|
+
Date.parse(value)
|
334
|
+
when :String
|
335
|
+
value.to_s
|
336
|
+
when :Integer
|
337
|
+
value.to_i
|
338
|
+
when :Float
|
339
|
+
value.to_f
|
340
|
+
when :Boolean
|
341
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
342
|
+
true
|
343
|
+
else
|
344
|
+
false
|
345
|
+
end
|
346
|
+
when :Object
|
347
|
+
# generic object (usually a Hash), return directly
|
348
|
+
value
|
349
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
350
|
+
inner_type = Regexp.last_match[:inner_type]
|
351
|
+
value.map { |v| _deserialize(inner_type, v) }
|
352
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
353
|
+
k_type = Regexp.last_match[:k_type]
|
354
|
+
v_type = Regexp.last_match[:v_type]
|
355
|
+
{}.tap do |hash|
|
356
|
+
value.each do |k, v|
|
357
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
358
|
+
end
|
359
|
+
end
|
360
|
+
else # model
|
361
|
+
# models (e.g. Pet) or oneOf
|
362
|
+
klass = Onfido.const_get(type)
|
363
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# Returns the string representation of the object
|
368
|
+
# @return [String] String presentation of the object
|
369
|
+
def to_s
|
370
|
+
to_hash.to_s
|
371
|
+
end
|
372
|
+
|
373
|
+
# to_body is an alias to to_hash (backward compatibility)
|
374
|
+
# @return [Hash] Returns the object in the form of hash
|
375
|
+
def to_body
|
376
|
+
to_hash
|
377
|
+
end
|
378
|
+
|
379
|
+
# Returns the object in the form of hash
|
380
|
+
# @return [Hash] Returns the object in the form of hash
|
381
|
+
def to_hash
|
382
|
+
hash = {}
|
383
|
+
self.class.attribute_map.each_pair do |attr, param|
|
384
|
+
value = self.send(attr)
|
385
|
+
if value.nil?
|
386
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
387
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
388
|
+
end
|
389
|
+
|
390
|
+
hash[param] = _to_hash(value)
|
391
|
+
end
|
392
|
+
hash
|
393
|
+
end
|
394
|
+
|
395
|
+
# Outputs non-array value in the form of hash
|
396
|
+
# For object, use to_hash. Otherwise, just return the value
|
397
|
+
# @param [Object] value Any valid value
|
398
|
+
# @return [Hash] Returns the value in the form of hash
|
399
|
+
def _to_hash(value)
|
400
|
+
if value.is_a?(Array)
|
401
|
+
value.compact.map { |v| _to_hash(v) }
|
402
|
+
elsif value.is_a?(Hash)
|
403
|
+
{}.tap do |hash|
|
404
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
405
|
+
end
|
406
|
+
elsif value.respond_to? :to_hash
|
407
|
+
value.to_hash
|
408
|
+
else
|
409
|
+
value
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
413
|
+
end
|
414
|
+
|
415
|
+
end
|
@@ -0,0 +1,216 @@
|
|
1
|
+
=begin
|
2
|
+
#Onfido API v3.6
|
3
|
+
|
4
|
+
#The Onfido API (v3.6)
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3.6
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Onfido
|
17
|
+
class AddressesList
|
18
|
+
attr_accessor :addresses
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'addresses' => :'addresses'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'addresses' => :'Array<Address>'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::AddressesList` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::AddressesList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'addresses')
|
61
|
+
if (value = attributes[:'addresses']).is_a?(Array)
|
62
|
+
self.addresses = value
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
+
# @return Array for valid properties with the reasons
|
69
|
+
def list_invalid_properties
|
70
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
71
|
+
invalid_properties = Array.new
|
72
|
+
invalid_properties
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check to see if the all the properties in the model are valid
|
76
|
+
# @return true if the model is valid
|
77
|
+
def valid?
|
78
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
79
|
+
true
|
80
|
+
end
|
81
|
+
|
82
|
+
# Checks equality by comparing each attribute.
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def ==(o)
|
85
|
+
return true if self.equal?(o)
|
86
|
+
self.class == o.class &&
|
87
|
+
addresses == o.addresses
|
88
|
+
end
|
89
|
+
|
90
|
+
# @see the `==` method
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def eql?(o)
|
93
|
+
self == o
|
94
|
+
end
|
95
|
+
|
96
|
+
# Calculates hash code according to all attributes.
|
97
|
+
# @return [Integer] Hash code
|
98
|
+
def hash
|
99
|
+
[addresses].hash
|
100
|
+
end
|
101
|
+
|
102
|
+
# Builds the object from hash
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
+
# @return [Object] Returns the model itself
|
105
|
+
def self.build_from_hash(attributes)
|
106
|
+
return nil unless attributes.is_a?(Hash)
|
107
|
+
attributes = attributes.transform_keys(&:to_sym)
|
108
|
+
transformed_hash = {}
|
109
|
+
openapi_types.each_pair do |key, type|
|
110
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
111
|
+
transformed_hash["#{key}"] = nil
|
112
|
+
elsif type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
116
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
117
|
+
end
|
118
|
+
elsif !attributes[attribute_map[key]].nil?
|
119
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
120
|
+
end
|
121
|
+
end
|
122
|
+
new(transformed_hash)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Deserializes the data based on type
|
126
|
+
# @param string type Data type
|
127
|
+
# @param string value Value to be deserialized
|
128
|
+
# @return [Object] Deserialized data
|
129
|
+
def self._deserialize(type, value)
|
130
|
+
case type.to_sym
|
131
|
+
when :Time
|
132
|
+
Time.parse(value)
|
133
|
+
when :Date
|
134
|
+
Date.parse(value)
|
135
|
+
when :String
|
136
|
+
value.to_s
|
137
|
+
when :Integer
|
138
|
+
value.to_i
|
139
|
+
when :Float
|
140
|
+
value.to_f
|
141
|
+
when :Boolean
|
142
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
143
|
+
true
|
144
|
+
else
|
145
|
+
false
|
146
|
+
end
|
147
|
+
when :Object
|
148
|
+
# generic object (usually a Hash), return directly
|
149
|
+
value
|
150
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
151
|
+
inner_type = Regexp.last_match[:inner_type]
|
152
|
+
value.map { |v| _deserialize(inner_type, v) }
|
153
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
154
|
+
k_type = Regexp.last_match[:k_type]
|
155
|
+
v_type = Regexp.last_match[:v_type]
|
156
|
+
{}.tap do |hash|
|
157
|
+
value.each do |k, v|
|
158
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
else # model
|
162
|
+
# models (e.g. Pet) or oneOf
|
163
|
+
klass = Onfido.const_get(type)
|
164
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the string representation of the object
|
169
|
+
# @return [String] String presentation of the object
|
170
|
+
def to_s
|
171
|
+
to_hash.to_s
|
172
|
+
end
|
173
|
+
|
174
|
+
# to_body is an alias to to_hash (backward compatibility)
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_body
|
177
|
+
to_hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the object in the form of hash
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
182
|
+
def to_hash
|
183
|
+
hash = {}
|
184
|
+
self.class.attribute_map.each_pair do |attr, param|
|
185
|
+
value = self.send(attr)
|
186
|
+
if value.nil?
|
187
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
188
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
189
|
+
end
|
190
|
+
|
191
|
+
hash[param] = _to_hash(value)
|
192
|
+
end
|
193
|
+
hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Outputs non-array value in the form of hash
|
197
|
+
# For object, use to_hash. Otherwise, just return the value
|
198
|
+
# @param [Object] value Any valid value
|
199
|
+
# @return [Hash] Returns the value in the form of hash
|
200
|
+
def _to_hash(value)
|
201
|
+
if value.is_a?(Array)
|
202
|
+
value.compact.map { |v| _to_hash(v) }
|
203
|
+
elsif value.is_a?(Hash)
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
206
|
+
end
|
207
|
+
elsif value.respond_to? :to_hash
|
208
|
+
value.to_hash
|
209
|
+
else
|
210
|
+
value
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|