diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..18bb418 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.5.0 diff --git a/.rubocop.yml b/.rubocop.yml index f3eef8a..d32b2b1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,13 +1,148 @@ +# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) +# Automatically generated by OpenAPI Generator (https://openapi-generator.tech) AllCops: - NewCops: enable - TargetRubyVersion: 2.4.0 + TargetRubyVersion: 2.4 + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop + # to ignore them, so only the ones explicitly set in this file are enabled. + DisabledByDefault: true + Exclude: + - '**/templates/**/*' + - '**/vendor/**/*' + - 'actionpack/lib/action_dispatch/journey/parser.rb' -Layout/LineLength: - Max: 100 +# Prefer &&/|| over and/or. +Style/AndOr: + Enabled: true -Metrics/BlockLength: - Exclude: - - spec/**/* +# Align `when` with `case`. +Layout/CaseIndentation: + Enabled: true + +# Align comments with method definitions. +Layout/CommentIndentation: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true -Style/Documentation: +# In a regular class definition, no empty lines around the body. +Layout/EmptyLinesAroundClassBody: + Enabled: true + +# In a regular method definition, no empty lines around the body. +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +# In a regular module definition, no empty lines around the body. +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/FirstArgumentIndentation: + Enabled: true + +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. +Style/HashSyntax: Enabled: false + +# Method definitions after `private` or `protected` isolated calls need one +# extra level of indentation. +Layout/IndentationConsistency: + Enabled: true + EnforcedStyle: indented_internal_methods + +# Two spaces, no tabs (for indentation). +Layout/IndentationWidth: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +# Defining a method with parameters needs parentheses. +Style/MethodDefParentheses: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: false + EnforcedStyle: always + +# Use `foo {}` not `foo{}`. +Layout/SpaceBeforeBlockBraces: + Enabled: true + +# Use `foo { bar }` not `foo {bar}`. +Layout/SpaceInsideBlockBraces: + Enabled: true + +# Use `{ a: 1 }` not `{a:1}`. +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +# Check quotes usage according to lint rule below. +#Style/StringLiterals: +# Enabled: true +# EnforcedStyle: single_quotes + +# Detect hard tabs, no hard tabs. +Layout/IndentationStyle: + Enabled: true + +# Blank lines should not have any spaces. +Layout/TrailingEmptyLines: + Enabled: true + +# No trailing whitespace. +Layout/TrailingWhitespace: + Enabled: false + +# Use quotes for string literals when they are enough. +Style/RedundantPercentQ: + Enabled: true + +# Align `end` with the matching keyword or starting expression except for +# assignments, where it should be aligned with the LHS. +Layout/EndAlignment: + Enabled: true + EnforcedStyleAlignWith: variable + AutoCorrect: true + +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. +Lint/RequireParentheses: + Enabled: true + +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + +Style/Semicolon: + Enabled: true + AllowAsExpressionSeparator: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 963c0e8..c96ef2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# Changelog + +## v 03th May 2024 ## v2.9.0 24 November 2023 - Added `signed_evidence_file` method for WorkflowRuns diff --git a/Gemfile b/Gemfile index 641cc6f..c2e3127 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,9 @@ -# frozen_string_literal: true - source 'https://rubygems.org' + gemspec group :development, :test do - gem 'pry' + gem 'rake', '~> 13.0.1' gem 'pry-byebug' - gem 'pry-stack_explorer' + gem 'rubocop', '~> 0.66.0' end diff --git a/LICENSE b/LICENSE index 7bb51df..fd273ed 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,6 @@ The MIT License (MIT) -Original work Copyright (c) 2015 Hassle -Modified work Copyright 2019 Onfido +Copyright (c) 2024 Onfido Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -10,14 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index 34083df..19502ed 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,42 @@ -# Onfido +# Onfido Ruby Library The official Ruby library for integrating with the Onfido API. -[![Gem Version](https://badge.fury.io/rb/onfido.svg)](http://badge.fury.io/rb/onfido) -[![Build Status](https://travis-ci.org/onfido/onfido-ruby.svg?branch=master)](https://travis-ci.org/onfido/onfido-ruby) +Documentation can be found at . -Documentation can be found at https://documentation.onfido.com +This version uses Onfido API v3.6. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API. -This version uses Onfido API v3.6 and is compatible with Ruby 2.4 onwards. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API. +[![Gem Version](https://badge.fury.io/rb/onfido.svg)](http://badge.fury.io/rb/onfido) +[![Build Status](https://travis-ci.org/onfido/onfido-ruby.svg?branch=master)](https://travis-ci.org/onfido/onfido-ruby) -## Installation +## Installation & Usage -Add this line to your application's Gemfile: +### Installation ```ruby -gem 'onfido', '~> 2.0.1' +gem onfido, '~> 2.0.1' ``` -## Getting started - -Configure with your API token and region: +Configure with your API token, region and optional timeout (default value is 30): ```ruby -onfido = Onfido::API.new( - api_key: ENV['ONFIDO_API_KEY'], - # Supports :eu, :us and :ca. Previously defaulted to :eu. - region: :eu -) +require onfido + +Onfido.configure do |config| + config.api_token = ENV["ONFIDO_API_TOKEN"] + config.region = config.region[:EU] + config.timeout = 30 +end + +onfido_api = Onfido::DefaultApi.new ``` All resources share the same interface when making API calls. Use `.create` to create a resource, `.find` to find one, and `.all` to fetch all resources. -For example, to create an applicant: +### Making a call to the API ```ruby -onfido.applicant.create( +applicant = onfido_api.create_applicant( first_name: 'Test', last_name: 'Applicant' ) @@ -44,62 +46,61 @@ Documentation and code examples can be found at https://documentation.onfido.com ## Error Handling -There are 3 classes of errors raised by the library, all of which subclass `Onfido::OnfidoError`: +All errors are wrapped by `ApiError` coming from [FaradayExpection](https://www.rubydoc.info/github/lostisland/faraday/Faraday/ClientError): -- `Onfido::RequestError` is raised whenever Onfido returns a `4xx` response -- `Onfido::ServerError` is raised whenever Onfido returns a `5xx` response -- `Onfido::ConnectionError` is raised whenever a network error occurs (e.g., a timeout) +- `Connection timed out` is raised in case of `Faraday::TimeoutError` +- `Connection failed` is raised in case of `Faraday::ConnectionFailed` -All 3 error classes provide the `response_code`, `response_body`, `json_body`, `type` and `fields` of the error (although for `Onfido::ServerError` and `Onfido::ConnectionError` the last 3 are likely to be `nil`). +All errors provide the `response_code`, `response_body`, `json_body`, `type` and `fields` of the error. ```ruby def create_applicant - onfido.applicant.create(params) -rescue Onfido::RequestError => e + onfido_api.create_applicant(params) +rescue Faraday::ConnectionFailed => e e.type # => 'validation_error' e.fields # => { "email": { "messages": ["invalid format"] } } e.response_code # => '422' end ``` -## Other configuration +### Webhook event verification -Optional configuration options with their defaults: +Webhook events payload needs to be verified before it can be accessed. Library allows to easily decode the payload and verify its signature before returning it as an object for user convenience: ```ruby -onfido = Onfido::API.new( - # ... - open_timeout: 10, - read_timeout: 30 -) -``` + require 'onfido/webhook_event_verifier' -## Verifying webhooks + def webhook_verifier() + verifier = Onfido::WebhookEventVerifier.new("_ABC123abc...3ABC123_") -Each webhook endpoint has a secret token, generated automatically and [exposed](https://documentation.onfido.com/#register-webhook) in the API. When sending a request, Onfido includes a signature computed using the request body and this token in the `X-SHA2-Signature` header. + signature = "a0...760e" -You should compare this provided signature to one you generate yourself with the token to verify that a webhook is a genuine request from Onfido. + event = verifier.read_payload('{"payload":{"r...3"}}', signature) -```ruby -if Onfido::Webhook.valid?(request.raw_post, - request.headers["X-SHA2-Signature"], - ENV['ONFIDO_WEBHOOK_TOKEN']) - process_webhook -else - render status: 498, text: "498 Token expired/invalid" -end + rescue Onfido::OnfidoInvalidSignatureError => e + e.type + e.fields + e.response_code + end ``` -Read more at https://developers.onfido.com/guide/manual-webhook-signature-verification#webhook-security - ## Contributing -1. Fork it ( https://github.com/onfido/onfido-ruby/fork ) +This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) - version: 7.5.0; therefore all the contributions, except tests files, should target [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository. + +For contributions to the tests instead, please follow the steps below: + +1. [Fork]() repository 2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create a new Pull Request +3. Make your changes +4. Commit your changes (`git commit -am 'Add some feature'`) +5. Push to the branch (`git push origin my-new-feature`) +6. Create a new Pull Request ## More documentation -More documentation and code examples can be found at https://documentation.onfido.com +More documentation and code examples can be found at . + +## Support +Should you encounter any technical issues during integration, please contact Onfido's Customer Support team +via the [Customer Experience Portal](https://public.support.onfido.com/) which also includes support documentation. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..c72ca30 --- /dev/null +++ b/Rakefile @@ -0,0 +1,10 @@ +require "bundler/gem_tasks" + +begin + require 'rspec/core/rake_task' + + RSpec::Core::RakeTask.new(:spec) + task default: :spec +rescue LoadError + # no rspec available +end diff --git a/lib/onfido.rb b/lib/onfido.rb index 14daf42..3f8abdd 100644 --- a/lib/onfido.rb +++ b/lib/onfido.rb @@ -1,31 +1,303 @@ -# frozen_string_literal: true +=begin +#Onfido API v3.6 -require 'json' -require 'rack' -require 'rest-client' -require 'openssl' +#The Onfido API (v3.6) +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +# Common files +require 'onfido/api_client' +require 'onfido/api_error' require 'onfido/version' -require 'onfido/errors/onfido_error' -require 'onfido/errors/request_error' -require 'onfido/errors/server_error' -require 'onfido/errors/connection_error' -require 'onfido/api' -require 'onfido/options' -require 'onfido/resource' -require 'onfido/resources/address' -require 'onfido/resources/applicant' -require 'onfido/resources/check' -require 'onfido/resources/document' -require 'onfido/resources/extraction' -require 'onfido/resources/live_photo' -require 'onfido/resources/live_video' -require 'onfido/resources/monitor' -require 'onfido/resources/motion_capture' -require 'onfido/resources/report' -require 'onfido/resources/sdk_token' -require 'onfido/resources/webhook' -require 'onfido/resources/workflow_run' +require 'onfido/configuration' + +# Models +require 'onfido/models/address' +require 'onfido/models/address_builder' +require 'onfido/models/address_shared' +require 'onfido/models/addresses_list' +require 'onfido/models/applicant' +require 'onfido/models/applicant_builder' +require 'onfido/models/applicant_create' +require 'onfido/models/applicant_request' +require 'onfido/models/applicant_response' +require 'onfido/models/applicant_shared' +require 'onfido/models/applicant_update' +require 'onfido/models/applicant_updater' +require 'onfido/models/applicants_list' +require 'onfido/models/check' +require 'onfido/models/check_builder' +require 'onfido/models/check_request' +require 'onfido/models/check_response' +require 'onfido/models/check_shared' +require 'onfido/models/checks_list' +require 'onfido/models/complete_task_request' +require 'onfido/models/consent_item' +require 'onfido/models/consents_builder' +require 'onfido/models/country_codes' +require 'onfido/models/device_intelligence_breakdown' +require 'onfido/models/device_intelligence_breakdown_breakdown' +require 'onfido/models/device_intelligence_breakdown_breakdown_device' +require 'onfido/models/device_intelligence_breakdown_breakdown_device_breakdown' +require 'onfido/models/device_intelligence_breakdown_properties' +require 'onfido/models/device_intelligence_breakdown_properties_device' +require 'onfido/models/device_intelligence_breakdown_properties_geolocation' +require 'onfido/models/device_intelligence_breakdown_properties_ip' +require 'onfido/models/device_intelligence_report' +require 'onfido/models/document' +require 'onfido/models/document_breakdown' +require 'onfido/models/document_breakdown_age_validation' +require 'onfido/models/document_breakdown_age_validation_breakdown' +require 'onfido/models/document_breakdown_compromised_document' +require 'onfido/models/document_breakdown_compromised_document_breakdown' +require 'onfido/models/document_breakdown_data_comparison' +require 'onfido/models/document_breakdown_data_comparison_breakdown' +require 'onfido/models/document_breakdown_data_comparison_breakdown_issuing_country' +require 'onfido/models/document_breakdown_data_consistency' +require 'onfido/models/document_breakdown_data_consistency_breakdown' +require 'onfido/models/document_breakdown_data_validation' +require 'onfido/models/document_breakdown_data_validation_breakdown' +require 'onfido/models/document_breakdown_data_validation_breakdown_document_expiration' +require 'onfido/models/document_breakdown_data_validation_breakdown_expiry_date' +require 'onfido/models/document_breakdown_image_integrity' +require 'onfido/models/document_breakdown_image_integrity_breakdown' +require 'onfido/models/document_breakdown_image_integrity_breakdown_colour_picture' +require 'onfido/models/document_breakdown_image_integrity_breakdown_conclusive_document_quality' +require 'onfido/models/document_breakdown_image_integrity_breakdown_image_quality' +require 'onfido/models/document_breakdown_image_integrity_breakdown_supported_document' +require 'onfido/models/document_breakdown_issuing_authority' +require 'onfido/models/document_breakdown_issuing_authority_breakdown' +require 'onfido/models/document_breakdown_issuing_authority_breakdown_nfc_active_authentication' +require 'onfido/models/document_breakdown_issuing_authority_breakdown_nfc_passive_authentication' +require 'onfido/models/document_breakdown_police_record' +require 'onfido/models/document_breakdown_visual_authenticity' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown_digital_tampering' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown_face_detection' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown_fonts' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown_original_document_present' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown_other' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown_picture_face_integrity' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown_security_features' +require 'onfido/models/document_breakdown_visual_authenticity_breakdown_template' +require 'onfido/models/document_cdq_reasons' +require 'onfido/models/document_iq_reasons' +require 'onfido/models/document_odp_reasons' +require 'onfido/models/document_properties' +require 'onfido/models/document_properties_address_lines' +require 'onfido/models/document_properties_barcode_inner' +require 'onfido/models/document_properties_document_classification' +require 'onfido/models/document_properties_document_numbers_inner' +require 'onfido/models/document_properties_driving_licence_information' +require 'onfido/models/document_properties_extracted_data' +require 'onfido/models/document_properties_nfc' +require 'onfido/models/document_report' +require 'onfido/models/document_response' +require 'onfido/models/document_shared' +require 'onfido/models/document_types' +require 'onfido/models/document_video_report' +require 'onfido/models/document_video_with_address_information_report' +require 'onfido/models/document_with_address_information_report' +require 'onfido/models/document_with_driver_verification_report' +require 'onfido/models/document_with_driver_verification_report_all_of_properties' +require 'onfido/models/document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle' +require 'onfido/models/document_with_driver_verification_report_all_of_properties_all_of_vehicle_class_details_inner' +require 'onfido/models/document_with_driving_licence_information_report' +require 'onfido/models/documents_list' +require 'onfido/models/error' +require 'onfido/models/error1' +require 'onfido/models/error_properties' +require 'onfido/models/error_properties1' +require 'onfido/models/extract_request' +require 'onfido/models/extraction' +require 'onfido/models/extraction_document_classification' +require 'onfido/models/extraction_extracted_data' +require 'onfido/models/facial_similarity_motion_breakdown' +require 'onfido/models/facial_similarity_motion_breakdown_face_comparison' +require 'onfido/models/facial_similarity_motion_breakdown_image_integrity' +require 'onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown' +require 'onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_face_detected' +require 'onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_source_integrity' +require 'onfido/models/facial_similarity_motion_breakdown_visual_authenticity' +require 'onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown' +require 'onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection' +require 'onfido/models/facial_similarity_motion_report' +require 'onfido/models/facial_similarity_photo_breakdown' +require 'onfido/models/facial_similarity_photo_breakdown_face_comparison' +require 'onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown' +require 'onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match' +require 'onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match_properties' +require 'onfido/models/facial_similarity_photo_breakdown_image_integrity' +require 'onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown' +require 'onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_face_detected' +require 'onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_source_integrity' +require 'onfido/models/facial_similarity_photo_breakdown_visual_authenticity' +require 'onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown' +require 'onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection' +require 'onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection_properties' +require 'onfido/models/facial_similarity_photo_fully_auto_breakdown' +require 'onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity' +require 'onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown' +require 'onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity' +require 'onfido/models/facial_similarity_photo_fully_auto_report' +require 'onfido/models/facial_similarity_photo_report' +require 'onfido/models/facial_similarity_video_breakdown' +require 'onfido/models/facial_similarity_video_breakdown_face_comparison' +require 'onfido/models/facial_similarity_video_breakdown_image_integrity' +require 'onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown' +require 'onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_face_detected' +require 'onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_source_integrity' +require 'onfido/models/facial_similarity_video_breakdown_visual_authenticity' +require 'onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown' +require 'onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected' +require 'onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection' +require 'onfido/models/facial_similarity_video_report' +require 'onfido/models/id_photos_list' +require 'onfido/models/id_number' +require 'onfido/models/id_photo' +require 'onfido/models/id_photo_response' +require 'onfido/models/identity_enhanced_breakdown' +require 'onfido/models/identity_enhanced_breakdown_address' +require 'onfido/models/identity_enhanced_breakdown_address_breakdown' +require 'onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies' +require 'onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies_properties' +require 'onfido/models/identity_enhanced_breakdown_address_breakdown_telephone_database' +require 'onfido/models/identity_enhanced_breakdown_address_breakdown_voting_register' +require 'onfido/models/identity_enhanced_breakdown_date_of_birth' +require 'onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown' +require 'onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_credit_agencies' +require 'onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_voting_register' +require 'onfido/models/identity_enhanced_breakdown_mortality' +require 'onfido/models/identity_enhanced_breakdown_sources' +require 'onfido/models/identity_enhanced_breakdown_sources_breakdown' +require 'onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources' +require 'onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources_properties' +require 'onfido/models/identity_enhanced_properties' +require 'onfido/models/identity_enhanced_properties_matched_addresses_inner' +require 'onfido/models/identity_enhanced_report' +require 'onfido/models/india_pan_report' +require 'onfido/models/india_pan_report_all_of_breakdown' +require 'onfido/models/india_pan_report_all_of_breakdown_device' +require 'onfido/models/india_pan_report_all_of_breakdown_device_breakdown' +require 'onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid' +require 'onfido/models/india_pan_report_all_of_properties' +require 'onfido/models/india_pan_report_all_of_properties_device' +require 'onfido/models/known_faces_breakdown' +require 'onfido/models/known_faces_breakdown_image_integrity' +require 'onfido/models/known_faces_breakdown_previously_seen_faces' +require 'onfido/models/known_faces_properties' +require 'onfido/models/known_faces_properties_matches_inner' +require 'onfido/models/known_faces_report' +require 'onfido/models/live_photo' +require 'onfido/models/live_photo_response' +require 'onfido/models/live_photos_list' +require 'onfido/models/live_video' +require 'onfido/models/liveo_videos_list' +require 'onfido/models/location' +require 'onfido/models/location_builder' +require 'onfido/models/location_shared' +require 'onfido/models/motion_capture' +require 'onfido/models/motion_captures_list' +require 'onfido/models/photo_auto_reasons' +require 'onfido/models/photo_reasons' +require 'onfido/models/proof_of_address_breakdown' +require 'onfido/models/proof_of_address_breakdown_data_comparison' +require 'onfido/models/proof_of_address_breakdown_data_comparison_breakdown' +require 'onfido/models/proof_of_address_breakdown_document_classification' +require 'onfido/models/proof_of_address_breakdown_document_classification_breakdown' +require 'onfido/models/proof_of_address_breakdown_image_integrity' +require 'onfido/models/proof_of_address_breakdown_image_integrity_breakdown' +require 'onfido/models/proof_of_address_properties' +require 'onfido/models/proof_of_address_report' +require 'onfido/models/repeat_attempts_list' +require 'onfido/models/repeat_attempts_list_repeat_attempts_inner' +require 'onfido/models/report' +require 'onfido/models/report_document' +require 'onfido/models/report_name' +require 'onfido/models/report_result' +require 'onfido/models/report_shared' +require 'onfido/models/report_status' +require 'onfido/models/report_sub_result' +require 'onfido/models/reports_list' +require 'onfido/models/results_feedback' +require 'onfido/models/sdk_token' +require 'onfido/models/sdk_token_builder' +require 'onfido/models/sdk_token_request' +require 'onfido/models/sdk_token_response' +require 'onfido/models/task' +require 'onfido/models/update_monitor_match_request' +require 'onfido/models/us_driving_licence_breakdown' +require 'onfido/models/us_driving_licence_breakdown_address' +require 'onfido/models/us_driving_licence_breakdown_address_breakdown' +require 'onfido/models/us_driving_licence_breakdown_document' +require 'onfido/models/us_driving_licence_breakdown_document_breakdown' +require 'onfido/models/us_driving_licence_breakdown_personal' +require 'onfido/models/us_driving_licence_breakdown_personal_breakdown' +require 'onfido/models/us_driving_licence_builder' +require 'onfido/models/us_driving_licence_report' +require 'onfido/models/us_driving_licence_shared' +require 'onfido/models/video_reasons' +require 'onfido/models/watchlist_aml_breakdown' +require 'onfido/models/watchlist_aml_breakdown_adverse_media' +require 'onfido/models/watchlist_aml_breakdown_legal_and_regulatory_warnings' +require 'onfido/models/watchlist_aml_breakdown_politically_exposed_person' +require 'onfido/models/watchlist_aml_breakdown_sanction' +require 'onfido/models/watchlist_aml_properties' +require 'onfido/models/watchlist_aml_report' +require 'onfido/models/watchlist_enhanced_breakdown' +require 'onfido/models/watchlist_enhanced_properties' +require 'onfido/models/watchlist_enhanced_report' +require 'onfido/models/watchlist_monitor' +require 'onfido/models/watchlist_monitor_match' +require 'onfido/models/watchlist_peps_only_report' +require 'onfido/models/watchlist_sanctions_only_report' +require 'onfido/models/watchlist_standard_breakdown' +require 'onfido/models/watchlist_standard_properties' +require 'onfido/models/watchlist_standard_report' +require 'onfido/models/webhook' +require 'onfido/models/webhook_builder' +require 'onfido/models/webhook_create' +require 'onfido/models/webhook_event' +require 'onfido/models/webhook_event_payload' +require 'onfido/models/webhook_event_payload_object' +require 'onfido/models/webhook_event_type' +require 'onfido/models/webhook_resend' +require 'onfido/models/webhook_response' +require 'onfido/models/webhook_shared' +require 'onfido/models/webhook_update' +require 'onfido/models/webhook_updater' +require 'onfido/models/webhooks_list' +require 'onfido/models/webhooks_resend_item' +require 'onfido/models/workflow_run' +require 'onfido/models/workflow_run_builder' +require 'onfido/models/workflow_run_request' +require 'onfido/models/workflow_run_response' +require 'onfido/models/workflow_run_response_error' +require 'onfido/models/workflow_run_shared' +require 'onfido/models/workflow_run_shared_link' + +# APIs +require 'onfido/api/default_api' module Onfido + class << self + # Customize default settings for the SDK using block. + # Onfido.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end end diff --git a/lib/onfido/api.rb b/lib/onfido/api.rb deleted file mode 100644 index 4fd4b8e..0000000 --- a/lib/onfido/api.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class API - def initialize(api_key:, region:, **extra_options) - @options = Onfido::Options.new(api_key: api_key, region: region, **extra_options) - end - - def applicant - @applicant ||= Onfido::Applicant.new(options) - end - - def check - @check ||= Onfido::Check.new(options) - end - - def document - @document ||= Onfido::Document.new(options) - end - - def live_photo - @live_photo ||= Onfido::LivePhoto.new(options) - end - - def live_video - @live_video ||= Onfido::LiveVideo.new(options) - end - - def monitor - @monitor ||= Onfido::Monitor.new(options) - end - - def motion_capture - @motion_capture ||= Onfido::MotionCapture.new(options) - end - - def report - @report ||= Onfido::Report.new(options) - end - - def sdk_token - @sdk_token ||= Onfido::SdkToken.new(options) - end - - def webhook - @webhook ||= Onfido::Webhook.new(options) - end - - def address - @address ||= Onfido::Address.new(options) - end - - def extraction - @extraction ||= Onfido::Extraction.new(options) - end - - def workflow_run - @workflow_run ||= Onfido::WorkflowRun.new(options) - end - - private - - attr_reader :options - end -end diff --git a/lib/onfido/api/default_api.rb b/lib/onfido/api/default_api.rb new file mode 100644 index 0000000..eeceb73 --- /dev/null +++ b/lib/onfido/api/default_api.rb @@ -0,0 +1,4101 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'cgi' + +module Onfido + class DefaultApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Cancel report + # Cancels single paused reports. + # @param report_id [String] + # @param [Hash] opts the optional parameters + # @return [nil] + def cancel_report(report_id, opts = {}) + cancel_report_with_http_info(report_id, opts) + nil + end + + # Cancel report + # Cancels single paused reports. + # @param report_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def cancel_report_with_http_info(report_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.cancel_report ...' + end + # verify the required parameter 'report_id' is set + if @api_client.config.client_side_validation && report_id.nil? + fail ArgumentError, "Missing the required parameter 'report_id' when calling DefaultApi.cancel_report" + end + # resource path + local_var_path = '/reports/{report_id}/cancel'.sub('{' + 'report_id' + '}', CGI.escape(report_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.cancel_report", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#cancel_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Complete Task + # Completes a Send / Receive Data Task. + # @param workflow_run_id [String] The unique identifier of the Workflow Run to which the Task belongs. + # @param task_id [String] The identifier of the Task you want to complete. + # @param complete_task_request [CompleteTaskRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def complete_task(workflow_run_id, task_id, complete_task_request, opts = {}) + complete_task_with_http_info(workflow_run_id, task_id, complete_task_request, opts) + nil + end + + # Complete Task + # Completes a Send / Receive Data Task. + # @param workflow_run_id [String] The unique identifier of the Workflow Run to which the Task belongs. + # @param task_id [String] The identifier of the Task you want to complete. + # @param complete_task_request [CompleteTaskRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def complete_task_with_http_info(workflow_run_id, task_id, complete_task_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.complete_task ...' + end + # verify the required parameter 'workflow_run_id' is set + if @api_client.config.client_side_validation && workflow_run_id.nil? + fail ArgumentError, "Missing the required parameter 'workflow_run_id' when calling DefaultApi.complete_task" + end + # verify the required parameter 'task_id' is set + if @api_client.config.client_side_validation && task_id.nil? + fail ArgumentError, "Missing the required parameter 'task_id' when calling DefaultApi.complete_task" + end + # verify the required parameter 'complete_task_request' is set + if @api_client.config.client_side_validation && complete_task_request.nil? + fail ArgumentError, "Missing the required parameter 'complete_task_request' when calling DefaultApi.complete_task" + end + # resource path + local_var_path = '/workflow_runs/{workflow_run_id}/tasks/{task_id}/complete'.sub('{' + 'workflow_run_id' + '}', CGI.escape(workflow_run_id.to_s)).sub('{' + 'task_id' + '}', CGI.escape(task_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(complete_task_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.complete_task", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#complete_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create Applicant + # Creates a single applicant. Returns an applicant object. + # @param applicant_builder [ApplicantBuilder] + # @param [Hash] opts the optional parameters + # @return [Applicant] + def create_applicant(applicant_builder, opts = {}) + data, _status_code, _headers = create_applicant_with_http_info(applicant_builder, opts) + data + end + + # Create Applicant + # Creates a single applicant. Returns an applicant object. + # @param applicant_builder [ApplicantBuilder] + # @param [Hash] opts the optional parameters + # @return [Array<(Applicant, Integer, Hash)>] Applicant data, response status code and response headers + def create_applicant_with_http_info(applicant_builder, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_applicant ...' + end + # verify the required parameter 'applicant_builder' is set + if @api_client.config.client_side_validation && applicant_builder.nil? + fail ArgumentError, "Missing the required parameter 'applicant_builder' when calling DefaultApi.create_applicant" + end + # resource path + local_var_path = '/applicants' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(applicant_builder) + + # return_type + return_type = opts[:debug_return_type] || 'Applicant' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_applicant", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_applicant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create a check + # Initiates a check for an applicant, which can contain one or more reports. Returns a check object. + # @param check_builder [CheckBuilder] + # @param [Hash] opts the optional parameters + # @return [Check] + def create_check(check_builder, opts = {}) + data, _status_code, _headers = create_check_with_http_info(check_builder, opts) + data + end + + # Create a check + # Initiates a check for an applicant, which can contain one or more reports. Returns a check object. + # @param check_builder [CheckBuilder] + # @param [Hash] opts the optional parameters + # @return [Array<(Check, Integer, Hash)>] Check data, response status code and response headers + def create_check_with_http_info(check_builder, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_check ...' + end + # verify the required parameter 'check_builder' is set + if @api_client.config.client_side_validation && check_builder.nil? + fail ArgumentError, "Missing the required parameter 'check_builder' when calling DefaultApi.create_check" + end + # resource path + local_var_path = '/checks' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(check_builder) + + # return_type + return_type = opts[:debug_return_type] || 'Check' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_check", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create monitor + # Creates a new monitor for the applicant + # @param watchlist_monitor [WatchlistMonitor] + # @param [Hash] opts the optional parameters + # @return [WatchlistMonitor] + def create_watchlist_monitor(watchlist_monitor, opts = {}) + data, _status_code, _headers = create_watchlist_monitor_with_http_info(watchlist_monitor, opts) + data + end + + # Create monitor + # Creates a new monitor for the applicant + # @param watchlist_monitor [WatchlistMonitor] + # @param [Hash] opts the optional parameters + # @return [Array<(WatchlistMonitor, Integer, Hash)>] WatchlistMonitor data, response status code and response headers + def create_watchlist_monitor_with_http_info(watchlist_monitor, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_watchlist_monitor ...' + end + # verify the required parameter 'watchlist_monitor' is set + if @api_client.config.client_side_validation && watchlist_monitor.nil? + fail ArgumentError, "Missing the required parameter 'watchlist_monitor' when calling DefaultApi.create_watchlist_monitor" + end + # resource path + local_var_path = '/watchlist_monitors' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(watchlist_monitor) + + # return_type + return_type = opts[:debug_return_type] || 'WatchlistMonitor' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_watchlist_monitor", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_watchlist_monitor\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Register webhook + # Registers a webhook. Returns a webhook object. + # @param webhook_builder [WebhookBuilder] + # @param [Hash] opts the optional parameters + # @return [Webhook] + def create_webhook(webhook_builder, opts = {}) + data, _status_code, _headers = create_webhook_with_http_info(webhook_builder, opts) + data + end + + # Register webhook + # Registers a webhook. Returns a webhook object. + # @param webhook_builder [WebhookBuilder] + # @param [Hash] opts the optional parameters + # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers + def create_webhook_with_http_info(webhook_builder, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_webhook ...' + end + # verify the required parameter 'webhook_builder' is set + if @api_client.config.client_side_validation && webhook_builder.nil? + fail ArgumentError, "Missing the required parameter 'webhook_builder' when calling DefaultApi.create_webhook" + end + # resource path + local_var_path = '/webhooks' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_builder) + + # return_type + return_type = opts[:debug_return_type] || 'Webhook' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create a Workflow Run + # Creates and starts a Workflow Run. Returns a Workflow Run object. + # @param workflow_run_builder [WorkflowRunBuilder] + # @param [Hash] opts the optional parameters + # @return [WorkflowRun] + def create_workflow_run(workflow_run_builder, opts = {}) + data, _status_code, _headers = create_workflow_run_with_http_info(workflow_run_builder, opts) + data + end + + # Create a Workflow Run + # Creates and starts a Workflow Run. Returns a Workflow Run object. + # @param workflow_run_builder [WorkflowRunBuilder] + # @param [Hash] opts the optional parameters + # @return [Array<(WorkflowRun, Integer, Hash)>] WorkflowRun data, response status code and response headers + def create_workflow_run_with_http_info(workflow_run_builder, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_workflow_run ...' + end + # verify the required parameter 'workflow_run_builder' is set + if @api_client.config.client_side_validation && workflow_run_builder.nil? + fail ArgumentError, "Missing the required parameter 'workflow_run_builder' when calling DefaultApi.create_workflow_run" + end + # resource path + local_var_path = '/workflow_runs' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(workflow_run_builder) + + # return_type + return_type = opts[:debug_return_type] || 'WorkflowRun' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_workflow_run", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_workflow_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Applicant + # Deletes a single applicant. + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_applicant(applicant_id, opts = {}) + delete_applicant_with_http_info(applicant_id, opts) + nil + end + + # Delete Applicant + # Deletes a single applicant. + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_applicant_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.delete_applicant ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.delete_applicant" + end + # resource path + local_var_path = '/applicants/{applicant_id}'.sub('{' + 'applicant_id' + '}', CGI.escape(applicant_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.delete_applicant", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#delete_applicant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete monitor + # Deactivates the given monitor + # @param monitor_id [String] + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_watchlist_monitor(monitor_id, opts = {}) + delete_watchlist_monitor_with_http_info(monitor_id, opts) + nil + end + + # Delete monitor + # Deactivates the given monitor + # @param monitor_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_watchlist_monitor_with_http_info(monitor_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.delete_watchlist_monitor ...' + end + # verify the required parameter 'monitor_id' is set + if @api_client.config.client_side_validation && monitor_id.nil? + fail ArgumentError, "Missing the required parameter 'monitor_id' when calling DefaultApi.delete_watchlist_monitor" + end + # resource path + local_var_path = '/watchlist_monitors/{monitor_id}'.sub('{' + 'monitor_id' + '}', CGI.escape(monitor_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.delete_watchlist_monitor", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#delete_watchlist_monitor\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a webhook + # Deletes a webhook. + # @param webhook_id [String] + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_webhook(webhook_id, opts = {}) + delete_webhook_with_http_info(webhook_id, opts) + nil + end + + # Delete a webhook + # Deletes a webhook. + # @param webhook_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_webhook_with_http_info(webhook_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.delete_webhook ...' + end + # verify the required parameter 'webhook_id' is set + if @api_client.config.client_side_validation && webhook_id.nil? + fail ArgumentError, "Missing the required parameter 'webhook_id' when calling DefaultApi.delete_webhook" + end + # resource path + local_var_path = '/webhooks/{webhook_id}'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.delete_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download check + # Downloads a PDF of a check with a given check ID. Returns the binary data representing the PDF. + # @param check_id [String] + # @param [Hash] opts the optional parameters + # @return [File] + def download_check(check_id, opts = {}) + data, _status_code, _headers = download_check_with_http_info(check_id, opts) + data + end + + # Download check + # Downloads a PDF of a check with a given check ID. Returns the binary data representing the PDF. + # @param check_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_check_with_http_info(check_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_check ...' + end + # verify the required parameter 'check_id' is set + if @api_client.config.client_side_validation && check_id.nil? + fail ArgumentError, "Missing the required parameter 'check_id' when calling DefaultApi.download_check" + end + # resource path + local_var_path = '/checks/{check_id}/download'.sub('{' + 'check_id' + '}', CGI.escape(check_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_check", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download document + # Downloads specific documents belonging to an applicant. If successful, the response will be the binary data representing the image. + # @param document_id [String] + # @param [Hash] opts the optional parameters + # @return [File] + def download_document(document_id, opts = {}) + data, _status_code, _headers = download_document_with_http_info(document_id, opts) + data + end + + # Download document + # Downloads specific documents belonging to an applicant. If successful, the response will be the binary data representing the image. + # @param document_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_document_with_http_info(document_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_document ...' + end + # verify the required parameter 'document_id' is set + if @api_client.config.client_side_validation && document_id.nil? + fail ArgumentError, "Missing the required parameter 'document_id' when calling DefaultApi.download_document" + end + # resource path + local_var_path = '/documents/{document_id}/download'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_document", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download document video + # Downloads a document video. If successful, the response will be the binary data representing the video. + # @param document_id [String] + # @param [Hash] opts the optional parameters + # @return [File] + def download_document_video(document_id, opts = {}) + data, _status_code, _headers = download_document_video_with_http_info(document_id, opts) + data + end + + # Download document video + # Downloads a document video. If successful, the response will be the binary data representing the video. + # @param document_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_document_video_with_http_info(document_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_document_video ...' + end + # verify the required parameter 'document_id' is set + if @api_client.config.client_side_validation && document_id.nil? + fail ArgumentError, "Missing the required parameter 'document_id' when calling DefaultApi.download_document_video" + end + # resource path + local_var_path = '/documents/{document_id}/video/download'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_document_video", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_document_video\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download ID photo + # ID photos are downloaded using this endpoint. + # @param id_photo_id [String] The ID photo's unique identifier. + # @param [Hash] opts the optional parameters + # @return [File] + def download_id_photo(id_photo_id, opts = {}) + data, _status_code, _headers = download_id_photo_with_http_info(id_photo_id, opts) + data + end + + # Download ID photo + # ID photos are downloaded using this endpoint. + # @param id_photo_id [String] The ID photo's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_id_photo_with_http_info(id_photo_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_id_photo ...' + end + # verify the required parameter 'id_photo_id' is set + if @api_client.config.client_side_validation && id_photo_id.nil? + fail ArgumentError, "Missing the required parameter 'id_photo_id' when calling DefaultApi.download_id_photo" + end + # resource path + local_var_path = '/id_photos/{id_photo_id}/download'.sub('{' + 'id_photo_id' + '}', CGI.escape(id_photo_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_id_photo", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_id_photo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download live photo + # Live photos are downloaded using this endpoint. + # @param live_photo_id [String] The live photo's unique identifier. + # @param [Hash] opts the optional parameters + # @return [File] + def download_live_photo(live_photo_id, opts = {}) + data, _status_code, _headers = download_live_photo_with_http_info(live_photo_id, opts) + data + end + + # Download live photo + # Live photos are downloaded using this endpoint. + # @param live_photo_id [String] The live photo's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_live_photo_with_http_info(live_photo_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_live_photo ...' + end + # verify the required parameter 'live_photo_id' is set + if @api_client.config.client_side_validation && live_photo_id.nil? + fail ArgumentError, "Missing the required parameter 'live_photo_id' when calling DefaultApi.download_live_photo" + end + # resource path + local_var_path = '/live_photos/{live_photo_id}/download'.sub('{' + 'live_photo_id' + '}', CGI.escape(live_photo_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_live_photo", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_live_photo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download live video + # Live videos are downloaded using this endpoint. + # @param live_video_id [String] The live video's unique identifier. + # @param [Hash] opts the optional parameters + # @return [File] + def download_live_video(live_video_id, opts = {}) + data, _status_code, _headers = download_live_video_with_http_info(live_video_id, opts) + data + end + + # Download live video + # Live videos are downloaded using this endpoint. + # @param live_video_id [String] The live video's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_live_video_with_http_info(live_video_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_live_video ...' + end + # verify the required parameter 'live_video_id' is set + if @api_client.config.client_side_validation && live_video_id.nil? + fail ArgumentError, "Missing the required parameter 'live_video_id' when calling DefaultApi.download_live_video" + end + # resource path + local_var_path = '/live_videos/{live_video_id}/download'.sub('{' + 'live_video_id' + '}', CGI.escape(live_video_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_live_video", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_live_video\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download live video frame + # Returns the binary data representing a single frame from a live video. + # @param live_video_id [String] The live video's unique identifier. + # @param [Hash] opts the optional parameters + # @return [File] + def download_live_video_frame(live_video_id, opts = {}) + data, _status_code, _headers = download_live_video_frame_with_http_info(live_video_id, opts) + data + end + + # Download live video frame + # Returns the binary data representing a single frame from a live video. + # @param live_video_id [String] The live video's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_live_video_frame_with_http_info(live_video_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_live_video_frame ...' + end + # verify the required parameter 'live_video_id' is set + if @api_client.config.client_side_validation && live_video_id.nil? + fail ArgumentError, "Missing the required parameter 'live_video_id' when calling DefaultApi.download_live_video_frame" + end + # resource path + local_var_path = '/live_videos/{live_video_id}/frame'.sub('{' + 'live_video_id' + '}', CGI.escape(live_video_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_live_video_frame", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_live_video_frame\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download motion capture + # Motion captures are downloaded using this endpoint. + # @param motion_capture_id [String] The motion capture's unique identifier. + # @param [Hash] opts the optional parameters + # @return [File] + def download_motion_capture(motion_capture_id, opts = {}) + data, _status_code, _headers = download_motion_capture_with_http_info(motion_capture_id, opts) + data + end + + # Download motion capture + # Motion captures are downloaded using this endpoint. + # @param motion_capture_id [String] The motion capture's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_motion_capture_with_http_info(motion_capture_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_motion_capture ...' + end + # verify the required parameter 'motion_capture_id' is set + if @api_client.config.client_side_validation && motion_capture_id.nil? + fail ArgumentError, "Missing the required parameter 'motion_capture_id' when calling DefaultApi.download_motion_capture" + end + # resource path + local_var_path = '/motion_captures/{motion_capture_id}/download'.sub('{' + 'motion_capture_id' + '}', CGI.escape(motion_capture_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_motion_capture", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_motion_capture\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download motion capture frame + # Instead of the whole capture binary, a single frame can be downloaded using this endpoint. Returns the binary data representing the frame. + # @param motion_capture_id [String] The motion capture's unique identifier. + # @param [Hash] opts the optional parameters + # @return [File] + def download_motion_capture_frame(motion_capture_id, opts = {}) + data, _status_code, _headers = download_motion_capture_frame_with_http_info(motion_capture_id, opts) + data + end + + # Download motion capture frame + # Instead of the whole capture binary, a single frame can be downloaded using this endpoint. Returns the binary data representing the frame. + # @param motion_capture_id [String] The motion capture's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_motion_capture_frame_with_http_info(motion_capture_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_motion_capture_frame ...' + end + # verify the required parameter 'motion_capture_id' is set + if @api_client.config.client_side_validation && motion_capture_id.nil? + fail ArgumentError, "Missing the required parameter 'motion_capture_id' when calling DefaultApi.download_motion_capture_frame" + end + # resource path + local_var_path = '/motion_captures/{motion_capture_id}/frame'.sub('{' + 'motion_capture_id' + '}', CGI.escape(motion_capture_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_motion_capture_frame", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_motion_capture_frame\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve Workflow Run Evidence Summary File + # Retrieves the signed evidence file for the designated Workflow Run + # @param workflow_run_id [String] Workflow Run ID + # @param [Hash] opts the optional parameters + # @return [File] + def download_signed_evidence_file(workflow_run_id, opts = {}) + data, _status_code, _headers = download_signed_evidence_file_with_http_info(workflow_run_id, opts) + data + end + + # Retrieve Workflow Run Evidence Summary File + # Retrieves the signed evidence file for the designated Workflow Run + # @param workflow_run_id [String] Workflow Run ID + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_signed_evidence_file_with_http_info(workflow_run_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.download_signed_evidence_file ...' + end + # verify the required parameter 'workflow_run_id' is set + if @api_client.config.client_side_validation && workflow_run_id.nil? + fail ArgumentError, "Missing the required parameter 'workflow_run_id' when calling DefaultApi.download_signed_evidence_file" + end + # resource path + local_var_path = '/workflow_runs/{workflow_run_id}/signed_evidence_file'.sub('{' + 'workflow_run_id' + '}', CGI.escape(workflow_run_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['binary/octet-stream', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.download_signed_evidence_file", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#download_signed_evidence_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Autofill + # Extract information from a document + # @param extract_request [ExtractRequest] + # @param [Hash] opts the optional parameters + # @return [Extraction] + def extract(extract_request, opts = {}) + data, _status_code, _headers = extract_with_http_info(extract_request, opts) + data + end + + # Autofill + # Extract information from a document + # @param extract_request [ExtractRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(Extraction, Integer, Hash)>] Extraction data, response status code and response headers + def extract_with_http_info(extract_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.extract ...' + end + # verify the required parameter 'extract_request' is set + if @api_client.config.client_side_validation && extract_request.nil? + fail ArgumentError, "Missing the required parameter 'extract_request' when calling DefaultApi.extract" + end + # resource path + local_var_path = '/extractions' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(extract_request) + + # return_type + return_type = opts[:debug_return_type] || 'Extraction' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.extract", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#extract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Address Picker + # Search for addresses by postcode + # @param postcode [String] + # @param [Hash] opts the optional parameters + # @return [AddressesList] + def find_addresses(postcode, opts = {}) + data, _status_code, _headers = find_addresses_with_http_info(postcode, opts) + data + end + + # Address Picker + # Search for addresses by postcode + # @param postcode [String] + # @param [Hash] opts the optional parameters + # @return [Array<(AddressesList, Integer, Hash)>] AddressesList data, response status code and response headers + def find_addresses_with_http_info(postcode, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_addresses ...' + end + # verify the required parameter 'postcode' is set + if @api_client.config.client_side_validation && postcode.nil? + fail ArgumentError, "Missing the required parameter 'postcode' when calling DefaultApi.find_addresses" + end + # resource path + local_var_path = '/addresses/pick' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'postcode'] = postcode + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AddressesList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_addresses", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_addresses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve Applicant + # Retrieves a single applicant. Returns an applicant object. + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [Applicant] + def find_applicant(applicant_id, opts = {}) + data, _status_code, _headers = find_applicant_with_http_info(applicant_id, opts) + data + end + + # Retrieve Applicant + # Retrieves a single applicant. Returns an applicant object. + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(Applicant, Integer, Hash)>] Applicant data, response status code and response headers + def find_applicant_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_applicant ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.find_applicant" + end + # resource path + local_var_path = '/applicants/{applicant_id}'.sub('{' + 'applicant_id' + '}', CGI.escape(applicant_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Applicant' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_applicant", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_applicant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve a Check + # Retrieves a single check. Returns a check object. + # @param check_id [String] + # @param [Hash] opts the optional parameters + # @return [Check] + def find_check(check_id, opts = {}) + data, _status_code, _headers = find_check_with_http_info(check_id, opts) + data + end + + # Retrieve a Check + # Retrieves a single check. Returns a check object. + # @param check_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(Check, Integer, Hash)>] Check data, response status code and response headers + def find_check_with_http_info(check_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_check ...' + end + # verify the required parameter 'check_id' is set + if @api_client.config.client_side_validation && check_id.nil? + fail ArgumentError, "Missing the required parameter 'check_id' when calling DefaultApi.find_check" + end + # resource path + local_var_path = '/checks/{check_id}'.sub('{' + 'check_id' + '}', CGI.escape(check_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Check' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_check", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve document + # A single document can be retrieved by calling this endpoint with the document's unique identifier. + # @param document_id [String] + # @param [Hash] opts the optional parameters + # @return [Document] + def find_document(document_id, opts = {}) + data, _status_code, _headers = find_document_with_http_info(document_id, opts) + data + end + + # Retrieve document + # A single document can be retrieved by calling this endpoint with the document's unique identifier. + # @param document_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(Document, Integer, Hash)>] Document data, response status code and response headers + def find_document_with_http_info(document_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_document ...' + end + # verify the required parameter 'document_id' is set + if @api_client.config.client_side_validation && document_id.nil? + fail ArgumentError, "Missing the required parameter 'document_id' when calling DefaultApi.find_document" + end + # resource path + local_var_path = '/documents/{document_id}'.sub('{' + 'document_id' + '}', CGI.escape(document_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Document' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_document", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve ID photo + # Retrieves a single ID photo. Returns a ID photo object. + # @param id_photo_id [String] The ID photo's unique identifier. + # @param [Hash] opts the optional parameters + # @return [IdPhoto] + def find_id_photo(id_photo_id, opts = {}) + data, _status_code, _headers = find_id_photo_with_http_info(id_photo_id, opts) + data + end + + # Retrieve ID photo + # Retrieves a single ID photo. Returns a ID photo object. + # @param id_photo_id [String] The ID photo's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(IdPhoto, Integer, Hash)>] IdPhoto data, response status code and response headers + def find_id_photo_with_http_info(id_photo_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_id_photo ...' + end + # verify the required parameter 'id_photo_id' is set + if @api_client.config.client_side_validation && id_photo_id.nil? + fail ArgumentError, "Missing the required parameter 'id_photo_id' when calling DefaultApi.find_id_photo" + end + # resource path + local_var_path = '/id_photos/{id_photo_id}'.sub('{' + 'id_photo_id' + '}', CGI.escape(id_photo_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IdPhoto' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_id_photo", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_id_photo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve live photo + # Retrieves a single live photo. Returns a live photo object. + # @param live_photo_id [String] The live photo's unique identifier. + # @param [Hash] opts the optional parameters + # @return [LivePhoto] + def find_live_photo(live_photo_id, opts = {}) + data, _status_code, _headers = find_live_photo_with_http_info(live_photo_id, opts) + data + end + + # Retrieve live photo + # Retrieves a single live photo. Returns a live photo object. + # @param live_photo_id [String] The live photo's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(LivePhoto, Integer, Hash)>] LivePhoto data, response status code and response headers + def find_live_photo_with_http_info(live_photo_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_live_photo ...' + end + # verify the required parameter 'live_photo_id' is set + if @api_client.config.client_side_validation && live_photo_id.nil? + fail ArgumentError, "Missing the required parameter 'live_photo_id' when calling DefaultApi.find_live_photo" + end + # resource path + local_var_path = '/live_photos/{live_photo_id}'.sub('{' + 'live_photo_id' + '}', CGI.escape(live_photo_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LivePhoto' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_live_photo", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_live_photo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve live video + # Retrieves a single live video. Returns the corresponding live video object. + # @param live_video_id [String] The live video's unique identifier. + # @param [Hash] opts the optional parameters + # @return [LiveVideo] + def find_live_video(live_video_id, opts = {}) + data, _status_code, _headers = find_live_video_with_http_info(live_video_id, opts) + data + end + + # Retrieve live video + # Retrieves a single live video. Returns the corresponding live video object. + # @param live_video_id [String] The live video's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(LiveVideo, Integer, Hash)>] LiveVideo data, response status code and response headers + def find_live_video_with_http_info(live_video_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_live_video ...' + end + # verify the required parameter 'live_video_id' is set + if @api_client.config.client_side_validation && live_video_id.nil? + fail ArgumentError, "Missing the required parameter 'live_video_id' when calling DefaultApi.find_live_video" + end + # resource path + local_var_path = '/live_videos/{live_video_id}'.sub('{' + 'live_video_id' + '}', CGI.escape(live_video_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LiveVideo' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_live_video", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_live_video\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve motion capture + # Retrieves a single motion capture. Returns the corresponding motion capture object. + # @param motion_capture_id [String] The motion capture's unique identifier. + # @param [Hash] opts the optional parameters + # @return [MotionCapture] + def find_motion_capture(motion_capture_id, opts = {}) + data, _status_code, _headers = find_motion_capture_with_http_info(motion_capture_id, opts) + data + end + + # Retrieve motion capture + # Retrieves a single motion capture. Returns the corresponding motion capture object. + # @param motion_capture_id [String] The motion capture's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(MotionCapture, Integer, Hash)>] MotionCapture data, response status code and response headers + def find_motion_capture_with_http_info(motion_capture_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_motion_capture ...' + end + # verify the required parameter 'motion_capture_id' is set + if @api_client.config.client_side_validation && motion_capture_id.nil? + fail ArgumentError, "Missing the required parameter 'motion_capture_id' when calling DefaultApi.find_motion_capture" + end + # resource path + local_var_path = '/motion_captures/{motion_capture_id}'.sub('{' + 'motion_capture_id' + '}', CGI.escape(motion_capture_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MotionCapture' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_motion_capture", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_motion_capture\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve report + # A single report can be retrieved using this endpoint with the corresponding unique identifier. + # @param report_id [String] + # @param [Hash] opts the optional parameters + # @return [Report] + def find_report(report_id, opts = {}) + data, _status_code, _headers = find_report_with_http_info(report_id, opts) + data + end + + # Retrieve report + # A single report can be retrieved using this endpoint with the corresponding unique identifier. + # @param report_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(Report, Integer, Hash)>] Report data, response status code and response headers + def find_report_with_http_info(report_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_report ...' + end + # verify the required parameter 'report_id' is set + if @api_client.config.client_side_validation && report_id.nil? + fail ArgumentError, "Missing the required parameter 'report_id' when calling DefaultApi.find_report" + end + # resource path + local_var_path = '/reports/{report_id}'.sub('{' + 'report_id' + '}', CGI.escape(report_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Report' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_report", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve Task + # A single task can be retrieved by calling this endpoint with the unique identifier of the Task and Workflow Run. + # @param workflow_run_id [String] The unique identifier of the Workflow Run to which the Task belongs. + # @param task_id [String] The identifier of the Task you want to retrieve. + # @param [Hash] opts the optional parameters + # @return [Task] + def find_task(workflow_run_id, task_id, opts = {}) + data, _status_code, _headers = find_task_with_http_info(workflow_run_id, task_id, opts) + data + end + + # Retrieve Task + # A single task can be retrieved by calling this endpoint with the unique identifier of the Task and Workflow Run. + # @param workflow_run_id [String] The unique identifier of the Workflow Run to which the Task belongs. + # @param task_id [String] The identifier of the Task you want to retrieve. + # @param [Hash] opts the optional parameters + # @return [Array<(Task, Integer, Hash)>] Task data, response status code and response headers + def find_task_with_http_info(workflow_run_id, task_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_task ...' + end + # verify the required parameter 'workflow_run_id' is set + if @api_client.config.client_side_validation && workflow_run_id.nil? + fail ArgumentError, "Missing the required parameter 'workflow_run_id' when calling DefaultApi.find_task" + end + # verify the required parameter 'task_id' is set + if @api_client.config.client_side_validation && task_id.nil? + fail ArgumentError, "Missing the required parameter 'task_id' when calling DefaultApi.find_task" + end + # resource path + local_var_path = '/workflow_runs/{workflow_run_id}/tasks/{task_id}'.sub('{' + 'workflow_run_id' + '}', CGI.escape(workflow_run_id.to_s)).sub('{' + 'task_id' + '}', CGI.escape(task_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Task' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_task", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve monitor + # Retrieves a single monitor + # @param monitor_id [String] The watchlist monitor's unique identifier. + # @param [Hash] opts the optional parameters + # @return [WatchlistMonitor] + def find_watchlist_monitor(monitor_id, opts = {}) + data, _status_code, _headers = find_watchlist_monitor_with_http_info(monitor_id, opts) + data + end + + # Retrieve monitor + # Retrieves a single monitor + # @param monitor_id [String] The watchlist monitor's unique identifier. + # @param [Hash] opts the optional parameters + # @return [Array<(WatchlistMonitor, Integer, Hash)>] WatchlistMonitor data, response status code and response headers + def find_watchlist_monitor_with_http_info(monitor_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_watchlist_monitor ...' + end + # verify the required parameter 'monitor_id' is set + if @api_client.config.client_side_validation && monitor_id.nil? + fail ArgumentError, "Missing the required parameter 'monitor_id' when calling DefaultApi.find_watchlist_monitor" + end + # resource path + local_var_path = '/watchlist_monitors/{monitor_id}'.sub('{' + 'monitor_id' + '}', CGI.escape(monitor_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WatchlistMonitor' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_watchlist_monitor", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_watchlist_monitor\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve a Webhook + # Retrieves a single webhook. Returns a webhook object. + # @param webhook_id [String] + # @param [Hash] opts the optional parameters + # @return [Webhook] + def find_webhook(webhook_id, opts = {}) + data, _status_code, _headers = find_webhook_with_http_info(webhook_id, opts) + data + end + + # Retrieve a Webhook + # Retrieves a single webhook. Returns a webhook object. + # @param webhook_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers + def find_webhook_with_http_info(webhook_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_webhook ...' + end + # verify the required parameter 'webhook_id' is set + if @api_client.config.client_side_validation && webhook_id.nil? + fail ArgumentError, "Missing the required parameter 'webhook_id' when calling DefaultApi.find_webhook" + end + # resource path + local_var_path = '/webhooks/{webhook_id}'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Webhook' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve Workflow Run + # A single workflow run can be retrieved by calling this endpoint with the unique identifier of the Workflow Run. + # @param workflow_run_id [String] The unique identifier of the Workflow Run. + # @param [Hash] opts the optional parameters + # @return [WorkflowRun] + def find_workflow_run(workflow_run_id, opts = {}) + data, _status_code, _headers = find_workflow_run_with_http_info(workflow_run_id, opts) + data + end + + # Retrieve Workflow Run + # A single workflow run can be retrieved by calling this endpoint with the unique identifier of the Workflow Run. + # @param workflow_run_id [String] The unique identifier of the Workflow Run. + # @param [Hash] opts the optional parameters + # @return [Array<(WorkflowRun, Integer, Hash)>] WorkflowRun data, response status code and response headers + def find_workflow_run_with_http_info(workflow_run_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.find_workflow_run ...' + end + # verify the required parameter 'workflow_run_id' is set + if @api_client.config.client_side_validation && workflow_run_id.nil? + fail ArgumentError, "Missing the required parameter 'workflow_run_id' when calling DefaultApi.find_workflow_run" + end + # resource path + local_var_path = '/workflow_runs/{workflow_run_id}'.sub('{' + 'workflow_run_id' + '}', CGI.escape(workflow_run_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WorkflowRun' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.find_workflow_run", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#find_workflow_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Force new report creation (BETA) + # Triggers a new check with an updated report to be generated by the monitor, as if the monitor had received an update. + # @param monitor_id [String] + # @param [Hash] opts the optional parameters + # @return [Applicant] + def force_new_record_creation(monitor_id, opts = {}) + data, _status_code, _headers = force_new_record_creation_with_http_info(monitor_id, opts) + data + end + + # Force new report creation (BETA) + # Triggers a new check with an updated report to be generated by the monitor, as if the monitor had received an update. + # @param monitor_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(Applicant, Integer, Hash)>] Applicant data, response status code and response headers + def force_new_record_creation_with_http_info(monitor_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.force_new_record_creation ...' + end + # verify the required parameter 'monitor_id' is set + if @api_client.config.client_side_validation && monitor_id.nil? + fail ArgumentError, "Missing the required parameter 'monitor_id' when calling DefaultApi.force_new_record_creation" + end + # resource path + local_var_path = '/watchlist_monitors/{monitor_id}/new_report'.sub('{' + 'monitor_id' + '}', CGI.escape(monitor_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Applicant' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.force_new_record_creation", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#force_new_record_creation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Generate a SDK token + # Generates an SDK token. Returns a token object containing the SDK token. + # @param sdk_token_builder [SdkTokenBuilder] + # @param [Hash] opts the optional parameters + # @return [SdkToken] + def generate_sdk_token(sdk_token_builder, opts = {}) + data, _status_code, _headers = generate_sdk_token_with_http_info(sdk_token_builder, opts) + data + end + + # Generate a SDK token + # Generates an SDK token. Returns a token object containing the SDK token. + # @param sdk_token_builder [SdkTokenBuilder] + # @param [Hash] opts the optional parameters + # @return [Array<(SdkToken, Integer, Hash)>] SdkToken data, response status code and response headers + def generate_sdk_token_with_http_info(sdk_token_builder, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.generate_sdk_token ...' + end + # verify the required parameter 'sdk_token_builder' is set + if @api_client.config.client_side_validation && sdk_token_builder.nil? + fail ArgumentError, "Missing the required parameter 'sdk_token_builder' when calling DefaultApi.generate_sdk_token" + end + # resource path + local_var_path = '/sdk_token' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(sdk_token_builder) + + # return_type + return_type = opts[:debug_return_type] || 'SdkToken' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.generate_sdk_token", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#generate_sdk_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Applicants + # Lists all applicants you've created, sorted by creation date in descending order. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :page The page to return. The first page is `page=1` (default to 1) + # @option opts [Integer] :per_page The number of objects per page. (default to 20) + # @option opts [Boolean] :include_deleted Whether to also include applicants scheduled for deletion. (default to false) + # @return [ApplicantsList] + def list_applicants(opts = {}) + data, _status_code, _headers = list_applicants_with_http_info(opts) + data + end + + # List Applicants + # Lists all applicants you've created, sorted by creation date in descending order. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :page The page to return. The first page is `page=1` (default to 1) + # @option opts [Integer] :per_page The number of objects per page. (default to 20) + # @option opts [Boolean] :include_deleted Whether to also include applicants scheduled for deletion. (default to false) + # @return [Array<(ApplicantsList, Integer, Hash)>] ApplicantsList data, response status code and response headers + def list_applicants_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_applicants ...' + end + # resource path + local_var_path = '/applicants' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? + query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ApplicantsList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_applicants", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_applicants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve Checks + # Retrieves a single check. Returns a check object. + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [ChecksList] + def list_checks(applicant_id, opts = {}) + data, _status_code, _headers = list_checks_with_http_info(applicant_id, opts) + data + end + + # Retrieve Checks + # Retrieves a single check. Returns a check object. + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(ChecksList, Integer, Hash)>] ChecksList data, response status code and response headers + def list_checks_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_checks ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.list_checks" + end + # resource path + local_var_path = '/checks' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'applicant_id'] = applicant_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ChecksList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_checks", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_checks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List documents + # All documents belonging to an applicant can be listed from this endpoint + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [DocumentsList] + def list_documents(applicant_id, opts = {}) + data, _status_code, _headers = list_documents_with_http_info(applicant_id, opts) + data + end + + # List documents + # All documents belonging to an applicant can be listed from this endpoint + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(DocumentsList, Integer, Hash)>] DocumentsList data, response status code and response headers + def list_documents_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_documents ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.list_documents" + end + # resource path + local_var_path = '/documents' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'applicant_id'] = applicant_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'DocumentsList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_documents", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_documents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List ID photos + # Lists the ID photos that belong to an applicant. + # @param applicant_id [String] The id of the applicant the ID photos belong to. + # @param [Hash] opts the optional parameters + # @return [IDPhotosList] + def list_id_photos(applicant_id, opts = {}) + data, _status_code, _headers = list_id_photos_with_http_info(applicant_id, opts) + data + end + + # List ID photos + # Lists the ID photos that belong to an applicant. + # @param applicant_id [String] The id of the applicant the ID photos belong to. + # @param [Hash] opts the optional parameters + # @return [Array<(IDPhotosList, Integer, Hash)>] IDPhotosList data, response status code and response headers + def list_id_photos_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_id_photos ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.list_id_photos" + end + # resource path + local_var_path = '/id_photos' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'applicant_id'] = applicant_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IDPhotosList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_id_photos", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_id_photos\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List live photos + # Lists the live photos that belong to an applicant. + # @param applicant_id [String] The id of the applicant the live photos belong to. + # @param [Hash] opts the optional parameters + # @return [LivePhotosList] + def list_live_photos(applicant_id, opts = {}) + data, _status_code, _headers = list_live_photos_with_http_info(applicant_id, opts) + data + end + + # List live photos + # Lists the live photos that belong to an applicant. + # @param applicant_id [String] The id of the applicant the live photos belong to. + # @param [Hash] opts the optional parameters + # @return [Array<(LivePhotosList, Integer, Hash)>] LivePhotosList data, response status code and response headers + def list_live_photos_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_live_photos ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.list_live_photos" + end + # resource path + local_var_path = '/live_photos' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'applicant_id'] = applicant_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LivePhotosList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_live_photos", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_live_photos\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List live videos + # Lists all the live videos that belong to an applicant. + # @param applicant_id [String] The id of the applicant the live videos belong to. + # @param [Hash] opts the optional parameters + # @return [LiveoVideosList] + def list_live_videos(applicant_id, opts = {}) + data, _status_code, _headers = list_live_videos_with_http_info(applicant_id, opts) + data + end + + # List live videos + # Lists all the live videos that belong to an applicant. + # @param applicant_id [String] The id of the applicant the live videos belong to. + # @param [Hash] opts the optional parameters + # @return [Array<(LiveoVideosList, Integer, Hash)>] LiveoVideosList data, response status code and response headers + def list_live_videos_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_live_videos ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.list_live_videos" + end + # resource path + local_var_path = '/live_videos' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'applicant_id'] = applicant_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LiveoVideosList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_live_videos", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_live_videos\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List motion captures + # Lists all the motion captures that belong to an applicant. + # @param applicant_id [String] The id of the applicant the motion captures belong to. + # @param [Hash] opts the optional parameters + # @return [MotionCapturesList] + def list_motion_captures(applicant_id, opts = {}) + data, _status_code, _headers = list_motion_captures_with_http_info(applicant_id, opts) + data + end + + # List motion captures + # Lists all the motion captures that belong to an applicant. + # @param applicant_id [String] The id of the applicant the motion captures belong to. + # @param [Hash] opts the optional parameters + # @return [Array<(MotionCapturesList, Integer, Hash)>] MotionCapturesList data, response status code and response headers + def list_motion_captures_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_motion_captures ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.list_motion_captures" + end + # resource path + local_var_path = '/motion_captures' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'applicant_id'] = applicant_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MotionCapturesList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_motion_captures", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_motion_captures\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve repeat attempts + # Returns all repeat attempts for a given Document report + # @param report_id [String] + # @param [Hash] opts the optional parameters + # @return [RepeatAttemptsList] + def list_repeat_attempts(report_id, opts = {}) + data, _status_code, _headers = list_repeat_attempts_with_http_info(report_id, opts) + data + end + + # Retrieve repeat attempts + # Returns all repeat attempts for a given Document report + # @param report_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(RepeatAttemptsList, Integer, Hash)>] RepeatAttemptsList data, response status code and response headers + def list_repeat_attempts_with_http_info(report_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_repeat_attempts ...' + end + # verify the required parameter 'report_id' is set + if @api_client.config.client_side_validation && report_id.nil? + fail ArgumentError, "Missing the required parameter 'report_id' when calling DefaultApi.list_repeat_attempts" + end + # resource path + local_var_path = '/repeat_attempts/{report_id}'.sub('{' + 'report_id' + '}', CGI.escape(report_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RepeatAttemptsList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_repeat_attempts", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_repeat_attempts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List reports + # All the reports belonging to a particular check can be listed from this endpoint. + # @param check_id [String] + # @param [Hash] opts the optional parameters + # @return [ReportsList] + def list_reports(check_id, opts = {}) + data, _status_code, _headers = list_reports_with_http_info(check_id, opts) + data + end + + # List reports + # All the reports belonging to a particular check can be listed from this endpoint. + # @param check_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(ReportsList, Integer, Hash)>] ReportsList data, response status code and response headers + def list_reports_with_http_info(check_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_reports ...' + end + # verify the required parameter 'check_id' is set + if @api_client.config.client_side_validation && check_id.nil? + fail ArgumentError, "Missing the required parameter 'check_id' when calling DefaultApi.list_reports" + end + # resource path + local_var_path = '/reports' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'check_id'] = check_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ReportsList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_reports", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_reports\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Tasks + # The tasks of a Workflow can be retrieved by calling this endpoint with the unique identifier of the Workflow Run. + # @param workflow_run_id [String] The unique identifier of the Workflow Run to which the Tasks belong. + # @param [Hash] opts the optional parameters + # @return [Array] + def list_tasks(workflow_run_id, opts = {}) + data, _status_code, _headers = list_tasks_with_http_info(workflow_run_id, opts) + data + end + + # List Tasks + # The tasks of a Workflow can be retrieved by calling this endpoint with the unique identifier of the Workflow Run. + # @param workflow_run_id [String] The unique identifier of the Workflow Run to which the Tasks belong. + # @param [Hash] opts the optional parameters + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def list_tasks_with_http_info(workflow_run_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_tasks ...' + end + # verify the required parameter 'workflow_run_id' is set + if @api_client.config.client_side_validation && workflow_run_id.nil? + fail ArgumentError, "Missing the required parameter 'workflow_run_id' when calling DefaultApi.list_tasks" + end + # resource path + local_var_path = '/workflow_runs/{workflow_run_id}/tasks'.sub('{' + 'workflow_run_id' + '}', CGI.escape(workflow_run_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_tasks", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_tasks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List matches (BETA) + # List match IDs on this monitor, as well as their enabled/disabled status + # @param monitor_id [String] + # @param [Hash] opts the optional parameters + # @return [Array] + def list_watchlist_monitor_matches(monitor_id, opts = {}) + data, _status_code, _headers = list_watchlist_monitor_matches_with_http_info(monitor_id, opts) + data + end + + # List matches (BETA) + # List match IDs on this monitor, as well as their enabled/disabled status + # @param monitor_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def list_watchlist_monitor_matches_with_http_info(monitor_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_watchlist_monitor_matches ...' + end + # verify the required parameter 'monitor_id' is set + if @api_client.config.client_side_validation && monitor_id.nil? + fail ArgumentError, "Missing the required parameter 'monitor_id' when calling DefaultApi.list_watchlist_monitor_matches" + end + # resource path + local_var_path = '/watchlist_monitors/{monitor_id}/matches'.sub('{' + 'monitor_id' + '}', CGI.escape(monitor_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_watchlist_monitor_matches", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_watchlist_monitor_matches\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List monitors + # List all available monitors for an applicant + # @param applicant_id [String] The id of the applicant the watchlist monitors belong to. If omitted, all monitors for the account will be listed. + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :include_deleted Whether to also include deleted (inactive) monitors. (default to false) + # @return [Array] + def list_watchlist_monitors(applicant_id, opts = {}) + data, _status_code, _headers = list_watchlist_monitors_with_http_info(applicant_id, opts) + data + end + + # List monitors + # List all available monitors for an applicant + # @param applicant_id [String] The id of the applicant the watchlist monitors belong to. If omitted, all monitors for the account will be listed. + # @param [Hash] opts the optional parameters + # @option opts [Boolean] :include_deleted Whether to also include deleted (inactive) monitors. (default to false) + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def list_watchlist_monitors_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_watchlist_monitors ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.list_watchlist_monitors" + end + # resource path + local_var_path = '/watchlist_monitors' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'applicant_id'] = applicant_id + query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_watchlist_monitors", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_watchlist_monitors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List webhooks + # Lists all webhooks you've created. + # @param [Hash] opts the optional parameters + # @return [WebhooksList] + def list_webhooks(opts = {}) + data, _status_code, _headers = list_webhooks_with_http_info(opts) + data + end + + # List webhooks + # Lists all webhooks you've created. + # @param [Hash] opts the optional parameters + # @return [Array<(WebhooksList, Integer, Hash)>] WebhooksList data, response status code and response headers + def list_webhooks_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_webhooks ...' + end + # resource path + local_var_path = '/webhooks' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'WebhooksList' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_webhooks", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List Workflow Runs + # Retrieves the Workflow Runs of the client. Returns a list of Workflow Run objects. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :page The number of the page to be retrieved. If not specified, defaults to 1. (default to 1) + # @option opts [String] :status A list of comma separated status values to filter the results. Possible values are 'processing', 'awaiting_input', 'approved', 'declined', 'review', 'abandoned' and 'error'. + # @option opts [Time] :created_at_gt A ISO-8601 date to filter results with a created date greater than (after) the one provided. + # @option opts [Time] :created_at_lt A ISO-8601 date to filter results with a created date less than (before) the one provided. + # @option opts [String] :sort A string with the value 'desc' or 'asc' that allows to sort the returned list by the completed datetime either descending or ascending, respectively. If not specified, defaults to 'desc'. (default to 'desc') + # @return [Array] + def list_workflow_runs(opts = {}) + data, _status_code, _headers = list_workflow_runs_with_http_info(opts) + data + end + + # List Workflow Runs + # Retrieves the Workflow Runs of the client. Returns a list of Workflow Run objects. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :page The number of the page to be retrieved. If not specified, defaults to 1. (default to 1) + # @option opts [String] :status A list of comma separated status values to filter the results. Possible values are 'processing', 'awaiting_input', 'approved', 'declined', 'review', 'abandoned' and 'error'. + # @option opts [Time] :created_at_gt A ISO-8601 date to filter results with a created date greater than (after) the one provided. + # @option opts [Time] :created_at_lt A ISO-8601 date to filter results with a created date less than (before) the one provided. + # @option opts [String] :sort A string with the value 'desc' or 'asc' that allows to sort the returned list by the completed datetime either descending or ascending, respectively. If not specified, defaults to 'desc'. (default to 'desc') + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def list_workflow_runs_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.list_workflow_runs ...' + end + allowable_values = ["desc", "asc", "unknown_default_open_api"] + if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) + fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/workflow_runs' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? + query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? + query_params[:'created_at_gt'] = opts[:'created_at_gt'] if !opts[:'created_at_gt'].nil? + query_params[:'created_at_lt'] = opts[:'created_at_lt'] if !opts[:'created_at_lt'].nil? + query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.list_workflow_runs", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#list_workflow_runs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Ping + # Run a health check on the Onfido API + # @param [Hash] opts the optional parameters + # @return [String] + def ping(opts = {}) + data, _status_code, _headers = ping_with_http_info(opts) + data + end + + # Ping + # Run a health check on the Onfido API + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def ping_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.ping ...' + end + # resource path + local_var_path = '/ping' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.ping", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#ping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Fraud reporting (ALPHA) + # Create Feedback on checks and reports + # @param results_feedback [ResultsFeedback] + # @param [Hash] opts the optional parameters + # @return [ResultsFeedback] + def post_results_feedback(results_feedback, opts = {}) + data, _status_code, _headers = post_results_feedback_with_http_info(results_feedback, opts) + data + end + + # Fraud reporting (ALPHA) + # Create Feedback on checks and reports + # @param results_feedback [ResultsFeedback] + # @param [Hash] opts the optional parameters + # @return [Array<(ResultsFeedback, Integer, Hash)>] ResultsFeedback data, response status code and response headers + def post_results_feedback_with_http_info(results_feedback, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.post_results_feedback ...' + end + # verify the required parameter 'results_feedback' is set + if @api_client.config.client_side_validation && results_feedback.nil? + fail ArgumentError, "Missing the required parameter 'results_feedback' when calling DefaultApi.post_results_feedback" + end + # resource path + local_var_path = '/results_feedback' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(results_feedback) + + # return_type + return_type = opts[:debug_return_type] || 'ResultsFeedback' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.post_results_feedback", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#post_results_feedback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Resends webhooks + # Resends events to all webhooks registered with a matching environment in your account. + # @param webhook_resend [WebhookResend] + # @param [Hash] opts the optional parameters + # @return [nil] + def resend_webhooks(webhook_resend, opts = {}) + resend_webhooks_with_http_info(webhook_resend, opts) + nil + end + + # Resends webhooks + # Resends events to all webhooks registered with a matching environment in your account. + # @param webhook_resend [WebhookResend] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def resend_webhooks_with_http_info(webhook_resend, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.resend_webhooks ...' + end + # verify the required parameter 'webhook_resend' is set + if @api_client.config.client_side_validation && webhook_resend.nil? + fail ArgumentError, "Missing the required parameter 'webhook_resend' when calling DefaultApi.resend_webhooks" + end + # resource path + local_var_path = '/webhooks/resend' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_resend) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.resend_webhooks", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#resend_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Restore Applicant + # Restores a single applicant scheduled for deletion. + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [nil] + def restore_applicant(applicant_id, opts = {}) + restore_applicant_with_http_info(applicant_id, opts) + nil + end + + # Restore Applicant + # Restores a single applicant scheduled for deletion. + # @param applicant_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def restore_applicant_with_http_info(applicant_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.restore_applicant ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.restore_applicant" + end + # resource path + local_var_path = '/applicants/{applicant_id}/restore'.sub('{' + 'applicant_id' + '}', CGI.escape(applicant_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.restore_applicant", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#restore_applicant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Resume a Check + # Resumes a paused check. + # @param check_id [String] + # @param [Hash] opts the optional parameters + # @return [nil] + def resume_check(check_id, opts = {}) + resume_check_with_http_info(check_id, opts) + nil + end + + # Resume a Check + # Resumes a paused check. + # @param check_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def resume_check_with_http_info(check_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.resume_check ...' + end + # verify the required parameter 'check_id' is set + if @api_client.config.client_side_validation && check_id.nil? + fail ArgumentError, "Missing the required parameter 'check_id' when calling DefaultApi.resume_check" + end + # resource path + local_var_path = '/checks/{check_id}/resume'.sub('{' + 'check_id' + '}', CGI.escape(check_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.resume_check", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#resume_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Resume report + # Resumes a single paused report. + # @param report_id [String] + # @param [Hash] opts the optional parameters + # @return [nil] + def resume_report(report_id, opts = {}) + resume_report_with_http_info(report_id, opts) + nil + end + + # Resume report + # Resumes a single paused report. + # @param report_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def resume_report_with_http_info(report_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.resume_report ...' + end + # verify the required parameter 'report_id' is set + if @api_client.config.client_side_validation && report_id.nil? + fail ArgumentError, "Missing the required parameter 'report_id' when calling DefaultApi.resume_report" + end + # resource path + local_var_path = '/reports/{report_id}/resume'.sub('{' + 'report_id' + '}', CGI.escape(report_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.resume_report", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#resume_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Applicant + # Allows updating applicant's information before any checks is created. - Partial updates - Addresses and ID numbers present will replace existing ones - Same applicant validations to create applicant + # @param applicant_id [String] + # @param applicant_updater [ApplicantUpdater] + # @param [Hash] opts the optional parameters + # @return [Applicant] + def update_applicant(applicant_id, applicant_updater, opts = {}) + data, _status_code, _headers = update_applicant_with_http_info(applicant_id, applicant_updater, opts) + data + end + + # Update Applicant + # Allows updating applicant's information before any checks is created. - Partial updates - Addresses and ID numbers present will replace existing ones - Same applicant validations to create applicant + # @param applicant_id [String] + # @param applicant_updater [ApplicantUpdater] + # @param [Hash] opts the optional parameters + # @return [Array<(Applicant, Integer, Hash)>] Applicant data, response status code and response headers + def update_applicant_with_http_info(applicant_id, applicant_updater, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.update_applicant ...' + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.update_applicant" + end + # verify the required parameter 'applicant_updater' is set + if @api_client.config.client_side_validation && applicant_updater.nil? + fail ArgumentError, "Missing the required parameter 'applicant_updater' when calling DefaultApi.update_applicant" + end + # resource path + local_var_path = '/applicants/{applicant_id}'.sub('{' + 'applicant_id' + '}', CGI.escape(applicant_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(applicant_updater) + + # return_type + return_type = opts[:debug_return_type] || 'Applicant' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.update_applicant", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#update_applicant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Set match status (BETA) + # Update the status of the given matches + # @param monitor_id [String] + # @param update_monitor_match_request [UpdateMonitorMatchRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def update_monitor_match(monitor_id, update_monitor_match_request, opts = {}) + update_monitor_match_with_http_info(monitor_id, update_monitor_match_request, opts) + nil + end + + # Set match status (BETA) + # Update the status of the given matches + # @param monitor_id [String] + # @param update_monitor_match_request [UpdateMonitorMatchRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_monitor_match_with_http_info(monitor_id, update_monitor_match_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.update_monitor_match ...' + end + # verify the required parameter 'monitor_id' is set + if @api_client.config.client_side_validation && monitor_id.nil? + fail ArgumentError, "Missing the required parameter 'monitor_id' when calling DefaultApi.update_monitor_match" + end + # verify the required parameter 'update_monitor_match_request' is set + if @api_client.config.client_side_validation && update_monitor_match_request.nil? + fail ArgumentError, "Missing the required parameter 'update_monitor_match_request' when calling DefaultApi.update_monitor_match" + end + # resource path + local_var_path = '/watchlist_monitors/{monitor_id}/matches'.sub('{' + 'monitor_id' + '}', CGI.escape(monitor_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_monitor_match_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.update_monitor_match", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#update_monitor_match\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Edit a webhook + # Edits a webhook. Returns the updated webhook object. + # @param webhook_id [String] + # @param webhook_updater [WebhookUpdater] + # @param [Hash] opts the optional parameters + # @return [Webhook] + def update_webhook(webhook_id, webhook_updater, opts = {}) + data, _status_code, _headers = update_webhook_with_http_info(webhook_id, webhook_updater, opts) + data + end + + # Edit a webhook + # Edits a webhook. Returns the updated webhook object. + # @param webhook_id [String] + # @param webhook_updater [WebhookUpdater] + # @param [Hash] opts the optional parameters + # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers + def update_webhook_with_http_info(webhook_id, webhook_updater, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.update_webhook ...' + end + # verify the required parameter 'webhook_id' is set + if @api_client.config.client_side_validation && webhook_id.nil? + fail ArgumentError, "Missing the required parameter 'webhook_id' when calling DefaultApi.update_webhook" + end + # verify the required parameter 'webhook_updater' is set + if @api_client.config.client_side_validation && webhook_updater.nil? + fail ArgumentError, "Missing the required parameter 'webhook_updater' when calling DefaultApi.update_webhook" + end + # resource path + local_var_path = '/webhooks/{webhook_id}'.sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_updater) + + # return_type + return_type = opts[:debug_return_type] || 'Webhook' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.update_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Upload a document + # Documents are uploaded using this endpoint. Along with the file upload the relevant document type must be specified. Documents must be uploaded as a multipart form. The valid file types are: jpg, png and pdf. The file size must be between 2KB and 3MB. + # @param type [String] The type of document + # @param applicant_id [String] The ID of the applicant whose document is being uploaded. + # @param file [File] The file to be uploaded. + # @param [Hash] opts the optional parameters + # @option opts [String] :file_type The file type of the uploaded file + # @option opts [String] :side The side of the document, if applicable. The possible values are front and back + # @option opts [CountryCodes] :issuing_country The issuing country of the document, a 3-letter ISO code. + # @option opts [Boolean] :validate_image_quality Defaults to false. When true the submitted image will undergo an image quality validation which may take up to 5 seconds. + # @option opts [LocationBuilder] :location + # @return [Document] + def upload_document(type, applicant_id, file, opts = {}) + data, _status_code, _headers = upload_document_with_http_info(type, applicant_id, file, opts) + data + end + + # Upload a document + # Documents are uploaded using this endpoint. Along with the file upload the relevant document type must be specified. Documents must be uploaded as a multipart form. The valid file types are: jpg, png and pdf. The file size must be between 2KB and 3MB. + # @param type [String] The type of document + # @param applicant_id [String] The ID of the applicant whose document is being uploaded. + # @param file [File] The file to be uploaded. + # @param [Hash] opts the optional parameters + # @option opts [String] :file_type The file type of the uploaded file + # @option opts [String] :side The side of the document, if applicable. The possible values are front and back + # @option opts [CountryCodes] :issuing_country The issuing country of the document, a 3-letter ISO code. + # @option opts [Boolean] :validate_image_quality Defaults to false. When true the submitted image will undergo an image quality validation which may take up to 5 seconds. + # @option opts [LocationBuilder] :location + # @return [Array<(Document, Integer, Hash)>] Document data, response status code and response headers + def upload_document_with_http_info(type, applicant_id, file, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.upload_document ...' + end + # verify the required parameter 'type' is set + if @api_client.config.client_side_validation && type.nil? + fail ArgumentError, "Missing the required parameter 'type' when calling DefaultApi.upload_document" + end + # verify the required parameter 'applicant_id' is set + if @api_client.config.client_side_validation && applicant_id.nil? + fail ArgumentError, "Missing the required parameter 'applicant_id' when calling DefaultApi.upload_document" + end + # verify the required parameter 'file' is set + if @api_client.config.client_side_validation && file.nil? + fail ArgumentError, "Missing the required parameter 'file' when calling DefaultApi.upload_document" + end + allowable_values = ["jpg", "png", "pdf", "unknown_default_open_api"] + if @api_client.config.client_side_validation && opts[:'file_type'] && !allowable_values.include?(opts[:'file_type']) + fail ArgumentError, "invalid value for \"file_type\", must be one of #{allowable_values}" + end + allowable_values = ["front", "back", "unknown_default_open_api"] + if @api_client.config.client_side_validation && opts[:'side'] && !allowable_values.include?(opts[:'side']) + fail ArgumentError, "invalid value for \"side\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/documents' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['type'] = type + form_params['applicant_id'] = applicant_id + form_params['file'] = file + form_params['file_type'] = opts[:'file_type'] if !opts[:'file_type'].nil? + form_params['side'] = opts[:'side'] if !opts[:'side'].nil? + form_params['issuing_country'] = opts[:'issuing_country'] if !opts[:'issuing_country'].nil? + form_params['validate_image_quality'] = opts[:'validate_image_quality'] if !opts[:'validate_image_quality'].nil? + form_params['location'] = opts[:'location'] if !opts[:'location'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Document' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.upload_document", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#upload_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Upload ID photo + # You can upload ID photos to this endpoint. Like document upload, files must be uploaded as a multipart form. Valid file types are jpg, png and pdf. The file size must be between 32KB and 10MB. + # @param [Hash] opts the optional parameters + # @option opts [String] :applicant_id The ID of the applicant whose ID photo is being uploaded. + # @option opts [File] :file The file to be uploaded. + # @return [IdPhoto] + def upload_id_photo(opts = {}) + data, _status_code, _headers = upload_id_photo_with_http_info(opts) + data + end + + # Upload ID photo + # You can upload ID photos to this endpoint. Like document upload, files must be uploaded as a multipart form. Valid file types are jpg, png and pdf. The file size must be between 32KB and 10MB. + # @param [Hash] opts the optional parameters + # @option opts [String] :applicant_id The ID of the applicant whose ID photo is being uploaded. + # @option opts [File] :file The file to be uploaded. + # @return [Array<(IdPhoto, Integer, Hash)>] IdPhoto data, response status code and response headers + def upload_id_photo_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.upload_id_photo ...' + end + # resource path + local_var_path = '/id_photos' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['applicant_id'] = opts[:'applicant_id'] if !opts[:'applicant_id'].nil? + form_params['file'] = opts[:'file'] if !opts[:'file'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IdPhoto' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.upload_id_photo", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#upload_id_photo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Upload live photo + # You can upload live photos to this endpoint. Like document upload, files must be uploaded as a multipart form. Valid file types are jpg, png and pdf. The file size must be between 32KB and 10MB. Live photos are validated at the point of upload to check that they contain exactly one face. This validation can be disabled by setting the advanced_validation argument to false. + # @param [Hash] opts the optional parameters + # @option opts [String] :applicant_id The ID of the applicant whose live photo is being uploaded. + # @option opts [File] :file The file to be uploaded. + # @option opts [Boolean] :advanced_validation Validates that the live photo contains exactly one face. (default to true) + # @return [LivePhoto] + def upload_live_photo(opts = {}) + data, _status_code, _headers = upload_live_photo_with_http_info(opts) + data + end + + # Upload live photo + # You can upload live photos to this endpoint. Like document upload, files must be uploaded as a multipart form. Valid file types are jpg, png and pdf. The file size must be between 32KB and 10MB. Live photos are validated at the point of upload to check that they contain exactly one face. This validation can be disabled by setting the advanced_validation argument to false. + # @param [Hash] opts the optional parameters + # @option opts [String] :applicant_id The ID of the applicant whose live photo is being uploaded. + # @option opts [File] :file The file to be uploaded. + # @option opts [Boolean] :advanced_validation Validates that the live photo contains exactly one face. (default to true) + # @return [Array<(LivePhoto, Integer, Hash)>] LivePhoto data, response status code and response headers + def upload_live_photo_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.upload_live_photo ...' + end + # resource path + local_var_path = '/live_photos' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['applicant_id'] = opts[:'applicant_id'] if !opts[:'applicant_id'].nil? + form_params['file'] = opts[:'file'] if !opts[:'file'].nil? + form_params['advanced_validation'] = opts[:'advanced_validation'] if !opts[:'advanced_validation'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'LivePhoto' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Token'] + + new_options = opts.merge( + :operation => :"DefaultApi.upload_live_photo", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#upload_live_photo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/onfido/api_client.rb b/lib/onfido/api_client.rb new file mode 100644 index 0000000..f2363fc --- /dev/null +++ b/lib/onfido/api_client.rb @@ -0,0 +1,431 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'faraday' +require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') +require 'marcel' + + +module Onfido + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "onfido-ruby/2.9.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + stream = nil + begin + response = connection(opts).public_send(http_method.to_sym.downcase) do |req| + request = build_request(http_method, path, req, opts) + stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary' + end + + if config.debugging + config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.status == 0 && response.respond_to?(:return_message) + # Errors from libcurl will be made visible here + fail ApiError.new(code: 0, + message: response.return_message) + else + fail ApiError.new(code: response.status, + response_headers: response.headers, + response_body: response.body), + response.reason_phrase + end + end + rescue Faraday::TimeoutError + fail ApiError.new('Connection timed out') + rescue Faraday::ConnectionFailed + fail ApiError.new('Connection failed') + end + + if opts[:return_type] == 'File' || opts[:return_type] == 'Binary' + data = deserialize_file(response, stream) + elsif opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.status, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Faraday::Request] A Faraday Request + def build_request(http_method, path, request, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + if config.debugging + config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + request.headers = header_params + request.body = req_body + + # Overload default options only if provided + request.options.params_encoder = config.params_encoder if config.params_encoder + request.options.timeout = config.timeout if config.timeout + + request.url url + request.params = query_params + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' + data = URI.encode_www_form(form_params) + elsif header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Tempfile + data[key] = Faraday::FilePart.new(value.path, Marcel::MimeType.for(Pathname.new(value.path))) + when ::Array, nil + # let Faraday handle Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + def download_file(request) + stream = [] + + # handle streaming Responses + request.options.on_data = Proc.new do |chunk, overall_received_bytes| + stream << chunk + end + stream + end + + def deserialize_file(response, stream) + body = response.body + if @config.return_binary_data == true + # return byte stream + encoding = body.encoding + stream.join.force_encoding(encoding) + else + # return file instead of binary data + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + tempfile.write(stream.join.force_encoding(encoding)) + tempfile.close + config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + tempfile + end + end + + def connection(opts) + opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular + end + + def connection_multipart + @connection_multipart ||= build_connection do |conn| + conn.request :multipart + conn.request :url_encoded + end + end + + def connection_regular + @connection_regular ||= build_connection + end + + def build_connection + Faraday.new(url: config.base_url, ssl: ssl_options, proxy: config.proxy) do |conn| + basic_auth(conn) + config.configure_middleware(conn) + yield(conn) if block_given? + conn.adapter(Faraday.default_adapter) + config.configure_connection(conn) + end + end + + def ssl_options + { + ca_file: config.ssl_ca_file, + verify: config.ssl_verify, + verify_mode: config.ssl_verify_mode, + client_cert: config.ssl_client_cert, + client_key: config.ssl_client_key + } + end + + def basic_auth(conn) + if config.username && config.password + if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') + conn.request(:authorization, :basic, config.username, config.password) + else + conn.request(:basic_auth, config.username, config.password) + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body.to_s if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/onfido/api_error.rb b/lib/onfido/api_error.rb new file mode 100644 index 0000000..f4113a9 --- /dev/null +++ b/lib/onfido/api_error.rb @@ -0,0 +1,58 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +module Onfido + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/onfido/configuration.rb b/lib/onfido/configuration.rb new file mode 100644 index 0000000..1ac28df --- /dev/null +++ b/lib/onfido/configuration.rb @@ -0,0 +1,416 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +module Onfido + class Configuration + REGIONS = { + EU: 'eu', + CA: 'ca', + US: 'us' + }.freeze + + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :ssl_verify + + ### TLS/SSL setting + # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html) + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + attr_accessor :ssl_verify_mode + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + attr_accessor :ssl_ca_file + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :ssl_client_cert + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :ssl_client_key + + ### Proxy setting + # HTTP Proxy settings + attr_accessor :proxy + + # Set this to customize parameters encoder of array parameter. + # Default to nil. Faraday uses NestedParamsEncoder when nil. + # + # @see The params_encoder option of Faraday. Related source code: + # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders + attr_accessor :params_encoder + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.eu.onfido.com' + @base_path = '/v3.6' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @ssl_verify = true + @ssl_verify_mode = nil + @ssl_ca_file = nil + @ssl_client_cert = nil + @ssl_client_key = nil + @middlewares = Hash.new { |h, k| h[k] = [] } + @configure_connection_blocks = [] + @timeout = 30 + # return data as binary instead of file + @return_binary_data = false + @params_encoder = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + def api_token=(api_token) + @api_key = {'Token' => "Token token=#{api_token}"} + end + + def region() + REGIONS + end + + def region=(region) + @server_index = 0 + server_variables[:region] = region + end + + def timeout=(timeout) + @timeout = timeout + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Token' => + { + type: 'api_key', + in: 'header', + key: 'Authorization', + value: api_key_with_prefix('Token') + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.{region}.onfido.com/v3.6", + description: "No description provided", + variables: { + region: { + description: "No description provided", + default_value: "eu", + enum_values: [ + "eu", + "us", + "ca" + ] + } + } + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + # Configure Faraday connection directly. + # + # ``` + # c.configure_faraday_connection do |conn| + # conn.use Faraday::HttpCache, shared_cache: false, logger: logger + # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger| + # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]') + # end + # end + # + # c.configure_faraday_connection do |conn| + # conn.adapter :typhoeus + # end + # ``` + # + # @param block [Proc] `#call`able object that takes one arg, the connection + def configure_faraday_connection(&block) + @configure_connection_blocks << block + end + + def configure_connection(conn) + @configure_connection_blocks.each do |block| + block.call(conn) + end + end + + # Adds middleware to the stack + def use(*middleware) + set_faraday_middleware(:use, *middleware) + end + + # Adds request middleware to the stack + def request(*middleware) + set_faraday_middleware(:request, *middleware) + end + + # Adds response middleware to the stack + def response(*middleware) + set_faraday_middleware(:response, *middleware) + end + + # Adds Faraday middleware setting information to the stack + # + # @example Use the `set_faraday_middleware` method to set middleware information + # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503]) + # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug }) + # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false) + # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 }) + # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger) + # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware) + # + # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143 + def set_faraday_middleware(operation, key, *args, &block) + unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation) + fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \ + " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete." + end + + @middlewares[operation] << [key, args, block] + end + ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true) + + # Set up middleware on the connection + def configure_middleware(connection) + return if @middlewares.empty? + + [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation| + next unless @middlewares.key?(operation) + + @middlewares[operation].each do |key, args, block| + connection.builder.send(operation, key, *args, &block) + end + end + + if @middlewares.key?(:delete) + @middlewares[:delete].each do |key, _args, _block| + connection.builder.delete(key) + end + end + end + + end +end diff --git a/lib/onfido/errors/connection_error.rb b/lib/onfido/errors/connection_error.rb deleted file mode 100644 index 79910bc..0000000 --- a/lib/onfido/errors/connection_error.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class ConnectionError < OnfidoError - end -end diff --git a/lib/onfido/errors/onfido_error.rb b/lib/onfido/errors/onfido_error.rb deleted file mode 100644 index d623041..0000000 --- a/lib/onfido/errors/onfido_error.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class OnfidoError < StandardError - attr_accessor :response_code, :response_body - - def initialize(message = nil, - response_code: nil, - response_body: nil) - @response_code = response_code - @response_body = response_body - - super(message) - end - - def json_body - JSON.parse(response_body.to_s) - rescue JSON::ParserError - nil - end - - def type - json_body && json_body['error'] && json_body['error']['type'] - end - - def fields - json_body && json_body['error'] && json_body['error']['fields'] - end - end -end diff --git a/lib/onfido/errors/request_error.rb b/lib/onfido/errors/request_error.rb deleted file mode 100644 index 83b7510..0000000 --- a/lib/onfido/errors/request_error.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class RequestError < OnfidoError - end -end diff --git a/lib/onfido/errors/server_error.rb b/lib/onfido/errors/server_error.rb deleted file mode 100644 index 8230096..0000000 --- a/lib/onfido/errors/server_error.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class ServerError < OnfidoError - end -end diff --git a/lib/onfido/models/address.rb b/lib/onfido/models/address.rb new file mode 100644 index 0000000..c9b1fb2 --- /dev/null +++ b/lib/onfido/models/address.rb @@ -0,0 +1,422 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Address + # The flat number of this address + attr_accessor :flat_number + + # The building number of this address + attr_accessor :building_number + + # The building name of this address + attr_accessor :building_name + + # The street of the applicant's address + attr_accessor :street + + # The sub-street of the applicant's address + attr_accessor :sub_street + + # The town of the applicant's address + attr_accessor :town + + # The postcode or ZIP of the applicant's address + attr_accessor :postcode + + # The 3 character ISO country code of this address. For example, GBR is the country code for the United Kingdom + attr_accessor :country + + # The address state. US states must use the USPS abbreviation (see also ISO 3166-2:US), for example AK, CA, or TX. + attr_accessor :state + + # Line 1 of the applicant's address + attr_accessor :line1 + + # Line 2 of the applicant's address + attr_accessor :line2 + + # Line 3 of the applicant's address + attr_accessor :line3 + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flat_number' => :'flat_number', + :'building_number' => :'building_number', + :'building_name' => :'building_name', + :'street' => :'street', + :'sub_street' => :'sub_street', + :'town' => :'town', + :'postcode' => :'postcode', + :'country' => :'country', + :'state' => :'state', + :'line1' => :'line1', + :'line2' => :'line2', + :'line3' => :'line3' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'flat_number' => :'String', + :'building_number' => :'String', + :'building_name' => :'String', + :'street' => :'String', + :'sub_street' => :'String', + :'town' => :'String', + :'postcode' => :'String', + :'country' => :'CountryCodes', + :'state' => :'String', + :'line1' => :'String', + :'line2' => :'String', + :'line3' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'line1', + :'line2', + :'line3' + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'AddressShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Address` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Address`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'flat_number') + self.flat_number = attributes[:'flat_number'] + end + + if attributes.key?(:'building_number') + self.building_number = attributes[:'building_number'] + end + + if attributes.key?(:'building_name') + self.building_name = attributes[:'building_name'] + end + + if attributes.key?(:'street') + self.street = attributes[:'street'] + end + + if attributes.key?(:'sub_street') + self.sub_street = attributes[:'sub_street'] + end + + if attributes.key?(:'town') + self.town = attributes[:'town'] + end + + if attributes.key?(:'postcode') + self.postcode = attributes[:'postcode'] + else + self.postcode = nil + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + else + self.country = nil + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line1') + self.line1 = attributes[:'line1'] + end + + if attributes.key?(:'line2') + self.line2 = attributes[:'line2'] + end + + if attributes.key?(:'line3') + self.line3 = attributes[:'line3'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @postcode.nil? + invalid_properties.push('invalid value for "postcode", postcode cannot be nil.') + end + + if @country.nil? + invalid_properties.push('invalid value for "country", country cannot be nil.') + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line1.nil? && @line1 !~ pattern + invalid_properties.push("invalid value for \"line1\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line2.nil? && @line2 !~ pattern + invalid_properties.push("invalid value for \"line2\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line3.nil? && @line3 !~ pattern + invalid_properties.push("invalid value for \"line3\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @postcode.nil? + return false if @country.nil? + return false if !@line1.nil? && @line1 !~ Regexp.new(/^[^!$%^*=<>]*$/) + return false if !@line2.nil? && @line2 !~ Regexp.new(/^[^!$%^*=<>]*$/) + return false if !@line3.nil? && @line3 !~ Regexp.new(/^[^!$%^*=<>]*$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] line1 Value to be assigned + def line1=(line1) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line1.nil? && line1 !~ pattern + fail ArgumentError, "invalid value for \"line1\", must conform to the pattern #{pattern}." + end + + @line1 = line1 + end + + # Custom attribute writer method with validation + # @param [Object] line2 Value to be assigned + def line2=(line2) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line2.nil? && line2 !~ pattern + fail ArgumentError, "invalid value for \"line2\", must conform to the pattern #{pattern}." + end + + @line2 = line2 + end + + # Custom attribute writer method with validation + # @param [Object] line3 Value to be assigned + def line3=(line3) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line3.nil? && line3 !~ pattern + fail ArgumentError, "invalid value for \"line3\", must conform to the pattern #{pattern}." + end + + @line3 = line3 + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flat_number == o.flat_number && + building_number == o.building_number && + building_name == o.building_name && + street == o.street && + sub_street == o.sub_street && + town == o.town && + postcode == o.postcode && + country == o.country && + state == o.state && + line1 == o.line1 && + line2 == o.line2 && + line3 == o.line3 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flat_number, building_number, building_name, street, sub_street, town, postcode, country, state, line1, line2, line3].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/address_builder.rb b/lib/onfido/models/address_builder.rb new file mode 100644 index 0000000..1eed953 --- /dev/null +++ b/lib/onfido/models/address_builder.rb @@ -0,0 +1,422 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class AddressBuilder + # The flat number of this address + attr_accessor :flat_number + + # The building number of this address + attr_accessor :building_number + + # The building name of this address + attr_accessor :building_name + + # The street of the applicant's address + attr_accessor :street + + # The sub-street of the applicant's address + attr_accessor :sub_street + + # The town of the applicant's address + attr_accessor :town + + # The postcode or ZIP of the applicant's address + attr_accessor :postcode + + # The 3 character ISO country code of this address. For example, GBR is the country code for the United Kingdom + attr_accessor :country + + # The address state. US states must use the USPS abbreviation (see also ISO 3166-2:US), for example AK, CA, or TX. + attr_accessor :state + + # Line 1 of the applicant's address + attr_accessor :line1 + + # Line 2 of the applicant's address + attr_accessor :line2 + + # Line 3 of the applicant's address + attr_accessor :line3 + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flat_number' => :'flat_number', + :'building_number' => :'building_number', + :'building_name' => :'building_name', + :'street' => :'street', + :'sub_street' => :'sub_street', + :'town' => :'town', + :'postcode' => :'postcode', + :'country' => :'country', + :'state' => :'state', + :'line1' => :'line1', + :'line2' => :'line2', + :'line3' => :'line3' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'flat_number' => :'String', + :'building_number' => :'String', + :'building_name' => :'String', + :'street' => :'String', + :'sub_street' => :'String', + :'town' => :'String', + :'postcode' => :'String', + :'country' => :'CountryCodes', + :'state' => :'String', + :'line1' => :'String', + :'line2' => :'String', + :'line3' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'line1', + :'line2', + :'line3' + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'AddressShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::AddressBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::AddressBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'flat_number') + self.flat_number = attributes[:'flat_number'] + end + + if attributes.key?(:'building_number') + self.building_number = attributes[:'building_number'] + end + + if attributes.key?(:'building_name') + self.building_name = attributes[:'building_name'] + end + + if attributes.key?(:'street') + self.street = attributes[:'street'] + end + + if attributes.key?(:'sub_street') + self.sub_street = attributes[:'sub_street'] + end + + if attributes.key?(:'town') + self.town = attributes[:'town'] + end + + if attributes.key?(:'postcode') + self.postcode = attributes[:'postcode'] + else + self.postcode = nil + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + else + self.country = nil + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line1') + self.line1 = attributes[:'line1'] + end + + if attributes.key?(:'line2') + self.line2 = attributes[:'line2'] + end + + if attributes.key?(:'line3') + self.line3 = attributes[:'line3'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @postcode.nil? + invalid_properties.push('invalid value for "postcode", postcode cannot be nil.') + end + + if @country.nil? + invalid_properties.push('invalid value for "country", country cannot be nil.') + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line1.nil? && @line1 !~ pattern + invalid_properties.push("invalid value for \"line1\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line2.nil? && @line2 !~ pattern + invalid_properties.push("invalid value for \"line2\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line3.nil? && @line3 !~ pattern + invalid_properties.push("invalid value for \"line3\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @postcode.nil? + return false if @country.nil? + return false if !@line1.nil? && @line1 !~ Regexp.new(/^[^!$%^*=<>]*$/) + return false if !@line2.nil? && @line2 !~ Regexp.new(/^[^!$%^*=<>]*$/) + return false if !@line3.nil? && @line3 !~ Regexp.new(/^[^!$%^*=<>]*$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] line1 Value to be assigned + def line1=(line1) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line1.nil? && line1 !~ pattern + fail ArgumentError, "invalid value for \"line1\", must conform to the pattern #{pattern}." + end + + @line1 = line1 + end + + # Custom attribute writer method with validation + # @param [Object] line2 Value to be assigned + def line2=(line2) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line2.nil? && line2 !~ pattern + fail ArgumentError, "invalid value for \"line2\", must conform to the pattern #{pattern}." + end + + @line2 = line2 + end + + # Custom attribute writer method with validation + # @param [Object] line3 Value to be assigned + def line3=(line3) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line3.nil? && line3 !~ pattern + fail ArgumentError, "invalid value for \"line3\", must conform to the pattern #{pattern}." + end + + @line3 = line3 + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flat_number == o.flat_number && + building_number == o.building_number && + building_name == o.building_name && + street == o.street && + sub_street == o.sub_street && + town == o.town && + postcode == o.postcode && + country == o.country && + state == o.state && + line1 == o.line1 && + line2 == o.line2 && + line3 == o.line3 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flat_number, building_number, building_name, street, sub_street, town, postcode, country, state, line1, line2, line3].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/address_shared.rb b/lib/onfido/models/address_shared.rb new file mode 100644 index 0000000..a8e5574 --- /dev/null +++ b/lib/onfido/models/address_shared.rb @@ -0,0 +1,415 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class AddressShared + # The flat number of this address + attr_accessor :flat_number + + # The building number of this address + attr_accessor :building_number + + # The building name of this address + attr_accessor :building_name + + # The street of the applicant's address + attr_accessor :street + + # The sub-street of the applicant's address + attr_accessor :sub_street + + # The town of the applicant's address + attr_accessor :town + + # The postcode or ZIP of the applicant's address + attr_accessor :postcode + + # The 3 character ISO country code of this address. For example, GBR is the country code for the United Kingdom + attr_accessor :country + + # The address state. US states must use the USPS abbreviation (see also ISO 3166-2:US), for example AK, CA, or TX. + attr_accessor :state + + # Line 1 of the applicant's address + attr_accessor :line1 + + # Line 2 of the applicant's address + attr_accessor :line2 + + # Line 3 of the applicant's address + attr_accessor :line3 + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flat_number' => :'flat_number', + :'building_number' => :'building_number', + :'building_name' => :'building_name', + :'street' => :'street', + :'sub_street' => :'sub_street', + :'town' => :'town', + :'postcode' => :'postcode', + :'country' => :'country', + :'state' => :'state', + :'line1' => :'line1', + :'line2' => :'line2', + :'line3' => :'line3' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'flat_number' => :'String', + :'building_number' => :'String', + :'building_name' => :'String', + :'street' => :'String', + :'sub_street' => :'String', + :'town' => :'String', + :'postcode' => :'String', + :'country' => :'CountryCodes', + :'state' => :'String', + :'line1' => :'String', + :'line2' => :'String', + :'line3' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'line1', + :'line2', + :'line3' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::AddressShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + 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 + end + h[k.to_sym] = v + } + + if attributes.key?(:'flat_number') + self.flat_number = attributes[:'flat_number'] + end + + if attributes.key?(:'building_number') + self.building_number = attributes[:'building_number'] + end + + if attributes.key?(:'building_name') + self.building_name = attributes[:'building_name'] + end + + if attributes.key?(:'street') + self.street = attributes[:'street'] + end + + if attributes.key?(:'sub_street') + self.sub_street = attributes[:'sub_street'] + end + + if attributes.key?(:'town') + self.town = attributes[:'town'] + end + + if attributes.key?(:'postcode') + self.postcode = attributes[:'postcode'] + else + self.postcode = nil + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + else + self.country = nil + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'line1') + self.line1 = attributes[:'line1'] + end + + if attributes.key?(:'line2') + self.line2 = attributes[:'line2'] + end + + if attributes.key?(:'line3') + self.line3 = attributes[:'line3'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @postcode.nil? + invalid_properties.push('invalid value for "postcode", postcode cannot be nil.') + end + + if @country.nil? + invalid_properties.push('invalid value for "country", country cannot be nil.') + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line1.nil? && @line1 !~ pattern + invalid_properties.push("invalid value for \"line1\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line2.nil? && @line2 !~ pattern + invalid_properties.push("invalid value for \"line2\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !@line3.nil? && @line3 !~ pattern + invalid_properties.push("invalid value for \"line3\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @postcode.nil? + return false if @country.nil? + return false if !@line1.nil? && @line1 !~ Regexp.new(/^[^!$%^*=<>]*$/) + return false if !@line2.nil? && @line2 !~ Regexp.new(/^[^!$%^*=<>]*$/) + return false if !@line3.nil? && @line3 !~ Regexp.new(/^[^!$%^*=<>]*$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] line1 Value to be assigned + def line1=(line1) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line1.nil? && line1 !~ pattern + fail ArgumentError, "invalid value for \"line1\", must conform to the pattern #{pattern}." + end + + @line1 = line1 + end + + # Custom attribute writer method with validation + # @param [Object] line2 Value to be assigned + def line2=(line2) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line2.nil? && line2 !~ pattern + fail ArgumentError, "invalid value for \"line2\", must conform to the pattern #{pattern}." + end + + @line2 = line2 + end + + # Custom attribute writer method with validation + # @param [Object] line3 Value to be assigned + def line3=(line3) + pattern = Regexp.new(/^[^!$%^*=<>]*$/) + if !line3.nil? && line3 !~ pattern + fail ArgumentError, "invalid value for \"line3\", must conform to the pattern #{pattern}." + end + + @line3 = line3 + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flat_number == o.flat_number && + building_number == o.building_number && + building_name == o.building_name && + street == o.street && + sub_street == o.sub_street && + town == o.town && + postcode == o.postcode && + country == o.country && + state == o.state && + line1 == o.line1 && + line2 == o.line2 && + line3 == o.line3 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flat_number, building_number, building_name, street, sub_street, town, postcode, country, state, line1, line2, line3].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/addresses_list.rb b/lib/onfido/models/addresses_list.rb new file mode 100644 index 0000000..d722e6a --- /dev/null +++ b/lib/onfido/models/addresses_list.rb @@ -0,0 +1,216 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class AddressesList + attr_accessor :addresses + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'addresses' => :'addresses' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'addresses' => :'Array
' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::AddressesList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + 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 + end + h[k.to_sym] = v + } + + if attributes.key?(:'addresses') + if (value = attributes[:'addresses']).is_a?(Array) + self.addresses = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + addresses == o.addresses + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [addresses].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicant.rb b/lib/onfido/models/applicant.rb new file mode 100644 index 0000000..7c1ec30 --- /dev/null +++ b/lib/onfido/models/applicant.rb @@ -0,0 +1,390 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Applicant + # The applicant's email address. Required if doing a US check, or a UK check for which `applicant_provides_data` is `true`. + attr_accessor :email + + # The applicant's date of birth + attr_accessor :dob + + attr_accessor :id_numbers + + # The applicant's phone number + attr_accessor :phone_number + + # The applicant's first name + attr_accessor :first_name + + # The applicant's surname + attr_accessor :last_name + + # The unique identifier for the applicant. + attr_accessor :id + + # The date and time when this applicant was created. + attr_accessor :created_at + + # The date and time when this applicant is scheduled to be deleted. + attr_accessor :delete_at + + # The uri of this resource. + attr_accessor :href + + attr_accessor :sandbox + + attr_accessor :address + + attr_accessor :location + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email', + :'dob' => :'dob', + :'id_numbers' => :'id_numbers', + :'phone_number' => :'phone_number', + :'first_name' => :'first_name', + :'last_name' => :'last_name', + :'id' => :'id', + :'created_at' => :'created_at', + :'delete_at' => :'delete_at', + :'href' => :'href', + :'sandbox' => :'sandbox', + :'address' => :'address', + :'location' => :'location' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'String', + :'dob' => :'Date', + :'id_numbers' => :'Array', + :'phone_number' => :'String', + :'first_name' => :'String', + :'last_name' => :'String', + :'id' => :'String', + :'created_at' => :'Time', + :'delete_at' => :'Time', + :'href' => :'String', + :'sandbox' => :'Boolean', + :'address' => :'Address', + :'location' => :'Location' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ApplicantResponse', + :'ApplicantShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Applicant` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Applicant`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'dob') + self.dob = attributes[:'dob'] + end + + if attributes.key?(:'id_numbers') + if (value = attributes[:'id_numbers']).is_a?(Array) + self.id_numbers = value + end + end + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'delete_at') + self.delete_at = attributes[:'delete_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'sandbox') + self.sandbox = attributes[:'sandbox'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'location') + self.location = attributes[:'location'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if !@first_name.nil? && @first_name !~ pattern + invalid_properties.push("invalid value for \"first_name\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if !@last_name.nil? && @last_name !~ pattern + invalid_properties.push("invalid value for \"last_name\", must conform to the pattern #{pattern}.") + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@first_name.nil? && @first_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + return false if !@last_name.nil? && @last_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + return false if @id.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] first_name Value to be assigned + def first_name=(first_name) + if first_name.nil? + fail ArgumentError, 'first_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if first_name !~ pattern + fail ArgumentError, "invalid value for \"first_name\", must conform to the pattern #{pattern}." + end + + @first_name = first_name + end + + # Custom attribute writer method with validation + # @param [Object] last_name Value to be assigned + def last_name=(last_name) + if last_name.nil? + fail ArgumentError, 'last_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if last_name !~ pattern + fail ArgumentError, "invalid value for \"last_name\", must conform to the pattern #{pattern}." + end + + @last_name = last_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + dob == o.dob && + id_numbers == o.id_numbers && + phone_number == o.phone_number && + first_name == o.first_name && + last_name == o.last_name && + id == o.id && + created_at == o.created_at && + delete_at == o.delete_at && + href == o.href && + sandbox == o.sandbox && + address == o.address && + location == o.location + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [email, dob, id_numbers, phone_number, first_name, last_name, id, created_at, delete_at, href, sandbox, address, location].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicant_builder.rb b/lib/onfido/models/applicant_builder.rb new file mode 100644 index 0000000..3f6e3b6 --- /dev/null +++ b/lib/onfido/models/applicant_builder.rb @@ -0,0 +1,358 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ApplicantBuilder + # The applicant's email address. Required if doing a US check, or a UK check for which `applicant_provides_data` is `true`. + attr_accessor :email + + # The applicant's date of birth + attr_accessor :dob + + attr_accessor :id_numbers + + # The applicant's phone number + attr_accessor :phone_number + + attr_accessor :consents + + attr_accessor :address + + attr_accessor :location + + # The applicant's first name + attr_accessor :first_name + + # The applicant's surname + attr_accessor :last_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email', + :'dob' => :'dob', + :'id_numbers' => :'id_numbers', + :'phone_number' => :'phone_number', + :'consents' => :'consents', + :'address' => :'address', + :'location' => :'location', + :'first_name' => :'first_name', + :'last_name' => :'last_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'String', + :'dob' => :'Date', + :'id_numbers' => :'Array', + :'phone_number' => :'String', + :'consents' => :'ConsentsBuilder', + :'address' => :'AddressBuilder', + :'location' => :'LocationBuilder', + :'first_name' => :'String', + :'last_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ApplicantCreate', + :'ApplicantRequest', + :'ApplicantShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ApplicantBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ApplicantBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'dob') + self.dob = attributes[:'dob'] + end + + if attributes.key?(:'id_numbers') + if (value = attributes[:'id_numbers']).is_a?(Array) + self.id_numbers = value + end + end + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + + if attributes.key?(:'consents') + self.consents = attributes[:'consents'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'location') + self.location = attributes[:'location'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + else + self.first_name = nil + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + else + self.last_name = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @first_name.nil? + invalid_properties.push('invalid value for "first_name", first_name cannot be nil.') + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if @first_name !~ pattern + invalid_properties.push("invalid value for \"first_name\", must conform to the pattern #{pattern}.") + end + + if @last_name.nil? + invalid_properties.push('invalid value for "last_name", last_name cannot be nil.') + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if @last_name !~ pattern + invalid_properties.push("invalid value for \"last_name\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @first_name.nil? + return false if @first_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + return false if @last_name.nil? + return false if @last_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] first_name Value to be assigned + def first_name=(first_name) + if first_name.nil? + fail ArgumentError, 'first_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if first_name !~ pattern + fail ArgumentError, "invalid value for \"first_name\", must conform to the pattern #{pattern}." + end + + @first_name = first_name + end + + # Custom attribute writer method with validation + # @param [Object] last_name Value to be assigned + def last_name=(last_name) + if last_name.nil? + fail ArgumentError, 'last_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if last_name !~ pattern + fail ArgumentError, "invalid value for \"last_name\", must conform to the pattern #{pattern}." + end + + @last_name = last_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + dob == o.dob && + id_numbers == o.id_numbers && + phone_number == o.phone_number && + consents == o.consents && + address == o.address && + location == o.location && + first_name == o.first_name && + last_name == o.last_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [email, dob, id_numbers, phone_number, consents, address, location, first_name, last_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicant_create.rb b/lib/onfido/models/applicant_create.rb new file mode 100644 index 0000000..b5a924e --- /dev/null +++ b/lib/onfido/models/applicant_create.rb @@ -0,0 +1,281 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ApplicantCreate + # The applicant's first name + attr_accessor :first_name + + # The applicant's surname + attr_accessor :last_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'first_name' => :'first_name', + :'last_name' => :'last_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'first_name' => :'String', + :'last_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ApplicantCreate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ApplicantCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + else + self.first_name = nil + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + else + self.last_name = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @first_name.nil? + invalid_properties.push('invalid value for "first_name", first_name cannot be nil.') + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if @first_name !~ pattern + invalid_properties.push("invalid value for \"first_name\", must conform to the pattern #{pattern}.") + end + + if @last_name.nil? + invalid_properties.push('invalid value for "last_name", last_name cannot be nil.') + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if @last_name !~ pattern + invalid_properties.push("invalid value for \"last_name\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @first_name.nil? + return false if @first_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + return false if @last_name.nil? + return false if @last_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] first_name Value to be assigned + def first_name=(first_name) + if first_name.nil? + fail ArgumentError, 'first_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if first_name !~ pattern + fail ArgumentError, "invalid value for \"first_name\", must conform to the pattern #{pattern}." + end + + @first_name = first_name + end + + # Custom attribute writer method with validation + # @param [Object] last_name Value to be assigned + def last_name=(last_name) + if last_name.nil? + fail ArgumentError, 'last_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if last_name !~ pattern + fail ArgumentError, "invalid value for \"last_name\", must conform to the pattern #{pattern}." + end + + @last_name = last_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_name == o.first_name && + last_name == o.last_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [first_name, last_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicant_request.rb b/lib/onfido/models/applicant_request.rb new file mode 100644 index 0000000..750d028 --- /dev/null +++ b/lib/onfido/models/applicant_request.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ApplicantRequest + attr_accessor :consents + + attr_accessor :address + + attr_accessor :location + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'consents' => :'consents', + :'address' => :'address', + :'location' => :'location' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'consents' => :'ConsentsBuilder', + :'address' => :'AddressBuilder', + :'location' => :'LocationBuilder' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ApplicantRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ApplicantRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'consents') + self.consents = attributes[:'consents'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'location') + self.location = attributes[:'location'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + consents == o.consents && + address == o.address && + location == o.location + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [consents, address, location].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicant_response.rb b/lib/onfido/models/applicant_response.rb new file mode 100644 index 0000000..66f63e8 --- /dev/null +++ b/lib/onfido/models/applicant_response.rb @@ -0,0 +1,341 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ApplicantResponse + # The applicant's first name + attr_accessor :first_name + + # The applicant's surname + attr_accessor :last_name + + # The unique identifier for the applicant. + attr_accessor :id + + # The date and time when this applicant was created. + attr_accessor :created_at + + # The date and time when this applicant is scheduled to be deleted. + attr_accessor :delete_at + + # The uri of this resource. + attr_accessor :href + + attr_accessor :sandbox + + attr_accessor :address + + attr_accessor :location + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'first_name' => :'first_name', + :'last_name' => :'last_name', + :'id' => :'id', + :'created_at' => :'created_at', + :'delete_at' => :'delete_at', + :'href' => :'href', + :'sandbox' => :'sandbox', + :'address' => :'address', + :'location' => :'location' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'first_name' => :'String', + :'last_name' => :'String', + :'id' => :'String', + :'created_at' => :'Time', + :'delete_at' => :'Time', + :'href' => :'String', + :'sandbox' => :'Boolean', + :'address' => :'Address', + :'location' => :'Location' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ApplicantResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ApplicantResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'delete_at') + self.delete_at = attributes[:'delete_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'sandbox') + self.sandbox = attributes[:'sandbox'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'location') + self.location = attributes[:'location'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if !@first_name.nil? && @first_name !~ pattern + invalid_properties.push("invalid value for \"first_name\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if !@last_name.nil? && @last_name !~ pattern + invalid_properties.push("invalid value for \"last_name\", must conform to the pattern #{pattern}.") + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@first_name.nil? && @first_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + return false if !@last_name.nil? && @last_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + return false if @id.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] first_name Value to be assigned + def first_name=(first_name) + if first_name.nil? + fail ArgumentError, 'first_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if first_name !~ pattern + fail ArgumentError, "invalid value for \"first_name\", must conform to the pattern #{pattern}." + end + + @first_name = first_name + end + + # Custom attribute writer method with validation + # @param [Object] last_name Value to be assigned + def last_name=(last_name) + if last_name.nil? + fail ArgumentError, 'last_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if last_name !~ pattern + fail ArgumentError, "invalid value for \"last_name\", must conform to the pattern #{pattern}." + end + + @last_name = last_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_name == o.first_name && + last_name == o.last_name && + id == o.id && + created_at == o.created_at && + delete_at == o.delete_at && + href == o.href && + sandbox == o.sandbox && + address == o.address && + location == o.location + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [first_name, last_name, id, created_at, delete_at, href, sandbox, address, location].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicant_shared.rb b/lib/onfido/models/applicant_shared.rb new file mode 100644 index 0000000..e453dfc --- /dev/null +++ b/lib/onfido/models/applicant_shared.rb @@ -0,0 +1,246 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ApplicantShared + # The applicant's email address. Required if doing a US check, or a UK check for which `applicant_provides_data` is `true`. + attr_accessor :email + + # The applicant's date of birth + attr_accessor :dob + + attr_accessor :id_numbers + + # The applicant's phone number + attr_accessor :phone_number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email', + :'dob' => :'dob', + :'id_numbers' => :'id_numbers', + :'phone_number' => :'phone_number' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'String', + :'dob' => :'Date', + :'id_numbers' => :'Array', + :'phone_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ApplicantShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ApplicantShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'dob') + self.dob = attributes[:'dob'] + end + + if attributes.key?(:'id_numbers') + if (value = attributes[:'id_numbers']).is_a?(Array) + self.id_numbers = value + end + end + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + dob == o.dob && + id_numbers == o.id_numbers && + phone_number == o.phone_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [email, dob, id_numbers, phone_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicant_update.rb b/lib/onfido/models/applicant_update.rb new file mode 100644 index 0000000..5b47d8a --- /dev/null +++ b/lib/onfido/models/applicant_update.rb @@ -0,0 +1,267 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ApplicantUpdate + # The applicant's first name + attr_accessor :first_name + + # The applicant's surname + attr_accessor :last_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'first_name' => :'first_name', + :'last_name' => :'last_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'first_name' => :'String', + :'last_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ApplicantUpdate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ApplicantUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if !@first_name.nil? && @first_name !~ pattern + invalid_properties.push("invalid value for \"first_name\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if !@last_name.nil? && @last_name !~ pattern + invalid_properties.push("invalid value for \"last_name\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@first_name.nil? && @first_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + return false if !@last_name.nil? && @last_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] first_name Value to be assigned + def first_name=(first_name) + if first_name.nil? + fail ArgumentError, 'first_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if first_name !~ pattern + fail ArgumentError, "invalid value for \"first_name\", must conform to the pattern #{pattern}." + end + + @first_name = first_name + end + + # Custom attribute writer method with validation + # @param [Object] last_name Value to be assigned + def last_name=(last_name) + if last_name.nil? + fail ArgumentError, 'last_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if last_name !~ pattern + fail ArgumentError, "invalid value for \"last_name\", must conform to the pattern #{pattern}." + end + + @last_name = last_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_name == o.first_name && + last_name == o.last_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [first_name, last_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicant_updater.rb b/lib/onfido/models/applicant_updater.rb new file mode 100644 index 0000000..1bebd32 --- /dev/null +++ b/lib/onfido/models/applicant_updater.rb @@ -0,0 +1,344 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ApplicantUpdater + # The applicant's email address. Required if doing a US check, or a UK check for which `applicant_provides_data` is `true`. + attr_accessor :email + + # The applicant's date of birth + attr_accessor :dob + + attr_accessor :id_numbers + + # The applicant's phone number + attr_accessor :phone_number + + attr_accessor :consents + + attr_accessor :address + + attr_accessor :location + + # The applicant's first name + attr_accessor :first_name + + # The applicant's surname + attr_accessor :last_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email', + :'dob' => :'dob', + :'id_numbers' => :'id_numbers', + :'phone_number' => :'phone_number', + :'consents' => :'consents', + :'address' => :'address', + :'location' => :'location', + :'first_name' => :'first_name', + :'last_name' => :'last_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'String', + :'dob' => :'Date', + :'id_numbers' => :'Array', + :'phone_number' => :'String', + :'consents' => :'ConsentsBuilder', + :'address' => :'AddressBuilder', + :'location' => :'LocationBuilder', + :'first_name' => :'String', + :'last_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ApplicantRequest', + :'ApplicantShared', + :'ApplicantUpdate' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ApplicantUpdater` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ApplicantUpdater`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'dob') + self.dob = attributes[:'dob'] + end + + if attributes.key?(:'id_numbers') + if (value = attributes[:'id_numbers']).is_a?(Array) + self.id_numbers = value + end + end + + if attributes.key?(:'phone_number') + self.phone_number = attributes[:'phone_number'] + end + + if attributes.key?(:'consents') + self.consents = attributes[:'consents'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'location') + self.location = attributes[:'location'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if !@first_name.nil? && @first_name !~ pattern + invalid_properties.push("invalid value for \"first_name\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if !@last_name.nil? && @last_name !~ pattern + invalid_properties.push("invalid value for \"last_name\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@first_name.nil? && @first_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + return false if !@last_name.nil? && @last_name !~ Regexp.new(/^[^!#$%*=<>;{}"]*$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] first_name Value to be assigned + def first_name=(first_name) + if first_name.nil? + fail ArgumentError, 'first_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if first_name !~ pattern + fail ArgumentError, "invalid value for \"first_name\", must conform to the pattern #{pattern}." + end + + @first_name = first_name + end + + # Custom attribute writer method with validation + # @param [Object] last_name Value to be assigned + def last_name=(last_name) + if last_name.nil? + fail ArgumentError, 'last_name cannot be nil' + end + + pattern = Regexp.new(/^[^!#$%*=<>;{}"]*$/) + if last_name !~ pattern + fail ArgumentError, "invalid value for \"last_name\", must conform to the pattern #{pattern}." + end + + @last_name = last_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + dob == o.dob && + id_numbers == o.id_numbers && + phone_number == o.phone_number && + consents == o.consents && + address == o.address && + location == o.location && + first_name == o.first_name && + last_name == o.last_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [email, dob, id_numbers, phone_number, consents, address, location, first_name, last_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/applicants_list.rb b/lib/onfido/models/applicants_list.rb new file mode 100644 index 0000000..7f74df7 --- /dev/null +++ b/lib/onfido/models/applicants_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ApplicantsList + attr_accessor :applicants + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'applicants' => :'applicants' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'applicants' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ApplicantsList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ApplicantsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'applicants') + if (value = attributes[:'applicants']).is_a?(Array) + self.applicants = value + end + else + self.applicants = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicants.nil? + invalid_properties.push('invalid value for "applicants", applicants cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicants.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + applicants == o.applicants + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [applicants].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/check.rb b/lib/onfido/models/check.rb new file mode 100644 index 0000000..1015917 --- /dev/null +++ b/lib/onfido/models/check.rb @@ -0,0 +1,419 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Check + # An array of webhook ids describing which webhooks to trigger for this check. + attr_accessor :webhook_ids + + # The ID of the applicant to do the check on. + attr_accessor :applicant_id + + # Send an applicant form to applicant to complete to proceed with check. Defaults to false. + attr_accessor :applicant_provides_data + + # Array of tags being assigned to this check. + attr_accessor :tags + + # For checks where `applicant_provides_data` is `true`, redirect to this URI when the applicant has submitted their data. + attr_accessor :redirect_uri + + # The unique identifier for the check. + attr_accessor :id + + # The date and time when this check was created. + attr_accessor :created_at + + # The uri of this resource. + attr_accessor :href + + # The current state of the check in the checking process. + attr_accessor :status + + # The overall result of the check, based on the results of the constituent reports. + attr_accessor :result + + # A link to the applicant form, if `applicant_provides_data` is `true`. + attr_accessor :form_uri + + # A link to the corresponding results page on the Onfido dashboard. + attr_accessor :results_uri + + # An array of report ids. + attr_accessor :report_ids + + # Indicates whether the object was created in the sandbox or not. + attr_accessor :sandbox + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'webhook_ids' => :'webhook_ids', + :'applicant_id' => :'applicant_id', + :'applicant_provides_data' => :'applicant_provides_data', + :'tags' => :'tags', + :'redirect_uri' => :'redirect_uri', + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'form_uri' => :'form_uri', + :'results_uri' => :'results_uri', + :'report_ids' => :'report_ids', + :'sandbox' => :'sandbox' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'webhook_ids' => :'Array', + :'applicant_id' => :'String', + :'applicant_provides_data' => :'Boolean', + :'tags' => :'Array', + :'redirect_uri' => :'String', + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'String', + :'result' => :'String', + :'form_uri' => :'String', + :'results_uri' => :'String', + :'report_ids' => :'Array', + :'sandbox' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CheckResponse', + :'CheckShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Check` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Check`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'webhook_ids') + if (value = attributes[:'webhook_ids']).is_a?(Array) + self.webhook_ids = value + end + end + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'applicant_provides_data') + self.applicant_provides_data = attributes[:'applicant_provides_data'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'redirect_uri') + self.redirect_uri = attributes[:'redirect_uri'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'form_uri') + self.form_uri = attributes[:'form_uri'] + end + + if attributes.key?(:'results_uri') + self.results_uri = attributes[:'results_uri'] + end + + if attributes.key?(:'report_ids') + if (value = attributes[:'report_ids']).is_a?(Array) + self.report_ids = value + end + end + + if attributes.key?(:'sandbox') + self.sandbox = attributes[:'sandbox'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + return false if @id.nil? + status_validator = EnumAttributeValidator.new('String', ["in_progress", "awaiting_applicant", "complete", "withdrawn", "paused", "reopened", "unknown_default_open_api"]) + return false unless status_validator.valid?(@status) + result_validator = EnumAttributeValidator.new('String', ["clear", "consider", "unknown_default_open_api"]) + return false unless result_validator.valid?(@result) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["in_progress", "awaiting_applicant", "complete", "withdrawn", "paused", "reopened", "unknown_default_open_api"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] result Object to be assigned + def result=(result) + validator = EnumAttributeValidator.new('String', ["clear", "consider", "unknown_default_open_api"]) + unless validator.valid?(result) + fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." + end + @result = result + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + webhook_ids == o.webhook_ids && + applicant_id == o.applicant_id && + applicant_provides_data == o.applicant_provides_data && + tags == o.tags && + redirect_uri == o.redirect_uri && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + form_uri == o.form_uri && + results_uri == o.results_uri && + report_ids == o.report_ids && + sandbox == o.sandbox + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [webhook_ids, applicant_id, applicant_provides_data, tags, redirect_uri, id, created_at, href, status, result, form_uri, results_uri, report_ids, sandbox].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/check_builder.rb b/lib/onfido/models/check_builder.rb new file mode 100644 index 0000000..11ddf39 --- /dev/null +++ b/lib/onfido/models/check_builder.rb @@ -0,0 +1,360 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class CheckBuilder + # An array of webhook ids describing which webhooks to trigger for this check. + attr_accessor :webhook_ids + + # The ID of the applicant to do the check on. + attr_accessor :applicant_id + + # Send an applicant form to applicant to complete to proceed with check. Defaults to false. + attr_accessor :applicant_provides_data + + # Array of tags being assigned to this check. + attr_accessor :tags + + # For checks where `applicant_provides_data` is `true`, redirect to this URI when the applicant has submitted their data. + attr_accessor :redirect_uri + + # An array of report names (strings). + attr_accessor :report_names + + # Optional. An array of document ids, for use with Document reports only. If omitted, the Document report will use the most recently uploaded document by default. + attr_accessor :document_ids + + # Defaults to `true`. If set to `false`, you will only receive a response when all reports in your check have completed. + attr_accessor :asynchronous + + # For checks where `applicant_provides_data` is `true`, applicant form will not be automatically sent if `suppress_form_emails` is set to `true`. You can manually send the form at any time after the check has been created, using the link found in the form_uri attribute of the check object. Write-only. Defaults to false. + attr_accessor :suppress_form_emails + + # Triggers responses for particular sub-results for sandbox Document reports. + attr_accessor :sub_result + + # Array of names of particular reports to return consider as their results. This is a feature available in sandbox testing + attr_accessor :consider + + attr_accessor :us_driving_licence + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'webhook_ids' => :'webhook_ids', + :'applicant_id' => :'applicant_id', + :'applicant_provides_data' => :'applicant_provides_data', + :'tags' => :'tags', + :'redirect_uri' => :'redirect_uri', + :'report_names' => :'report_names', + :'document_ids' => :'document_ids', + :'asynchronous' => :'asynchronous', + :'suppress_form_emails' => :'suppress_form_emails', + :'sub_result' => :'sub_result', + :'consider' => :'consider', + :'us_driving_licence' => :'us_driving_licence' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'webhook_ids' => :'Array', + :'applicant_id' => :'String', + :'applicant_provides_data' => :'Boolean', + :'tags' => :'Array', + :'redirect_uri' => :'String', + :'report_names' => :'Array', + :'document_ids' => :'Array', + :'asynchronous' => :'Boolean', + :'suppress_form_emails' => :'Boolean', + :'sub_result' => :'String', + :'consider' => :'Array', + :'us_driving_licence' => :'UsDrivingLicenceBuilder' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CheckRequest', + :'CheckShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::CheckBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::CheckBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'webhook_ids') + if (value = attributes[:'webhook_ids']).is_a?(Array) + self.webhook_ids = value + end + end + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'applicant_provides_data') + self.applicant_provides_data = attributes[:'applicant_provides_data'] + else + self.applicant_provides_data = false + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'redirect_uri') + self.redirect_uri = attributes[:'redirect_uri'] + end + + if attributes.key?(:'report_names') + if (value = attributes[:'report_names']).is_a?(Array) + self.report_names = value + end + else + self.report_names = nil + end + + if attributes.key?(:'document_ids') + if (value = attributes[:'document_ids']).is_a?(Array) + self.document_ids = value + end + end + + if attributes.key?(:'asynchronous') + self.asynchronous = attributes[:'asynchronous'] + else + self.asynchronous = true + end + + if attributes.key?(:'suppress_form_emails') + self.suppress_form_emails = attributes[:'suppress_form_emails'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'consider') + if (value = attributes[:'consider']).is_a?(Array) + self.consider = value + end + end + + if attributes.key?(:'us_driving_licence') + self.us_driving_licence = attributes[:'us_driving_licence'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + if @report_names.nil? + invalid_properties.push('invalid value for "report_names", report_names cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + return false if @report_names.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + webhook_ids == o.webhook_ids && + applicant_id == o.applicant_id && + applicant_provides_data == o.applicant_provides_data && + tags == o.tags && + redirect_uri == o.redirect_uri && + report_names == o.report_names && + document_ids == o.document_ids && + asynchronous == o.asynchronous && + suppress_form_emails == o.suppress_form_emails && + sub_result == o.sub_result && + consider == o.consider && + us_driving_licence == o.us_driving_licence + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [webhook_ids, applicant_id, applicant_provides_data, tags, redirect_uri, report_names, document_ids, asynchronous, suppress_form_emails, sub_result, consider, us_driving_licence].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/check_request.rb b/lib/onfido/models/check_request.rb new file mode 100644 index 0000000..606fc97 --- /dev/null +++ b/lib/onfido/models/check_request.rb @@ -0,0 +1,301 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class CheckRequest + # An array of report names (strings). + attr_accessor :report_names + + # Optional. An array of document ids, for use with Document reports only. If omitted, the Document report will use the most recently uploaded document by default. + attr_accessor :document_ids + + # Send an applicant form to applicant to complete to proceed with check. Defaults to false. + attr_accessor :applicant_provides_data + + # Defaults to `true`. If set to `false`, you will only receive a response when all reports in your check have completed. + attr_accessor :asynchronous + + # For checks where `applicant_provides_data` is `true`, applicant form will not be automatically sent if `suppress_form_emails` is set to `true`. You can manually send the form at any time after the check has been created, using the link found in the form_uri attribute of the check object. Write-only. Defaults to false. + attr_accessor :suppress_form_emails + + # Triggers responses for particular sub-results for sandbox Document reports. + attr_accessor :sub_result + + # Array of names of particular reports to return consider as their results. This is a feature available in sandbox testing + attr_accessor :consider + + attr_accessor :us_driving_licence + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'report_names' => :'report_names', + :'document_ids' => :'document_ids', + :'applicant_provides_data' => :'applicant_provides_data', + :'asynchronous' => :'asynchronous', + :'suppress_form_emails' => :'suppress_form_emails', + :'sub_result' => :'sub_result', + :'consider' => :'consider', + :'us_driving_licence' => :'us_driving_licence' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'report_names' => :'Array', + :'document_ids' => :'Array', + :'applicant_provides_data' => :'Boolean', + :'asynchronous' => :'Boolean', + :'suppress_form_emails' => :'Boolean', + :'sub_result' => :'String', + :'consider' => :'Array', + :'us_driving_licence' => :'UsDrivingLicenceBuilder' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::CheckRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::CheckRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'report_names') + if (value = attributes[:'report_names']).is_a?(Array) + self.report_names = value + end + else + self.report_names = nil + end + + if attributes.key?(:'document_ids') + if (value = attributes[:'document_ids']).is_a?(Array) + self.document_ids = value + end + end + + if attributes.key?(:'applicant_provides_data') + self.applicant_provides_data = attributes[:'applicant_provides_data'] + else + self.applicant_provides_data = false + end + + if attributes.key?(:'asynchronous') + self.asynchronous = attributes[:'asynchronous'] + else + self.asynchronous = true + end + + if attributes.key?(:'suppress_form_emails') + self.suppress_form_emails = attributes[:'suppress_form_emails'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'consider') + if (value = attributes[:'consider']).is_a?(Array) + self.consider = value + end + end + + if attributes.key?(:'us_driving_licence') + self.us_driving_licence = attributes[:'us_driving_licence'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @report_names.nil? + invalid_properties.push('invalid value for "report_names", report_names cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @report_names.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + report_names == o.report_names && + document_ids == o.document_ids && + applicant_provides_data == o.applicant_provides_data && + asynchronous == o.asynchronous && + suppress_form_emails == o.suppress_form_emails && + sub_result == o.sub_result && + consider == o.consider && + us_driving_licence == o.us_driving_licence + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [report_names, document_ids, applicant_provides_data, asynchronous, suppress_form_emails, sub_result, consider, us_driving_licence].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/check_response.rb b/lib/onfido/models/check_response.rb new file mode 100644 index 0000000..7cb13fe --- /dev/null +++ b/lib/onfido/models/check_response.rb @@ -0,0 +1,350 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class CheckResponse + # The unique identifier for the check. + attr_accessor :id + + # The date and time when this check was created. + attr_accessor :created_at + + # The uri of this resource. + attr_accessor :href + + # The current state of the check in the checking process. + attr_accessor :status + + # The overall result of the check, based on the results of the constituent reports. + attr_accessor :result + + # A link to the applicant form, if `applicant_provides_data` is `true`. + attr_accessor :form_uri + + # A link to the corresponding results page on the Onfido dashboard. + attr_accessor :results_uri + + # An array of report ids. + attr_accessor :report_ids + + # Indicates whether the object was created in the sandbox or not. + attr_accessor :sandbox + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'form_uri' => :'form_uri', + :'results_uri' => :'results_uri', + :'report_ids' => :'report_ids', + :'sandbox' => :'sandbox' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'String', + :'result' => :'String', + :'form_uri' => :'String', + :'results_uri' => :'String', + :'report_ids' => :'Array', + :'sandbox' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::CheckResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::CheckResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'form_uri') + self.form_uri = attributes[:'form_uri'] + end + + if attributes.key?(:'results_uri') + self.results_uri = attributes[:'results_uri'] + end + + if attributes.key?(:'report_ids') + if (value = attributes[:'report_ids']).is_a?(Array) + self.report_ids = value + end + end + + if attributes.key?(:'sandbox') + self.sandbox = attributes[:'sandbox'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + status_validator = EnumAttributeValidator.new('String', ["in_progress", "awaiting_applicant", "complete", "withdrawn", "paused", "reopened", "unknown_default_open_api"]) + return false unless status_validator.valid?(@status) + result_validator = EnumAttributeValidator.new('String', ["clear", "consider", "unknown_default_open_api"]) + return false unless result_validator.valid?(@result) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["in_progress", "awaiting_applicant", "complete", "withdrawn", "paused", "reopened", "unknown_default_open_api"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] result Object to be assigned + def result=(result) + validator = EnumAttributeValidator.new('String', ["clear", "consider", "unknown_default_open_api"]) + unless validator.valid?(result) + fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." + end + @result = result + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + form_uri == o.form_uri && + results_uri == o.results_uri && + report_ids == o.report_ids && + sandbox == o.sandbox + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, form_uri, results_uri, report_ids, sandbox].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/check_shared.rb b/lib/onfido/models/check_shared.rb new file mode 100644 index 0000000..5170229 --- /dev/null +++ b/lib/onfido/models/check_shared.rb @@ -0,0 +1,266 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class CheckShared + # An array of webhook ids describing which webhooks to trigger for this check. + attr_accessor :webhook_ids + + # The ID of the applicant to do the check on. + attr_accessor :applicant_id + + # Send an applicant form to applicant to complete to proceed with check. Defaults to false. + attr_accessor :applicant_provides_data + + # Array of tags being assigned to this check. + attr_accessor :tags + + # For checks where `applicant_provides_data` is `true`, redirect to this URI when the applicant has submitted their data. + attr_accessor :redirect_uri + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'webhook_ids' => :'webhook_ids', + :'applicant_id' => :'applicant_id', + :'applicant_provides_data' => :'applicant_provides_data', + :'tags' => :'tags', + :'redirect_uri' => :'redirect_uri' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'webhook_ids' => :'Array', + :'applicant_id' => :'String', + :'applicant_provides_data' => :'Boolean', + :'tags' => :'Array', + :'redirect_uri' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::CheckShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::CheckShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'webhook_ids') + if (value = attributes[:'webhook_ids']).is_a?(Array) + self.webhook_ids = value + end + end + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'applicant_provides_data') + self.applicant_provides_data = attributes[:'applicant_provides_data'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'redirect_uri') + self.redirect_uri = attributes[:'redirect_uri'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + webhook_ids == o.webhook_ids && + applicant_id == o.applicant_id && + applicant_provides_data == o.applicant_provides_data && + tags == o.tags && + redirect_uri == o.redirect_uri + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [webhook_ids, applicant_id, applicant_provides_data, tags, redirect_uri].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/checks_list.rb b/lib/onfido/models/checks_list.rb new file mode 100644 index 0000000..b00ce8a --- /dev/null +++ b/lib/onfido/models/checks_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ChecksList + attr_accessor :checks + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'checks' => :'checks' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'checks' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ChecksList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ChecksList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'checks') + if (value = attributes[:'checks']).is_a?(Array) + self.checks = value + end + else + self.checks = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @checks.nil? + invalid_properties.push('invalid value for "checks", checks cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @checks.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + checks == o.checks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [checks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/complete_task_request.rb b/lib/onfido/models/complete_task_request.rb new file mode 100644 index 0000000..860ad19 --- /dev/null +++ b/lib/onfido/models/complete_task_request.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class CompleteTaskRequest + # The Task completion payload. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::CompleteTaskRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::CompleteTaskRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/consent_item.rb b/lib/onfido/models/consent_item.rb new file mode 100644 index 0000000..9afdc74 --- /dev/null +++ b/lib/onfido/models/consent_item.rb @@ -0,0 +1,272 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # The applicant's consents + class ConsentItem + attr_accessor :name + + attr_accessor :granted + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'granted' => :'granted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'granted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ConsentItem` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ConsentItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'granted') + self.granted = attributes[:'granted'] + else + self.granted = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @granted.nil? + invalid_properties.push('invalid value for "granted", granted cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @name.nil? + name_validator = EnumAttributeValidator.new('String', ["privacy_notices_read", "ssn_verification", "phone_number_verification", "unknown_default_open_api"]) + return false unless name_validator.valid?(@name) + return false if @granted.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] name Object to be assigned + def name=(name) + validator = EnumAttributeValidator.new('String', ["privacy_notices_read", "ssn_verification", "phone_number_verification", "unknown_default_open_api"]) + unless validator.valid?(name) + fail ArgumentError, "invalid value for \"name\", must be one of #{validator.allowable_values}." + end + @name = name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + granted == o.granted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, granted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/consents_builder.rb b/lib/onfido/models/consents_builder.rb new file mode 100644 index 0000000..af191fa --- /dev/null +++ b/lib/onfido/models/consents_builder.rb @@ -0,0 +1,205 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ConsentsBuilder + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ConsentsBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ConsentsBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/country_codes.rb b/lib/onfido/models/country_codes.rb new file mode 100644 index 0000000..6b3d1ad --- /dev/null +++ b/lib/onfido/models/country_codes.rb @@ -0,0 +1,289 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class CountryCodes + ABW = "ABW".freeze + AFG = "AFG".freeze + AGO = "AGO".freeze + AIA = "AIA".freeze + ALA = "ALA".freeze + ALB = "ALB".freeze + AND = "AND".freeze + ARE = "ARE".freeze + ARG = "ARG".freeze + ARM = "ARM".freeze + ASM = "ASM".freeze + ATA = "ATA".freeze + ATF = "ATF".freeze + ATG = "ATG".freeze + AUS = "AUS".freeze + AUT = "AUT".freeze + AZE = "AZE".freeze + BDI = "BDI".freeze + BEL = "BEL".freeze + BEN = "BEN".freeze + BES = "BES".freeze + BFA = "BFA".freeze + BGD = "BGD".freeze + BGR = "BGR".freeze + BHR = "BHR".freeze + BHS = "BHS".freeze + BIH = "BIH".freeze + BLM = "BLM".freeze + BLR = "BLR".freeze + BLZ = "BLZ".freeze + BMU = "BMU".freeze + BOL = "BOL".freeze + BRA = "BRA".freeze + BRB = "BRB".freeze + BRN = "BRN".freeze + BTN = "BTN".freeze + BVT = "BVT".freeze + BWA = "BWA".freeze + CAF = "CAF".freeze + CAN = "CAN".freeze + CCK = "CCK".freeze + CHE = "CHE".freeze + CHL = "CHL".freeze + CHN = "CHN".freeze + CIV = "CIV".freeze + CMR = "CMR".freeze + COD = "COD".freeze + COG = "COG".freeze + COK = "COK".freeze + COL = "COL".freeze + COM = "COM".freeze + CPV = "CPV".freeze + CRI = "CRI".freeze + CUB = "CUB".freeze + CUW = "CUW".freeze + CXR = "CXR".freeze + CYM = "CYM".freeze + CYP = "CYP".freeze + CZE = "CZE".freeze + DEU = "DEU".freeze + DJI = "DJI".freeze + DMA = "DMA".freeze + DNK = "DNK".freeze + DOM = "DOM".freeze + DZA = "DZA".freeze + ECU = "ECU".freeze + EGY = "EGY".freeze + ERI = "ERI".freeze + ESH = "ESH".freeze + ESP = "ESP".freeze + EST = "EST".freeze + ETH = "ETH".freeze + FIN = "FIN".freeze + FJI = "FJI".freeze + FLK = "FLK".freeze + FRA = "FRA".freeze + FRO = "FRO".freeze + FSM = "FSM".freeze + GAB = "GAB".freeze + GBR = "GBR".freeze + GEO = "GEO".freeze + GGY = "GGY".freeze + GHA = "GHA".freeze + GIB = "GIB".freeze + GIN = "GIN".freeze + GLP = "GLP".freeze + GMB = "GMB".freeze + GNB = "GNB".freeze + GNQ = "GNQ".freeze + GRC = "GRC".freeze + GRD = "GRD".freeze + GRL = "GRL".freeze + GTM = "GTM".freeze + GUF = "GUF".freeze + GUM = "GUM".freeze + GUY = "GUY".freeze + HKG = "HKG".freeze + HMD = "HMD".freeze + HND = "HND".freeze + HRV = "HRV".freeze + HTI = "HTI".freeze + HUN = "HUN".freeze + IDN = "IDN".freeze + IMN = "IMN".freeze + IND = "IND".freeze + IOT = "IOT".freeze + IRL = "IRL".freeze + IRN = "IRN".freeze + IRQ = "IRQ".freeze + ISL = "ISL".freeze + ISR = "ISR".freeze + ITA = "ITA".freeze + JAM = "JAM".freeze + JEY = "JEY".freeze + JOR = "JOR".freeze + JPN = "JPN".freeze + KAZ = "KAZ".freeze + KEN = "KEN".freeze + KGZ = "KGZ".freeze + KHM = "KHM".freeze + KIR = "KIR".freeze + KNA = "KNA".freeze + KOR = "KOR".freeze + KWT = "KWT".freeze + LAO = "LAO".freeze + LBN = "LBN".freeze + LBR = "LBR".freeze + LBY = "LBY".freeze + LCA = "LCA".freeze + LIE = "LIE".freeze + LKA = "LKA".freeze + LSO = "LSO".freeze + LTU = "LTU".freeze + LUX = "LUX".freeze + LVA = "LVA".freeze + MAC = "MAC".freeze + MAF = "MAF".freeze + MAR = "MAR".freeze + MCO = "MCO".freeze + MDA = "MDA".freeze + MDG = "MDG".freeze + MDV = "MDV".freeze + MEX = "MEX".freeze + MHL = "MHL".freeze + MKD = "MKD".freeze + MLI = "MLI".freeze + MLT = "MLT".freeze + MMR = "MMR".freeze + MNE = "MNE".freeze + MNG = "MNG".freeze + MNP = "MNP".freeze + MOZ = "MOZ".freeze + MRT = "MRT".freeze + MSR = "MSR".freeze + MTQ = "MTQ".freeze + MUS = "MUS".freeze + MWI = "MWI".freeze + MYS = "MYS".freeze + MYT = "MYT".freeze + NAM = "NAM".freeze + NCL = "NCL".freeze + NER = "NER".freeze + NFK = "NFK".freeze + NGA = "NGA".freeze + NIC = "NIC".freeze + NIU = "NIU".freeze + NLD = "NLD".freeze + NOR = "NOR".freeze + NPL = "NPL".freeze + NRU = "NRU".freeze + NZL = "NZL".freeze + OMN = "OMN".freeze + PAK = "PAK".freeze + PAN = "PAN".freeze + PCN = "PCN".freeze + PER = "PER".freeze + PHL = "PHL".freeze + PLW = "PLW".freeze + PNG = "PNG".freeze + POL = "POL".freeze + PRI = "PRI".freeze + PRK = "PRK".freeze + PRT = "PRT".freeze + PRY = "PRY".freeze + PSE = "PSE".freeze + PYF = "PYF".freeze + QAT = "QAT".freeze + REU = "REU".freeze + RKS = "RKS".freeze + ROU = "ROU".freeze + RUS = "RUS".freeze + RWA = "RWA".freeze + SAU = "SAU".freeze + SDN = "SDN".freeze + SEN = "SEN".freeze + SGP = "SGP".freeze + SGS = "SGS".freeze + SHN = "SHN".freeze + SJM = "SJM".freeze + SLB = "SLB".freeze + SLE = "SLE".freeze + SLV = "SLV".freeze + SMR = "SMR".freeze + SOM = "SOM".freeze + SPM = "SPM".freeze + SRB = "SRB".freeze + SSD = "SSD".freeze + STP = "STP".freeze + SUR = "SUR".freeze + SVK = "SVK".freeze + SVN = "SVN".freeze + SWE = "SWE".freeze + SWZ = "SWZ".freeze + SXM = "SXM".freeze + SYC = "SYC".freeze + SYR = "SYR".freeze + TCA = "TCA".freeze + TCD = "TCD".freeze + TGO = "TGO".freeze + THA = "THA".freeze + TJK = "TJK".freeze + TKL = "TKL".freeze + TKM = "TKM".freeze + TLS = "TLS".freeze + TON = "TON".freeze + TTO = "TTO".freeze + TUN = "TUN".freeze + TUR = "TUR".freeze + TUV = "TUV".freeze + TWN = "TWN".freeze + TZA = "TZA".freeze + UGA = "UGA".freeze + UKR = "UKR".freeze + UMI = "UMI".freeze + URY = "URY".freeze + USA = "USA".freeze + UZB = "UZB".freeze + VAT = "VAT".freeze + VCT = "VCT".freeze + VEN = "VEN".freeze + VGB = "VGB".freeze + VIR = "VIR".freeze + VNM = "VNM".freeze + VUT = "VUT".freeze + WLF = "WLF".freeze + WSM = "WSM".freeze + YEM = "YEM".freeze + ZAF = "ZAF".freeze + ZMB = "ZMB".freeze + ZWE = "ZWE".freeze + UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze + + def self.all_vars + @all_vars ||= [ABW, AFG, AGO, AIA, ALA, ALB, AND, ARE, ARG, ARM, ASM, ATA, ATF, ATG, AUS, AUT, AZE, BDI, BEL, BEN, BES, BFA, BGD, BGR, BHR, BHS, BIH, BLM, BLR, BLZ, BMU, BOL, BRA, BRB, BRN, BTN, BVT, BWA, CAF, CAN, CCK, CHE, CHL, CHN, CIV, CMR, COD, COG, COK, COL, COM, CPV, CRI, CUB, CUW, CXR, CYM, CYP, CZE, DEU, DJI, DMA, DNK, DOM, DZA, ECU, EGY, ERI, ESH, ESP, EST, ETH, FIN, FJI, FLK, FRA, FRO, FSM, GAB, GBR, GEO, GGY, GHA, GIB, GIN, GLP, GMB, GNB, GNQ, GRC, GRD, GRL, GTM, GUF, GUM, GUY, HKG, HMD, HND, HRV, HTI, HUN, IDN, IMN, IND, IOT, IRL, IRN, IRQ, ISL, ISR, ITA, JAM, JEY, JOR, JPN, KAZ, KEN, KGZ, KHM, KIR, KNA, KOR, KWT, LAO, LBN, LBR, LBY, LCA, LIE, LKA, LSO, LTU, LUX, LVA, MAC, MAF, MAR, MCO, MDA, MDG, MDV, MEX, MHL, MKD, MLI, MLT, MMR, MNE, MNG, MNP, MOZ, MRT, MSR, MTQ, MUS, MWI, MYS, MYT, NAM, NCL, NER, NFK, NGA, NIC, NIU, NLD, NOR, NPL, NRU, NZL, OMN, PAK, PAN, PCN, PER, PHL, PLW, PNG, POL, PRI, PRK, PRT, PRY, PSE, PYF, QAT, REU, RKS, ROU, RUS, RWA, SAU, SDN, SEN, SGP, SGS, SHN, SJM, SLB, SLE, SLV, SMR, SOM, SPM, SRB, SSD, STP, SUR, SVK, SVN, SWE, SWZ, SXM, SYC, SYR, TCA, TCD, TGO, THA, TJK, TKL, TKM, TLS, TON, TTO, TUN, TUR, TUV, TWN, TZA, UGA, UKR, UMI, URY, USA, UZB, VAT, VCT, VEN, VGB, VIR, VNM, VUT, WLF, WSM, YEM, ZAF, ZMB, ZWE, UNKNOWN_DEFAULT_OPEN_API].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if CountryCodes.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #CountryCodes" + end + end +end diff --git a/lib/onfido/models/device_intelligence_breakdown.rb b/lib/onfido/models/device_intelligence_breakdown.rb new file mode 100644 index 0000000..43635c4 --- /dev/null +++ b/lib/onfido/models/device_intelligence_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DeviceIntelligenceBreakdown + attr_accessor :breakdown + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'breakdown' => :'DeviceIntelligenceBreakdownBreakdown', + :'properties' => :'DeviceIntelligenceBreakdownProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/device_intelligence_breakdown_breakdown.rb b/lib/onfido/models/device_intelligence_breakdown_breakdown.rb new file mode 100644 index 0000000..1a8c204 --- /dev/null +++ b/lib/onfido/models/device_intelligence_breakdown_breakdown.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DeviceIntelligenceBreakdownBreakdown + attr_accessor :device + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device' => :'device' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'device' => :'DeviceIntelligenceBreakdownBreakdownDevice' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceBreakdownBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceBreakdownBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'device') + self.device = attributes[:'device'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device == o.device + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/device_intelligence_breakdown_breakdown_device.rb b/lib/onfido/models/device_intelligence_breakdown_breakdown_device.rb new file mode 100644 index 0000000..74cbc3d --- /dev/null +++ b/lib/onfido/models/device_intelligence_breakdown_breakdown_device.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the device used to upload the media is trustworthy, i.e. it is a real, physical device. + class DeviceIntelligenceBreakdownBreakdownDevice + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'breakdown' => :'DeviceIntelligenceBreakdownBreakdownDeviceBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceBreakdownBreakdownDevice` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceBreakdownBreakdownDevice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.rb b/lib/onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.rb new file mode 100644 index 0000000..69598bb --- /dev/null +++ b/lib/onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DeviceIntelligenceBreakdownBreakdownDeviceBreakdown + attr_accessor :application_authenticity + + attr_accessor :device_integrity + + attr_accessor :device_reputation + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'application_authenticity' => :'application_authenticity', + :'device_integrity' => :'device_integrity', + :'device_reputation' => :'device_reputation' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'application_authenticity' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'device_integrity' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'device_reputation' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceBreakdownBreakdownDeviceBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceBreakdownBreakdownDeviceBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'application_authenticity') + self.application_authenticity = attributes[:'application_authenticity'] + end + + if attributes.key?(:'device_integrity') + self.device_integrity = attributes[:'device_integrity'] + end + + if attributes.key?(:'device_reputation') + self.device_reputation = attributes[:'device_reputation'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + application_authenticity == o.application_authenticity && + device_integrity == o.device_integrity && + device_reputation == o.device_reputation + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [application_authenticity, device_integrity, device_reputation].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/device_intelligence_breakdown_properties.rb b/lib/onfido/models/device_intelligence_breakdown_properties.rb new file mode 100644 index 0000000..5f407e7 --- /dev/null +++ b/lib/onfido/models/device_intelligence_breakdown_properties.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DeviceIntelligenceBreakdownProperties + attr_accessor :device + + attr_accessor :ip + + attr_accessor :geolocation + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device' => :'device', + :'ip' => :'ip', + :'geolocation' => :'geolocation' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'device' => :'DeviceIntelligenceBreakdownPropertiesDevice', + :'ip' => :'DeviceIntelligenceBreakdownPropertiesIp', + :'geolocation' => :'DeviceIntelligenceBreakdownPropertiesGeolocation' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceBreakdownProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceBreakdownProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'device') + self.device = attributes[:'device'] + end + + if attributes.key?(:'ip') + self.ip = attributes[:'ip'] + end + + if attributes.key?(:'geolocation') + self.geolocation = attributes[:'geolocation'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device == o.device && + ip == o.ip && + geolocation == o.geolocation + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device, ip, geolocation].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/device_intelligence_breakdown_properties_device.rb b/lib/onfido/models/device_intelligence_breakdown_properties_device.rb new file mode 100644 index 0000000..24078db --- /dev/null +++ b/lib/onfido/models/device_intelligence_breakdown_properties_device.rb @@ -0,0 +1,468 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DeviceIntelligenceBreakdownPropertiesDevice + # The SDK version that was used. + attr_accessor :sdk_version + + # The SDK used to upload the media. + attr_accessor :sdk_source + + # The token used to authenticate the request. + attr_accessor :authentication_type + + # The model as set by the phone manufacturer (for Android and iOS) or the browser manufacturer (for Web). The model can be presented in name or number form depending on each manufacturer implementation. + attr_accessor :raw_model + + # The operating system of the device. The value came from manufacturer implementation (for Android and iOS) or browser's user agent (for Web). + attr_accessor :os + + # The browser name reported by the browser's user agent. + attr_accessor :browser + + # Whether the device is an emulator. + attr_accessor :emulator + + # Whether the device is providing false randomized device and network information. + attr_accessor :randomized_device + + # Whether device is using stolen security tokens to send the network information. + attr_accessor :fake_network_request + + # The true operating system of the device. + attr_accessor :true_os + + # The likelihood of an operating system anomaly between the true OS and the OS sent by the device. + attr_accessor :os_anomaly + + # Whether the device is rooted. + attr_accessor :rooted + + # Whether the device is controlled via remote software. + attr_accessor :remote_software + + # Whether there is highly suspicious traffic related to the IP address. The risk depends on the overall ratio of clear checks on a given IP. + attr_accessor :ip_reputation + + # The number of times the device was used to create a report for a new applicant. A value greater than 1 indicates potential device reuse. + attr_accessor :device_fingerprint_reuse + + # Whether the document or biometric media were uploaded from a single device. + attr_accessor :single_device_used + + # Whether the document media were live captured from the device camera. + attr_accessor :document_capture + + # Whether the biometric media were live captured from the device camera. + attr_accessor :biometric_capture + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sdk_version' => :'sdk_version', + :'sdk_source' => :'sdk_source', + :'authentication_type' => :'authentication_type', + :'raw_model' => :'raw_model', + :'os' => :'os', + :'browser' => :'browser', + :'emulator' => :'emulator', + :'randomized_device' => :'randomized_device', + :'fake_network_request' => :'fake_network_request', + :'true_os' => :'true_os', + :'os_anomaly' => :'os_anomaly', + :'rooted' => :'rooted', + :'remote_software' => :'remote_software', + :'ip_reputation' => :'ip_reputation', + :'device_fingerprint_reuse' => :'device_fingerprint_reuse', + :'single_device_used' => :'single_device_used', + :'document_capture' => :'document_capture', + :'biometric_capture' => :'biometric_capture' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sdk_version' => :'String', + :'sdk_source' => :'String', + :'authentication_type' => :'String', + :'raw_model' => :'String', + :'os' => :'String', + :'browser' => :'String', + :'emulator' => :'Boolean', + :'randomized_device' => :'Boolean', + :'fake_network_request' => :'Boolean', + :'true_os' => :'String', + :'os_anomaly' => :'String', + :'rooted' => :'Boolean', + :'remote_software' => :'Boolean', + :'ip_reputation' => :'String', + :'device_fingerprint_reuse' => :'Integer', + :'single_device_used' => :'Boolean', + :'document_capture' => :'String', + :'biometric_capture' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'single_device_used', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceBreakdownPropertiesDevice` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceBreakdownPropertiesDevice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sdk_version') + self.sdk_version = attributes[:'sdk_version'] + end + + if attributes.key?(:'sdk_source') + self.sdk_source = attributes[:'sdk_source'] + end + + if attributes.key?(:'authentication_type') + self.authentication_type = attributes[:'authentication_type'] + end + + if attributes.key?(:'raw_model') + self.raw_model = attributes[:'raw_model'] + end + + if attributes.key?(:'os') + self.os = attributes[:'os'] + end + + if attributes.key?(:'browser') + self.browser = attributes[:'browser'] + end + + if attributes.key?(:'emulator') + self.emulator = attributes[:'emulator'] + end + + if attributes.key?(:'randomized_device') + self.randomized_device = attributes[:'randomized_device'] + end + + if attributes.key?(:'fake_network_request') + self.fake_network_request = attributes[:'fake_network_request'] + end + + if attributes.key?(:'true_os') + self.true_os = attributes[:'true_os'] + end + + if attributes.key?(:'os_anomaly') + self.os_anomaly = attributes[:'os_anomaly'] + end + + if attributes.key?(:'rooted') + self.rooted = attributes[:'rooted'] + end + + if attributes.key?(:'remote_software') + self.remote_software = attributes[:'remote_software'] + end + + if attributes.key?(:'ip_reputation') + self.ip_reputation = attributes[:'ip_reputation'] + end + + if attributes.key?(:'device_fingerprint_reuse') + self.device_fingerprint_reuse = attributes[:'device_fingerprint_reuse'] + end + + if attributes.key?(:'single_device_used') + self.single_device_used = attributes[:'single_device_used'] + end + + if attributes.key?(:'document_capture') + self.document_capture = attributes[:'document_capture'] + end + + if attributes.key?(:'biometric_capture') + self.biometric_capture = attributes[:'biometric_capture'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + sdk_source_validator = EnumAttributeValidator.new('String', ["onfido-android-sdk", "onfido-ios-sdk", "onfido-web-sdk", "unknown_default_open_api"]) + return false unless sdk_source_validator.valid?(@sdk_source) + authentication_type_validator = EnumAttributeValidator.new('String', ["sdk_token", "mobile_token", "api_token", "unknown_default_open_api"]) + return false unless authentication_type_validator.valid?(@authentication_type) + ip_reputation_validator = EnumAttributeValidator.new('String', ["NOT_ENOUGH_DATA", "HIGH_RISK", "LOW_RISK", "unknown_default_open_api"]) + return false unless ip_reputation_validator.valid?(@ip_reputation) + document_capture_validator = EnumAttributeValidator.new('String', ["live", "unknown_method", "unknown_default_open_api"]) + return false unless document_capture_validator.valid?(@document_capture) + biometric_capture_validator = EnumAttributeValidator.new('String', ["live", "unknown_method", "unknown_default_open_api"]) + return false unless biometric_capture_validator.valid?(@biometric_capture) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] sdk_source Object to be assigned + def sdk_source=(sdk_source) + validator = EnumAttributeValidator.new('String', ["onfido-android-sdk", "onfido-ios-sdk", "onfido-web-sdk", "unknown_default_open_api"]) + unless validator.valid?(sdk_source) + fail ArgumentError, "invalid value for \"sdk_source\", must be one of #{validator.allowable_values}." + end + @sdk_source = sdk_source + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] authentication_type Object to be assigned + def authentication_type=(authentication_type) + validator = EnumAttributeValidator.new('String', ["sdk_token", "mobile_token", "api_token", "unknown_default_open_api"]) + unless validator.valid?(authentication_type) + fail ArgumentError, "invalid value for \"authentication_type\", must be one of #{validator.allowable_values}." + end + @authentication_type = authentication_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] ip_reputation Object to be assigned + def ip_reputation=(ip_reputation) + validator = EnumAttributeValidator.new('String', ["NOT_ENOUGH_DATA", "HIGH_RISK", "LOW_RISK", "unknown_default_open_api"]) + unless validator.valid?(ip_reputation) + fail ArgumentError, "invalid value for \"ip_reputation\", must be one of #{validator.allowable_values}." + end + @ip_reputation = ip_reputation + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] document_capture Object to be assigned + def document_capture=(document_capture) + validator = EnumAttributeValidator.new('String', ["live", "unknown_method", "unknown_default_open_api"]) + unless validator.valid?(document_capture) + fail ArgumentError, "invalid value for \"document_capture\", must be one of #{validator.allowable_values}." + end + @document_capture = document_capture + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] biometric_capture Object to be assigned + def biometric_capture=(biometric_capture) + validator = EnumAttributeValidator.new('String', ["live", "unknown_method", "unknown_default_open_api"]) + unless validator.valid?(biometric_capture) + fail ArgumentError, "invalid value for \"biometric_capture\", must be one of #{validator.allowable_values}." + end + @biometric_capture = biometric_capture + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sdk_version == o.sdk_version && + sdk_source == o.sdk_source && + authentication_type == o.authentication_type && + raw_model == o.raw_model && + os == o.os && + browser == o.browser && + emulator == o.emulator && + randomized_device == o.randomized_device && + fake_network_request == o.fake_network_request && + true_os == o.true_os && + os_anomaly == o.os_anomaly && + rooted == o.rooted && + remote_software == o.remote_software && + ip_reputation == o.ip_reputation && + device_fingerprint_reuse == o.device_fingerprint_reuse && + single_device_used == o.single_device_used && + document_capture == o.document_capture && + biometric_capture == o.biometric_capture + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sdk_version, sdk_source, authentication_type, raw_model, os, browser, emulator, randomized_device, fake_network_request, true_os, os_anomaly, rooted, remote_software, ip_reputation, device_fingerprint_reuse, single_device_used, document_capture, biometric_capture].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/device_intelligence_breakdown_properties_geolocation.rb b/lib/onfido/models/device_intelligence_breakdown_properties_geolocation.rb new file mode 100644 index 0000000..5eda7bd --- /dev/null +++ b/lib/onfido/models/device_intelligence_breakdown_properties_geolocation.rb @@ -0,0 +1,257 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DeviceIntelligenceBreakdownPropertiesGeolocation + # City location of the IP address. + attr_accessor :city + + # Region location of the IP address. + attr_accessor :region + + # Country location of the IP address in a three letter format. + attr_accessor :country + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'region' => :'region', + :'country' => :'country' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'String', + :'region' => :'String', + :'country' => :'CountryCodes' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceBreakdownPropertiesGeolocation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceBreakdownPropertiesGeolocation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'region') + self.region = attributes[:'region'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + region == o.region && + country == o.country + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, region, country].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/device_intelligence_breakdown_properties_ip.rb b/lib/onfido/models/device_intelligence_breakdown_properties_ip.rb new file mode 100644 index 0000000..dc53960 --- /dev/null +++ b/lib/onfido/models/device_intelligence_breakdown_properties_ip.rb @@ -0,0 +1,245 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DeviceIntelligenceBreakdownPropertiesIp + # The IP address that uploaded the media. + attr_accessor :address + + # The likelihood of the network connection being a VPN. + attr_accessor :vpn_detection + + # The likelihood of the network connection being a Proxy. + attr_accessor :proxy_detection + + # The type of organization that owns this IP address. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'vpn_detection' => :'vpn_detection', + :'proxy_detection' => :'proxy_detection', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'String', + :'vpn_detection' => :'String', + :'proxy_detection' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceBreakdownPropertiesIp` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceBreakdownPropertiesIp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'vpn_detection') + self.vpn_detection = attributes[:'vpn_detection'] + end + + if attributes.key?(:'proxy_detection') + self.proxy_detection = attributes[:'proxy_detection'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + vpn_detection == o.vpn_detection && + proxy_detection == o.proxy_detection && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, vpn_detection, proxy_detection, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/device_intelligence_report.rb b/lib/onfido/models/device_intelligence_report.rb new file mode 100644 index 0000000..07ce01e --- /dev/null +++ b/lib/onfido/models/device_intelligence_report.rb @@ -0,0 +1,345 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DeviceIntelligenceReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'DeviceIntelligenceBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DeviceIntelligenceReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DeviceIntelligenceReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document.rb b/lib/onfido/models/document.rb new file mode 100644 index 0000000..8f49522 --- /dev/null +++ b/lib/onfido/models/document.rb @@ -0,0 +1,376 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Document + # The file type of the uploaded file + attr_accessor :file_type + + # The type of document + attr_accessor :type + + # The side of the document, if applicable. The possible values are front and back + attr_accessor :side + + # The issuing country of the document, a 3-letter ISO code. + attr_accessor :issuing_country + + # The ID of the applicant whose document is being uploaded. + attr_accessor :applicant_id + + # The unique identifier for the document + attr_accessor :id + + # The date and time at which the document was uploaded + attr_accessor :created_at + + # The uri of this resource + attr_accessor :href + + # The uri that can be used to download the document + attr_accessor :download_href + + # The name of the uploaded file + attr_accessor :file_name + + # The size of the file in bytes + attr_accessor :file_size + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'file_type' => :'file_type', + :'type' => :'type', + :'side' => :'side', + :'issuing_country' => :'issuing_country', + :'applicant_id' => :'applicant_id', + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'download_href' => :'download_href', + :'file_name' => :'file_name', + :'file_size' => :'file_size' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'file_type' => :'String', + :'type' => :'String', + :'side' => :'String', + :'issuing_country' => :'CountryCodes', + :'applicant_id' => :'String', + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'download_href' => :'String', + :'file_name' => :'String', + :'file_size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DocumentResponse', + :'DocumentShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Document` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Document`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'file_type') + self.file_type = attributes[:'file_type'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'side') + self.side = attributes[:'side'] + end + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'download_href') + self.download_href = attributes[:'download_href'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + file_type_validator = EnumAttributeValidator.new('String', ["jpg", "png", "pdf", "unknown_default_open_api"]) + return false unless file_type_validator.valid?(@file_type) + side_validator = EnumAttributeValidator.new('String', ["front", "back", "unknown_default_open_api"]) + return false unless side_validator.valid?(@side) + return false if @id.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] file_type Object to be assigned + def file_type=(file_type) + validator = EnumAttributeValidator.new('String', ["jpg", "png", "pdf", "unknown_default_open_api"]) + unless validator.valid?(file_type) + fail ArgumentError, "invalid value for \"file_type\", must be one of #{validator.allowable_values}." + end + @file_type = file_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] side Object to be assigned + def side=(side) + validator = EnumAttributeValidator.new('String', ["front", "back", "unknown_default_open_api"]) + unless validator.valid?(side) + fail ArgumentError, "invalid value for \"side\", must be one of #{validator.allowable_values}." + end + @side = side + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + file_type == o.file_type && + type == o.type && + side == o.side && + issuing_country == o.issuing_country && + applicant_id == o.applicant_id && + id == o.id && + created_at == o.created_at && + href == o.href && + download_href == o.download_href && + file_name == o.file_name && + file_size == o.file_size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [file_type, type, side, issuing_country, applicant_id, id, created_at, href, download_href, file_name, file_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown.rb b/lib/onfido/models/document_breakdown.rb new file mode 100644 index 0000000..ba87e61 --- /dev/null +++ b/lib/onfido/models/document_breakdown.rb @@ -0,0 +1,286 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdown + attr_accessor :data_comparison + + attr_accessor :data_validation + + attr_accessor :image_integrity + + attr_accessor :visual_authenticity + + attr_accessor :data_consistency + + attr_accessor :police_record + + attr_accessor :compromised_document + + attr_accessor :age_validation + + attr_accessor :issuing_authority + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data_comparison' => :'data_comparison', + :'data_validation' => :'data_validation', + :'image_integrity' => :'image_integrity', + :'visual_authenticity' => :'visual_authenticity', + :'data_consistency' => :'data_consistency', + :'police_record' => :'police_record', + :'compromised_document' => :'compromised_document', + :'age_validation' => :'age_validation', + :'issuing_authority' => :'issuing_authority' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data_comparison' => :'DocumentBreakdownDataComparison', + :'data_validation' => :'DocumentBreakdownDataValidation', + :'image_integrity' => :'DocumentBreakdownImageIntegrity', + :'visual_authenticity' => :'DocumentBreakdownVisualAuthenticity', + :'data_consistency' => :'DocumentBreakdownDataConsistency', + :'police_record' => :'DocumentBreakdownPoliceRecord', + :'compromised_document' => :'DocumentBreakdownCompromisedDocument', + :'age_validation' => :'DocumentBreakdownAgeValidation', + :'issuing_authority' => :'DocumentBreakdownIssuingAuthority' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data_comparison') + self.data_comparison = attributes[:'data_comparison'] + end + + if attributes.key?(:'data_validation') + self.data_validation = attributes[:'data_validation'] + end + + if attributes.key?(:'image_integrity') + self.image_integrity = attributes[:'image_integrity'] + end + + if attributes.key?(:'visual_authenticity') + self.visual_authenticity = attributes[:'visual_authenticity'] + end + + if attributes.key?(:'data_consistency') + self.data_consistency = attributes[:'data_consistency'] + end + + if attributes.key?(:'police_record') + self.police_record = attributes[:'police_record'] + end + + if attributes.key?(:'compromised_document') + self.compromised_document = attributes[:'compromised_document'] + end + + if attributes.key?(:'age_validation') + self.age_validation = attributes[:'age_validation'] + end + + if attributes.key?(:'issuing_authority') + self.issuing_authority = attributes[:'issuing_authority'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data_comparison == o.data_comparison && + data_validation == o.data_validation && + image_integrity == o.image_integrity && + visual_authenticity == o.visual_authenticity && + data_consistency == o.data_consistency && + police_record == o.police_record && + compromised_document == o.compromised_document && + age_validation == o.age_validation && + issuing_authority == o.issuing_authority + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data_comparison, data_validation, image_integrity, visual_authenticity, data_consistency, police_record, compromised_document, age_validation, issuing_authority].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_age_validation.rb b/lib/onfido/models/document_breakdown_age_validation.rb new file mode 100644 index 0000000..4f7ac6f --- /dev/null +++ b/lib/onfido/models/document_breakdown_age_validation.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the age calculated from the document's date of birth data point is greater than or equal to the minimum accepted age. + class DocumentBreakdownAgeValidation + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'DocumentBreakdownAgeValidationBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownAgeValidation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownAgeValidation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_age_validation_breakdown.rb b/lib/onfido/models/document_breakdown_age_validation_breakdown.rb new file mode 100644 index 0000000..da01927 --- /dev/null +++ b/lib/onfido/models/document_breakdown_age_validation_breakdown.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownAgeValidationBreakdown + attr_accessor :minimum_accepted_age + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'minimum_accepted_age' => :'minimum_accepted_age' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'minimum_accepted_age' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownAgeValidationBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownAgeValidationBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'minimum_accepted_age') + self.minimum_accepted_age = attributes[:'minimum_accepted_age'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + minimum_accepted_age == o.minimum_accepted_age + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [minimum_accepted_age].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_compromised_document.rb b/lib/onfido/models/document_breakdown_compromised_document.rb new file mode 100644 index 0000000..941591b --- /dev/null +++ b/lib/onfido/models/document_breakdown_compromised_document.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the image of the document has been found in our internal database or if it was used in a suspicious way. + class DocumentBreakdownCompromisedDocument + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'DocumentBreakdownCompromisedDocumentBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownCompromisedDocument` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownCompromisedDocument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_compromised_document_breakdown.rb b/lib/onfido/models/document_breakdown_compromised_document_breakdown.rb new file mode 100644 index 0000000..e8bfb58 --- /dev/null +++ b/lib/onfido/models/document_breakdown_compromised_document_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownCompromisedDocumentBreakdown + attr_accessor :document_database + + attr_accessor :repeat_attempts + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'document_database' => :'document_database', + :'repeat_attempts' => :'repeat_attempts' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'document_database' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'repeat_attempts' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownCompromisedDocumentBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownCompromisedDocumentBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'document_database') + self.document_database = attributes[:'document_database'] + end + + if attributes.key?(:'repeat_attempts') + self.repeat_attempts = attributes[:'repeat_attempts'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document_database == o.document_database && + repeat_attempts == o.repeat_attempts + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [document_database, repeat_attempts].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_comparison.rb b/lib/onfido/models/document_breakdown_data_comparison.rb new file mode 100644 index 0000000..f7f2d12 --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_comparison.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether data on the document is consistent with data provided when creating an applicant through the API. + class DocumentBreakdownDataComparison + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'DocumentBreakdownDataComparisonBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataComparison` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataComparison`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_comparison_breakdown.rb b/lib/onfido/models/document_breakdown_data_comparison_breakdown.rb new file mode 100644 index 0000000..d7bdc2d --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_comparison_breakdown.rb @@ -0,0 +1,277 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownDataComparisonBreakdown + attr_accessor :issuing_country + + attr_accessor :gender + + attr_accessor :date_of_expiry + + attr_accessor :last_name + + attr_accessor :document_type + + attr_accessor :document_numbers + + attr_accessor :first_name + + attr_accessor :date_of_birth + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'issuing_country' => :'issuing_country', + :'gender' => :'gender', + :'date_of_expiry' => :'date_of_expiry', + :'last_name' => :'last_name', + :'document_type' => :'document_type', + :'document_numbers' => :'document_numbers', + :'first_name' => :'first_name', + :'date_of_birth' => :'date_of_birth' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'issuing_country' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'gender' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'date_of_expiry' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'last_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'document_type' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'document_numbers' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'first_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'date_of_birth' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataComparisonBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataComparisonBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'date_of_expiry') + self.date_of_expiry = attributes[:'date_of_expiry'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'document_numbers') + self.document_numbers = attributes[:'document_numbers'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + issuing_country == o.issuing_country && + gender == o.gender && + date_of_expiry == o.date_of_expiry && + last_name == o.last_name && + document_type == o.document_type && + document_numbers == o.document_numbers && + first_name == o.first_name && + date_of_birth == o.date_of_birth + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [issuing_country, gender, date_of_expiry, last_name, document_type, document_numbers, first_name, date_of_birth].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_comparison_breakdown_issuing_country.rb b/lib/onfido/models/document_breakdown_data_comparison_breakdown_issuing_country.rb new file mode 100644 index 0000000..498b2de --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_comparison_breakdown_issuing_country.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownDataComparisonBreakdownIssuingCountry + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataComparisonBreakdownIssuingCountry` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataComparisonBreakdownIssuingCountry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_consistency.rb b/lib/onfido/models/document_breakdown_data_consistency.rb new file mode 100644 index 0000000..2fc8d4f --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_consistency.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether data represented in multiple places on the document is consistent. + class DocumentBreakdownDataConsistency + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'DocumentBreakdownDataConsistencyBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataConsistency` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataConsistency`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_consistency_breakdown.rb b/lib/onfido/models/document_breakdown_data_consistency_breakdown.rb new file mode 100644 index 0000000..9449a3d --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_consistency_breakdown.rb @@ -0,0 +1,295 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownDataConsistencyBreakdown + attr_accessor :date_of_expiry + + attr_accessor :document_numbers + + attr_accessor :issuing_country + + attr_accessor :document_type + + attr_accessor :date_of_birth + + attr_accessor :gender + + attr_accessor :first_name + + attr_accessor :nationality + + attr_accessor :last_name + + attr_accessor :multiple_data_sources_present + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'date_of_expiry' => :'date_of_expiry', + :'document_numbers' => :'document_numbers', + :'issuing_country' => :'issuing_country', + :'document_type' => :'document_type', + :'date_of_birth' => :'date_of_birth', + :'gender' => :'gender', + :'first_name' => :'first_name', + :'nationality' => :'nationality', + :'last_name' => :'last_name', + :'multiple_data_sources_present' => :'multiple_data_sources_present' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'date_of_expiry' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'document_numbers' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'issuing_country' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'document_type' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'date_of_birth' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'gender' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'first_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'nationality' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'last_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'multiple_data_sources_present' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataConsistencyBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataConsistencyBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'date_of_expiry') + self.date_of_expiry = attributes[:'date_of_expiry'] + end + + if attributes.key?(:'document_numbers') + self.document_numbers = attributes[:'document_numbers'] + end + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'nationality') + self.nationality = attributes[:'nationality'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'multiple_data_sources_present') + self.multiple_data_sources_present = attributes[:'multiple_data_sources_present'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + date_of_expiry == o.date_of_expiry && + document_numbers == o.document_numbers && + issuing_country == o.issuing_country && + document_type == o.document_type && + date_of_birth == o.date_of_birth && + gender == o.gender && + first_name == o.first_name && + nationality == o.nationality && + last_name == o.last_name && + multiple_data_sources_present == o.multiple_data_sources_present + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [date_of_expiry, document_numbers, issuing_country, document_type, date_of_birth, gender, first_name, nationality, last_name, multiple_data_sources_present].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_validation.rb b/lib/onfido/models/document_breakdown_data_validation.rb new file mode 100644 index 0000000..f4458ef --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_validation.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether algorithmically validatable elements are correct. + class DocumentBreakdownDataValidation + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'DocumentBreakdownDataValidationBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataValidation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataValidation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_validation_breakdown.rb b/lib/onfido/models/document_breakdown_data_validation_breakdown.rb new file mode 100644 index 0000000..bb45edd --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_validation_breakdown.rb @@ -0,0 +1,268 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownDataValidationBreakdown + attr_accessor :gender + + attr_accessor :date_of_birth + + attr_accessor :document_numbers + + attr_accessor :document_expiration + + attr_accessor :expiry_date + + attr_accessor :mrz + + attr_accessor :barcode + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'gender' => :'gender', + :'date_of_birth' => :'date_of_birth', + :'document_numbers' => :'document_numbers', + :'document_expiration' => :'document_expiration', + :'expiry_date' => :'expiry_date', + :'mrz' => :'mrz', + :'barcode' => :'barcode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'gender' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'date_of_birth' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'document_numbers' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'document_expiration' => :'DocumentBreakdownDataValidationBreakdownDocumentExpiration', + :'expiry_date' => :'DocumentBreakdownDataValidationBreakdownExpiryDate', + :'mrz' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'barcode' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataValidationBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataValidationBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'document_numbers') + self.document_numbers = attributes[:'document_numbers'] + end + + if attributes.key?(:'document_expiration') + self.document_expiration = attributes[:'document_expiration'] + end + + if attributes.key?(:'expiry_date') + self.expiry_date = attributes[:'expiry_date'] + end + + if attributes.key?(:'mrz') + self.mrz = attributes[:'mrz'] + end + + if attributes.key?(:'barcode') + self.barcode = attributes[:'barcode'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + gender == o.gender && + date_of_birth == o.date_of_birth && + document_numbers == o.document_numbers && + document_expiration == o.document_expiration && + expiry_date == o.expiry_date && + mrz == o.mrz && + barcode == o.barcode + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [gender, date_of_birth, document_numbers, document_expiration, expiry_date, mrz, barcode].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_validation_breakdown_document_expiration.rb b/lib/onfido/models/document_breakdown_data_validation_breakdown_document_expiration.rb new file mode 100644 index 0000000..d47d48c --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_validation_breakdown_document_expiration.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # If this is flagged, the document has expired. + class DocumentBreakdownDataValidationBreakdownDocumentExpiration + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataValidationBreakdownDocumentExpiration` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataValidationBreakdownDocumentExpiration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_data_validation_breakdown_expiry_date.rb b/lib/onfido/models/document_breakdown_data_validation_breakdown_expiry_date.rb new file mode 100644 index 0000000..128e7a6 --- /dev/null +++ b/lib/onfido/models/document_breakdown_data_validation_breakdown_expiry_date.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # If this is flagged, the expiration date has the incorrect format. + class DocumentBreakdownDataValidationBreakdownExpiryDate + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownDataValidationBreakdownExpiryDate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownDataValidationBreakdownExpiryDate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_image_integrity.rb b/lib/onfido/models/document_breakdown_image_integrity.rb new file mode 100644 index 0000000..e5ce75d --- /dev/null +++ b/lib/onfido/models/document_breakdown_image_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if the document is of sufficient quality to verify. + class DocumentBreakdownImageIntegrity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'DocumentBreakdownImageIntegrityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownImageIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownImageIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_image_integrity_breakdown.rb b/lib/onfido/models/document_breakdown_image_integrity_breakdown.rb new file mode 100644 index 0000000..9b93897 --- /dev/null +++ b/lib/onfido/models/document_breakdown_image_integrity_breakdown.rb @@ -0,0 +1,241 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownImageIntegrityBreakdown + attr_accessor :image_quality + + attr_accessor :supported_document + + attr_accessor :colour_picture + + attr_accessor :conclusive_document_quality + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_quality' => :'image_quality', + :'supported_document' => :'supported_document', + :'colour_picture' => :'colour_picture', + :'conclusive_document_quality' => :'conclusive_document_quality' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_quality' => :'DocumentBreakdownImageIntegrityBreakdownImageQuality', + :'supported_document' => :'DocumentBreakdownImageIntegrityBreakdownSupportedDocument', + :'colour_picture' => :'DocumentBreakdownImageIntegrityBreakdownColourPicture', + :'conclusive_document_quality' => :'DocumentBreakdownImageIntegrityBreakdownConclusiveDocumentQuality' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownImageIntegrityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownImageIntegrityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'image_quality') + self.image_quality = attributes[:'image_quality'] + end + + if attributes.key?(:'supported_document') + self.supported_document = attributes[:'supported_document'] + end + + if attributes.key?(:'colour_picture') + self.colour_picture = attributes[:'colour_picture'] + end + + if attributes.key?(:'conclusive_document_quality') + self.conclusive_document_quality = attributes[:'conclusive_document_quality'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_quality == o.image_quality && + supported_document == o.supported_document && + colour_picture == o.colour_picture && + conclusive_document_quality == o.conclusive_document_quality + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_quality, supported_document, colour_picture, conclusive_document_quality].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_image_integrity_breakdown_colour_picture.rb b/lib/onfido/models/document_breakdown_image_integrity_breakdown_colour_picture.rb new file mode 100644 index 0000000..931c009 --- /dev/null +++ b/lib/onfido/models/document_breakdown_image_integrity_breakdown_colour_picture.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the image was a colour one. + class DocumentBreakdownImageIntegrityBreakdownColourPicture + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownImageIntegrityBreakdownColourPicture` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownImageIntegrityBreakdownColourPicture`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_image_integrity_breakdown_conclusive_document_quality.rb b/lib/onfido/models/document_breakdown_image_integrity_breakdown_conclusive_document_quality.rb new file mode 100644 index 0000000..73b8dfa --- /dev/null +++ b/lib/onfido/models/document_breakdown_image_integrity_breakdown_conclusive_document_quality.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if the document was of enough quality to be able to perform a fraud inspection. + class DocumentBreakdownImageIntegrityBreakdownConclusiveDocumentQuality + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'DocumentCDQReasons' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownImageIntegrityBreakdownConclusiveDocumentQuality` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownImageIntegrityBreakdownConclusiveDocumentQuality`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_image_integrity_breakdown_image_quality.rb b/lib/onfido/models/document_breakdown_image_integrity_breakdown_image_quality.rb new file mode 100644 index 0000000..48a35ed --- /dev/null +++ b/lib/onfido/models/document_breakdown_image_integrity_breakdown_image_quality.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the quality of the image was sufficient for processing. + class DocumentBreakdownImageIntegrityBreakdownImageQuality + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'DocumentIQReasons' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownImageIntegrityBreakdownImageQuality` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownImageIntegrityBreakdownImageQuality`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_image_integrity_breakdown_supported_document.rb b/lib/onfido/models/document_breakdown_image_integrity_breakdown_supported_document.rb new file mode 100644 index 0000000..794a3c0 --- /dev/null +++ b/lib/onfido/models/document_breakdown_image_integrity_breakdown_supported_document.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the submitted document is supported. + class DocumentBreakdownImageIntegrityBreakdownSupportedDocument + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownImageIntegrityBreakdownSupportedDocument` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownImageIntegrityBreakdownSupportedDocument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_issuing_authority.rb b/lib/onfido/models/document_breakdown_issuing_authority.rb new file mode 100644 index 0000000..7dd39d9 --- /dev/null +++ b/lib/onfido/models/document_breakdown_issuing_authority.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether data on the document matches the issuing authority data. + class DocumentBreakdownIssuingAuthority + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'DocumentBreakdownIssuingAuthorityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownIssuingAuthority` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownIssuingAuthority`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_issuing_authority_breakdown.rb b/lib/onfido/models/document_breakdown_issuing_authority_breakdown.rb new file mode 100644 index 0000000..9b4b159 --- /dev/null +++ b/lib/onfido/models/document_breakdown_issuing_authority_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownIssuingAuthorityBreakdown + attr_accessor :nfc_active_authentication + + attr_accessor :nfc_passive_authentication + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'nfc_active_authentication' => :'nfc_active_authentication', + :'nfc_passive_authentication' => :'nfc_passive_authentication' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'nfc_active_authentication' => :'DocumentBreakdownIssuingAuthorityBreakdownNfcActiveAuthentication', + :'nfc_passive_authentication' => :'DocumentBreakdownIssuingAuthorityBreakdownNfcPassiveAuthentication' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownIssuingAuthorityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownIssuingAuthorityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'nfc_active_authentication') + self.nfc_active_authentication = attributes[:'nfc_active_authentication'] + end + + if attributes.key?(:'nfc_passive_authentication') + self.nfc_passive_authentication = attributes[:'nfc_passive_authentication'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + nfc_active_authentication == o.nfc_active_authentication && + nfc_passive_authentication == o.nfc_passive_authentication + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [nfc_active_authentication, nfc_passive_authentication].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_active_authentication.rb b/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_active_authentication.rb new file mode 100644 index 0000000..2cd2d2d --- /dev/null +++ b/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_active_authentication.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the document NFC chip is original or cloned. + class DocumentBreakdownIssuingAuthorityBreakdownNfcActiveAuthentication + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownIssuingAuthorityBreakdownNfcActiveAuthentication` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownIssuingAuthorityBreakdownNfcActiveAuthentication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_passive_authentication.rb b/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_passive_authentication.rb new file mode 100644 index 0000000..5ff13a1 --- /dev/null +++ b/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_passive_authentication.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the document NFC chip data was tampered. + class DocumentBreakdownIssuingAuthorityBreakdownNfcPassiveAuthentication + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownIssuingAuthorityBreakdownNfcPassiveAuthentication` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownIssuingAuthorityBreakdownNfcPassiveAuthentication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_police_record.rb b/lib/onfido/models/document_breakdown_police_record.rb new file mode 100644 index 0000000..a8ffa9b --- /dev/null +++ b/lib/onfido/models/document_breakdown_police_record.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the document had been identified as lost, stolen or otherwise compromised. + class DocumentBreakdownPoliceRecord + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownPoliceRecord` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownPoliceRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity.rb b/lib/onfido/models/document_breakdown_visual_authenticity.rb new file mode 100644 index 0000000..eaf7448 --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether visual, non-textual, elements are correct given the type of document. + class DocumentBreakdownVisualAuthenticity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'DocumentBreakdownVisualAuthenticityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown.rb new file mode 100644 index 0000000..9c746c5 --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown.rb @@ -0,0 +1,277 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentBreakdownVisualAuthenticityBreakdown + attr_accessor :fonts + + attr_accessor :picture_face_integrity + + attr_accessor :template + + attr_accessor :security_features + + attr_accessor :original_document_present + + attr_accessor :digital_tampering + + attr_accessor :other + + attr_accessor :face_detection + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'fonts' => :'fonts', + :'picture_face_integrity' => :'picture_face_integrity', + :'template' => :'template', + :'security_features' => :'security_features', + :'original_document_present' => :'original_document_present', + :'digital_tampering' => :'digital_tampering', + :'other' => :'other', + :'face_detection' => :'face_detection' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'fonts' => :'DocumentBreakdownVisualAuthenticityBreakdownFonts', + :'picture_face_integrity' => :'DocumentBreakdownVisualAuthenticityBreakdownPictureFaceIntegrity', + :'template' => :'DocumentBreakdownVisualAuthenticityBreakdownTemplate', + :'security_features' => :'DocumentBreakdownVisualAuthenticityBreakdownSecurityFeatures', + :'original_document_present' => :'DocumentBreakdownVisualAuthenticityBreakdownOriginalDocumentPresent', + :'digital_tampering' => :'DocumentBreakdownVisualAuthenticityBreakdownDigitalTampering', + :'other' => :'DocumentBreakdownVisualAuthenticityBreakdownOther', + :'face_detection' => :'DocumentBreakdownVisualAuthenticityBreakdownFaceDetection' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'fonts') + self.fonts = attributes[:'fonts'] + end + + if attributes.key?(:'picture_face_integrity') + self.picture_face_integrity = attributes[:'picture_face_integrity'] + end + + if attributes.key?(:'template') + self.template = attributes[:'template'] + end + + if attributes.key?(:'security_features') + self.security_features = attributes[:'security_features'] + end + + if attributes.key?(:'original_document_present') + self.original_document_present = attributes[:'original_document_present'] + end + + if attributes.key?(:'digital_tampering') + self.digital_tampering = attributes[:'digital_tampering'] + end + + if attributes.key?(:'other') + self.other = attributes[:'other'] + end + + if attributes.key?(:'face_detection') + self.face_detection = attributes[:'face_detection'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + fonts == o.fonts && + picture_face_integrity == o.picture_face_integrity && + template == o.template && + security_features == o.security_features && + original_document_present == o.original_document_present && + digital_tampering == o.digital_tampering && + other == o.other && + face_detection == o.face_detection + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [fonts, picture_face_integrity, template, security_features, original_document_present, digital_tampering, other, face_detection].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_digital_tampering.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_digital_tampering.rb new file mode 100644 index 0000000..3359aac --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_digital_tampering.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Indication of digital tampering in the image. + class DocumentBreakdownVisualAuthenticityBreakdownDigitalTampering + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownDigitalTampering` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownDigitalTampering`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_face_detection.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_face_detection.rb new file mode 100644 index 0000000..ec4ae0c --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_face_detection.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # No face was detected on the document. + class DocumentBreakdownVisualAuthenticityBreakdownFaceDetection + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownFaceDetection` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownFaceDetection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_fonts.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_fonts.rb new file mode 100644 index 0000000..19afd68 --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_fonts.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Fonts in the document don't match the expected ones. + class DocumentBreakdownVisualAuthenticityBreakdownFonts + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownFonts` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownFonts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_original_document_present.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_original_document_present.rb new file mode 100644 index 0000000..3b014e9 --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_original_document_present.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # The document was not present when the photo was taken. + class DocumentBreakdownVisualAuthenticityBreakdownOriginalDocumentPresent + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'DocumentODPReasons' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownOriginalDocumentPresent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownOriginalDocumentPresent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_other.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_other.rb new file mode 100644 index 0000000..bc13fce --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_other.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # This sub-breakdown is returned for backward compatibility reasons. Its value will be consider when at least one of the other breakdowns is consider, and clear when all the other breakdowns are clear. + class DocumentBreakdownVisualAuthenticityBreakdownOther + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownOther` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownOther`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_picture_face_integrity.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_picture_face_integrity.rb new file mode 100644 index 0000000..8d77351 --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_picture_face_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # The pictures of the person identified on the document show signs of tampering or alteration. + class DocumentBreakdownVisualAuthenticityBreakdownPictureFaceIntegrity + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownPictureFaceIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownPictureFaceIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_security_features.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_security_features.rb new file mode 100644 index 0000000..64a8347 --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_security_features.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Security features expected on the document are missing or wrong. + class DocumentBreakdownVisualAuthenticityBreakdownSecurityFeatures + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownSecurityFeatures` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownSecurityFeatures`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_template.rb b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_template.rb new file mode 100644 index 0000000..dc249f5 --- /dev/null +++ b/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_template.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # The document doesn't match the expected template for the document type and country it is from. + class DocumentBreakdownVisualAuthenticityBreakdownTemplate + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownTemplate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentBreakdownVisualAuthenticityBreakdownTemplate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_cdq_reasons.rb b/lib/onfido/models/document_cdq_reasons.rb new file mode 100644 index 0000000..ba0e8a5 --- /dev/null +++ b/lib/onfido/models/document_cdq_reasons.rb @@ -0,0 +1,285 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentCDQReasons + # When data points are obscured to the point that we cannot confirm if the fonts match the expected ones. + attr_accessor :obscured_data_points + + # When a critical security feature is obscured. This can also refer to when the holder's wet signature, necessary for the document to be valid, is not present. + attr_accessor :obscured_security_features + + # One of 3 reasons (1) OCR Assisted Scans (i.e. when you're able to move the mouse and highlight part of text), (2) Severely Washed out Background, (3) Overlapping Text. + attr_accessor :abnormal_document_features + + # Any digital text or electronic watermarks on the document. + attr_accessor :watermarks_digital_text_overlay + + # If the corner has been physically cut off. This can be found on some documents that are no longer valid. + attr_accessor :corner_removed + + # A punched hole is present. + attr_accessor :punctured_document + + # When the back of a document is needed for processing, but is not available. + attr_accessor :missing_back + + # When a document has been published digitally, there aren't enough security features to review so we cannot perform a full fraud assessment. + attr_accessor :digital_document + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'obscured_data_points' => :'obscured_data_points', + :'obscured_security_features' => :'obscured_security_features', + :'abnormal_document_features' => :'abnormal_document_features', + :'watermarks_digital_text_overlay' => :'watermarks_digital_text_overlay', + :'corner_removed' => :'corner_removed', + :'punctured_document' => :'punctured_document', + :'missing_back' => :'missing_back', + :'digital_document' => :'digital_document' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'obscured_data_points' => :'String', + :'obscured_security_features' => :'String', + :'abnormal_document_features' => :'String', + :'watermarks_digital_text_overlay' => :'String', + :'corner_removed' => :'String', + :'punctured_document' => :'String', + :'missing_back' => :'String', + :'digital_document' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentCDQReasons` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentCDQReasons`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'obscured_data_points') + self.obscured_data_points = attributes[:'obscured_data_points'] + end + + if attributes.key?(:'obscured_security_features') + self.obscured_security_features = attributes[:'obscured_security_features'] + end + + if attributes.key?(:'abnormal_document_features') + self.abnormal_document_features = attributes[:'abnormal_document_features'] + end + + if attributes.key?(:'watermarks_digital_text_overlay') + self.watermarks_digital_text_overlay = attributes[:'watermarks_digital_text_overlay'] + end + + if attributes.key?(:'corner_removed') + self.corner_removed = attributes[:'corner_removed'] + end + + if attributes.key?(:'punctured_document') + self.punctured_document = attributes[:'punctured_document'] + end + + if attributes.key?(:'missing_back') + self.missing_back = attributes[:'missing_back'] + end + + if attributes.key?(:'digital_document') + self.digital_document = attributes[:'digital_document'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + obscured_data_points == o.obscured_data_points && + obscured_security_features == o.obscured_security_features && + abnormal_document_features == o.abnormal_document_features && + watermarks_digital_text_overlay == o.watermarks_digital_text_overlay && + corner_removed == o.corner_removed && + punctured_document == o.punctured_document && + missing_back == o.missing_back && + digital_document == o.digital_document + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [obscured_data_points, obscured_security_features, abnormal_document_features, watermarks_digital_text_overlay, corner_removed, punctured_document, missing_back, digital_document].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_iq_reasons.rb b/lib/onfido/models/document_iq_reasons.rb new file mode 100644 index 0000000..1d73f41 --- /dev/null +++ b/lib/onfido/models/document_iq_reasons.rb @@ -0,0 +1,305 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentIQReasons + # When an image of the document is too dark to be able to see data points. + attr_accessor :dark_photo + + # When there is light reflecting on the document causing glare to obstruct data points. + attr_accessor :glare_on_photo + + # When data points are blurred and no reference can be made elsewhere in the document or if the data points are too blurry and 'they could be something else'. + attr_accessor :blurred_photo + + # When data points have been covered either by the applicant or by another object such as a sticker. + attr_accessor :covered_photo + + # Any other reason not listed, such as when holograms are obscuring data points. + attr_accessor :other_photo_issue + + # When a document is damaged and we are unable to make out data points. + attr_accessor :damaged_document + + # When the incorrect side of a document has been uploaded, and we have not received the front. + attr_accessor :incorrect_side + + # When data points are not included in the image due to the document being cut off. + attr_accessor :cut_off_document + + # If no document has been uploaded or there is a blank image. + attr_accessor :no_document_in_image + + # When 2 different documents are submitted in the same check. + attr_accessor :two_documents_uploaded + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'dark_photo' => :'dark_photo', + :'glare_on_photo' => :'glare_on_photo', + :'blurred_photo' => :'blurred_photo', + :'covered_photo' => :'covered_photo', + :'other_photo_issue' => :'other_photo_issue', + :'damaged_document' => :'damaged_document', + :'incorrect_side' => :'incorrect_side', + :'cut_off_document' => :'cut_off_document', + :'no_document_in_image' => :'no_document_in_image', + :'two_documents_uploaded' => :'two_documents_uploaded' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'dark_photo' => :'String', + :'glare_on_photo' => :'String', + :'blurred_photo' => :'String', + :'covered_photo' => :'String', + :'other_photo_issue' => :'String', + :'damaged_document' => :'String', + :'incorrect_side' => :'String', + :'cut_off_document' => :'String', + :'no_document_in_image' => :'String', + :'two_documents_uploaded' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentIQReasons` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentIQReasons`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'dark_photo') + self.dark_photo = attributes[:'dark_photo'] + end + + if attributes.key?(:'glare_on_photo') + self.glare_on_photo = attributes[:'glare_on_photo'] + end + + if attributes.key?(:'blurred_photo') + self.blurred_photo = attributes[:'blurred_photo'] + end + + if attributes.key?(:'covered_photo') + self.covered_photo = attributes[:'covered_photo'] + end + + if attributes.key?(:'other_photo_issue') + self.other_photo_issue = attributes[:'other_photo_issue'] + end + + if attributes.key?(:'damaged_document') + self.damaged_document = attributes[:'damaged_document'] + end + + if attributes.key?(:'incorrect_side') + self.incorrect_side = attributes[:'incorrect_side'] + end + + if attributes.key?(:'cut_off_document') + self.cut_off_document = attributes[:'cut_off_document'] + end + + if attributes.key?(:'no_document_in_image') + self.no_document_in_image = attributes[:'no_document_in_image'] + end + + if attributes.key?(:'two_documents_uploaded') + self.two_documents_uploaded = attributes[:'two_documents_uploaded'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + dark_photo == o.dark_photo && + glare_on_photo == o.glare_on_photo && + blurred_photo == o.blurred_photo && + covered_photo == o.covered_photo && + other_photo_issue == o.other_photo_issue && + damaged_document == o.damaged_document && + incorrect_side == o.incorrect_side && + cut_off_document == o.cut_off_document && + no_document_in_image == o.no_document_in_image && + two_documents_uploaded == o.two_documents_uploaded + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [dark_photo, glare_on_photo, blurred_photo, covered_photo, other_photo_issue, damaged_document, incorrect_side, cut_off_document, no_document_in_image, two_documents_uploaded].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_odp_reasons.rb b/lib/onfido/models/document_odp_reasons.rb new file mode 100644 index 0000000..7eb863c --- /dev/null +++ b/lib/onfido/models/document_odp_reasons.rb @@ -0,0 +1,245 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentODPReasons + # When the applicant's document is on a physical screen or device. + attr_accessor :photo_of_screen + + # When the applicant has used their mobile phone, tablet, or computer to take a photo within the device. + attr_accessor :screenshot + + # When the applicant has previously captured an image of the document, printed it out, and has now taken a photo of this print out to upload. + attr_accessor :document_on_printed_paper + + # When the document has clearly been captured using a scanner and there are visible indicators of this + attr_accessor :scan + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'photo_of_screen' => :'photo_of_screen', + :'screenshot' => :'screenshot', + :'document_on_printed_paper' => :'document_on_printed_paper', + :'scan' => :'scan' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'photo_of_screen' => :'String', + :'screenshot' => :'String', + :'document_on_printed_paper' => :'String', + :'scan' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentODPReasons` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentODPReasons`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'photo_of_screen') + self.photo_of_screen = attributes[:'photo_of_screen'] + end + + if attributes.key?(:'screenshot') + self.screenshot = attributes[:'screenshot'] + end + + if attributes.key?(:'document_on_printed_paper') + self.document_on_printed_paper = attributes[:'document_on_printed_paper'] + end + + if attributes.key?(:'scan') + self.scan = attributes[:'scan'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + photo_of_screen == o.photo_of_screen && + screenshot == o.screenshot && + document_on_printed_paper == o.document_on_printed_paper && + scan == o.scan + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [photo_of_screen, screenshot, document_on_printed_paper, scan].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_properties.rb b/lib/onfido/models/document_properties.rb new file mode 100644 index 0000000..d8f7137 --- /dev/null +++ b/lib/onfido/models/document_properties.rb @@ -0,0 +1,461 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentProperties + attr_accessor :date_of_birth + + attr_accessor :date_of_expiry + + attr_accessor :document_numbers + + attr_accessor :document_type + + attr_accessor :first_name + + attr_accessor :gender + + attr_accessor :issuing_country + + attr_accessor :last_name + + attr_accessor :nationality + + attr_accessor :issuing_state + + attr_accessor :issuing_date + + attr_accessor :categorisation + + attr_accessor :mrz_line1 + + attr_accessor :mrz_line2 + + attr_accessor :mrz_line3 + + attr_accessor :address + + attr_accessor :place_of_birth + + attr_accessor :spouse_name + + attr_accessor :widow_name + + attr_accessor :alias_name + + attr_accessor :issuing_authority + + attr_accessor :real_id_compliance + + attr_accessor :address_lines + + attr_accessor :barcode + + attr_accessor :nfc + + attr_accessor :driving_licence_information + + attr_accessor :document_classification + + attr_accessor :extracted_data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'date_of_birth' => :'date_of_birth', + :'date_of_expiry' => :'date_of_expiry', + :'document_numbers' => :'document_numbers', + :'document_type' => :'document_type', + :'first_name' => :'first_name', + :'gender' => :'gender', + :'issuing_country' => :'issuing_country', + :'last_name' => :'last_name', + :'nationality' => :'nationality', + :'issuing_state' => :'issuing_state', + :'issuing_date' => :'issuing_date', + :'categorisation' => :'categorisation', + :'mrz_line1' => :'mrz_line1', + :'mrz_line2' => :'mrz_line2', + :'mrz_line3' => :'mrz_line3', + :'address' => :'address', + :'place_of_birth' => :'place_of_birth', + :'spouse_name' => :'spouse_name', + :'widow_name' => :'widow_name', + :'alias_name' => :'alias_name', + :'issuing_authority' => :'issuing_authority', + :'real_id_compliance' => :'real_id_compliance', + :'address_lines' => :'address_lines', + :'barcode' => :'barcode', + :'nfc' => :'nfc', + :'driving_licence_information' => :'driving_licence_information', + :'document_classification' => :'document_classification', + :'extracted_data' => :'extracted_data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'date_of_birth' => :'Date', + :'date_of_expiry' => :'Date', + :'document_numbers' => :'Array', + :'document_type' => :'String', + :'first_name' => :'String', + :'gender' => :'String', + :'issuing_country' => :'String', + :'last_name' => :'String', + :'nationality' => :'String', + :'issuing_state' => :'String', + :'issuing_date' => :'Date', + :'categorisation' => :'String', + :'mrz_line1' => :'String', + :'mrz_line2' => :'String', + :'mrz_line3' => :'String', + :'address' => :'String', + :'place_of_birth' => :'String', + :'spouse_name' => :'String', + :'widow_name' => :'String', + :'alias_name' => :'String', + :'issuing_authority' => :'String', + :'real_id_compliance' => :'Boolean', + :'address_lines' => :'DocumentPropertiesAddressLines', + :'barcode' => :'Array', + :'nfc' => :'DocumentPropertiesNfc', + :'driving_licence_information' => :'DocumentPropertiesDrivingLicenceInformation', + :'document_classification' => :'DocumentPropertiesDocumentClassification', + :'extracted_data' => :'DocumentPropertiesExtractedData' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'date_of_expiry') + self.date_of_expiry = attributes[:'date_of_expiry'] + end + + if attributes.key?(:'document_numbers') + if (value = attributes[:'document_numbers']).is_a?(Array) + self.document_numbers = value + end + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'nationality') + self.nationality = attributes[:'nationality'] + end + + if attributes.key?(:'issuing_state') + self.issuing_state = attributes[:'issuing_state'] + end + + if attributes.key?(:'issuing_date') + self.issuing_date = attributes[:'issuing_date'] + end + + if attributes.key?(:'categorisation') + self.categorisation = attributes[:'categorisation'] + end + + if attributes.key?(:'mrz_line1') + self.mrz_line1 = attributes[:'mrz_line1'] + end + + if attributes.key?(:'mrz_line2') + self.mrz_line2 = attributes[:'mrz_line2'] + end + + if attributes.key?(:'mrz_line3') + self.mrz_line3 = attributes[:'mrz_line3'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'place_of_birth') + self.place_of_birth = attributes[:'place_of_birth'] + end + + if attributes.key?(:'spouse_name') + self.spouse_name = attributes[:'spouse_name'] + end + + if attributes.key?(:'widow_name') + self.widow_name = attributes[:'widow_name'] + end + + if attributes.key?(:'alias_name') + self.alias_name = attributes[:'alias_name'] + end + + if attributes.key?(:'issuing_authority') + self.issuing_authority = attributes[:'issuing_authority'] + end + + if attributes.key?(:'real_id_compliance') + self.real_id_compliance = attributes[:'real_id_compliance'] + end + + if attributes.key?(:'address_lines') + self.address_lines = attributes[:'address_lines'] + end + + if attributes.key?(:'barcode') + if (value = attributes[:'barcode']).is_a?(Array) + self.barcode = value + end + end + + if attributes.key?(:'nfc') + self.nfc = attributes[:'nfc'] + end + + if attributes.key?(:'driving_licence_information') + self.driving_licence_information = attributes[:'driving_licence_information'] + end + + if attributes.key?(:'document_classification') + self.document_classification = attributes[:'document_classification'] + end + + if attributes.key?(:'extracted_data') + self.extracted_data = attributes[:'extracted_data'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + date_of_birth == o.date_of_birth && + date_of_expiry == o.date_of_expiry && + document_numbers == o.document_numbers && + document_type == o.document_type && + first_name == o.first_name && + gender == o.gender && + issuing_country == o.issuing_country && + last_name == o.last_name && + nationality == o.nationality && + issuing_state == o.issuing_state && + issuing_date == o.issuing_date && + categorisation == o.categorisation && + mrz_line1 == o.mrz_line1 && + mrz_line2 == o.mrz_line2 && + mrz_line3 == o.mrz_line3 && + address == o.address && + place_of_birth == o.place_of_birth && + spouse_name == o.spouse_name && + widow_name == o.widow_name && + alias_name == o.alias_name && + issuing_authority == o.issuing_authority && + real_id_compliance == o.real_id_compliance && + address_lines == o.address_lines && + barcode == o.barcode && + nfc == o.nfc && + driving_licence_information == o.driving_licence_information && + document_classification == o.document_classification && + extracted_data == o.extracted_data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [date_of_birth, date_of_expiry, document_numbers, document_type, first_name, gender, issuing_country, last_name, nationality, issuing_state, issuing_date, categorisation, mrz_line1, mrz_line2, mrz_line3, address, place_of_birth, spouse_name, widow_name, alias_name, issuing_authority, real_id_compliance, address_lines, barcode, nfc, driving_licence_information, document_classification, extracted_data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_properties_address_lines.rb b/lib/onfido/models/document_properties_address_lines.rb new file mode 100644 index 0000000..4ba6223 --- /dev/null +++ b/lib/onfido/models/document_properties_address_lines.rb @@ -0,0 +1,259 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentPropertiesAddressLines + attr_accessor :street_address + + attr_accessor :state + + attr_accessor :postal_code + + attr_accessor :country + + attr_accessor :city + + attr_accessor :country_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'street_address' => :'street_address', + :'state' => :'state', + :'postal_code' => :'postal_code', + :'country' => :'country', + :'city' => :'city', + :'country_code' => :'country_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'street_address' => :'String', + :'state' => :'String', + :'postal_code' => :'String', + :'country' => :'String', + :'city' => :'String', + :'country_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentPropertiesAddressLines` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentPropertiesAddressLines`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'street_address') + self.street_address = attributes[:'street_address'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'country_code') + self.country_code = attributes[:'country_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + street_address == o.street_address && + state == o.state && + postal_code == o.postal_code && + country == o.country && + city == o.city && + country_code == o.country_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [street_address, state, postal_code, country, city, country_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_properties_barcode_inner.rb b/lib/onfido/models/document_properties_barcode_inner.rb new file mode 100644 index 0000000..f49b95e --- /dev/null +++ b/lib/onfido/models/document_properties_barcode_inner.rb @@ -0,0 +1,367 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentPropertiesBarcodeInner + attr_accessor :first_name + + attr_accessor :middle_name + + attr_accessor :last_name + + attr_accessor :document_type + + attr_accessor :date_of_expiry + + attr_accessor :date_of_birth + + attr_accessor :issuing_date + + attr_accessor :address_line_1 + + attr_accessor :address_line_2 + + attr_accessor :address_line_3 + + attr_accessor :address_line_4 + + attr_accessor :address_line_5 + + attr_accessor :issuing_state + + attr_accessor :_class + + attr_accessor :gender + + attr_accessor :issuing_country + + attr_accessor :document_number + + attr_accessor :real_id_classification + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'first_name' => :'first_name', + :'middle_name' => :'middle_name', + :'last_name' => :'last_name', + :'document_type' => :'document_type', + :'date_of_expiry' => :'date_of_expiry', + :'date_of_birth' => :'date_of_birth', + :'issuing_date' => :'issuing_date', + :'address_line_1' => :'address_line_1', + :'address_line_2' => :'address_line_2', + :'address_line_3' => :'address_line_3', + :'address_line_4' => :'address_line_4', + :'address_line_5' => :'address_line_5', + :'issuing_state' => :'issuing_state', + :'_class' => :'class', + :'gender' => :'gender', + :'issuing_country' => :'issuing_country', + :'document_number' => :'document_number', + :'real_id_classification' => :'real_id_classification' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'first_name' => :'String', + :'middle_name' => :'String', + :'last_name' => :'String', + :'document_type' => :'String', + :'date_of_expiry' => :'Date', + :'date_of_birth' => :'Date', + :'issuing_date' => :'Date', + :'address_line_1' => :'String', + :'address_line_2' => :'String', + :'address_line_3' => :'String', + :'address_line_4' => :'String', + :'address_line_5' => :'String', + :'issuing_state' => :'String', + :'_class' => :'String', + :'gender' => :'String', + :'issuing_country' => :'String', + :'document_number' => :'String', + :'real_id_classification' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentPropertiesBarcodeInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentPropertiesBarcodeInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'middle_name') + self.middle_name = attributes[:'middle_name'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'date_of_expiry') + self.date_of_expiry = attributes[:'date_of_expiry'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'issuing_date') + self.issuing_date = attributes[:'issuing_date'] + end + + if attributes.key?(:'address_line_1') + self.address_line_1 = attributes[:'address_line_1'] + end + + if attributes.key?(:'address_line_2') + self.address_line_2 = attributes[:'address_line_2'] + end + + if attributes.key?(:'address_line_3') + self.address_line_3 = attributes[:'address_line_3'] + end + + if attributes.key?(:'address_line_4') + self.address_line_4 = attributes[:'address_line_4'] + end + + if attributes.key?(:'address_line_5') + self.address_line_5 = attributes[:'address_line_5'] + end + + if attributes.key?(:'issuing_state') + self.issuing_state = attributes[:'issuing_state'] + end + + if attributes.key?(:'_class') + self._class = attributes[:'_class'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'document_number') + self.document_number = attributes[:'document_number'] + end + + if attributes.key?(:'real_id_classification') + self.real_id_classification = attributes[:'real_id_classification'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_name == o.first_name && + middle_name == o.middle_name && + last_name == o.last_name && + document_type == o.document_type && + date_of_expiry == o.date_of_expiry && + date_of_birth == o.date_of_birth && + issuing_date == o.issuing_date && + address_line_1 == o.address_line_1 && + address_line_2 == o.address_line_2 && + address_line_3 == o.address_line_3 && + address_line_4 == o.address_line_4 && + address_line_5 == o.address_line_5 && + issuing_state == o.issuing_state && + _class == o._class && + gender == o.gender && + issuing_country == o.issuing_country && + document_number == o.document_number && + real_id_classification == o.real_id_classification + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [first_name, middle_name, last_name, document_type, date_of_expiry, date_of_birth, issuing_date, address_line_1, address_line_2, address_line_3, address_line_4, address_line_5, issuing_state, _class, gender, issuing_country, document_number, real_id_classification].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_properties_document_classification.rb b/lib/onfido/models/document_properties_document_classification.rb new file mode 100644 index 0000000..b6e291a --- /dev/null +++ b/lib/onfido/models/document_properties_document_classification.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentPropertiesDocumentClassification + attr_accessor :issuing_country + + attr_accessor :document_type + + attr_accessor :issuing_state + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'issuing_country' => :'issuing_country', + :'document_type' => :'document_type', + :'issuing_state' => :'issuing_state' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'issuing_country' => :'String', + :'document_type' => :'String', + :'issuing_state' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentPropertiesDocumentClassification` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentPropertiesDocumentClassification`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'issuing_state') + self.issuing_state = attributes[:'issuing_state'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + issuing_country == o.issuing_country && + document_type == o.document_type && + issuing_state == o.issuing_state + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [issuing_country, document_type, issuing_state].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_properties_document_numbers_inner.rb b/lib/onfido/models/document_properties_document_numbers_inner.rb new file mode 100644 index 0000000..071064c --- /dev/null +++ b/lib/onfido/models/document_properties_document_numbers_inner.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentPropertiesDocumentNumbersInner + attr_accessor :value + + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'value' => :'value', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'value' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentPropertiesDocumentNumbersInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentPropertiesDocumentNumbersInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + value == o.value && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [value, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_properties_driving_licence_information.rb b/lib/onfido/models/document_properties_driving_licence_information.rb new file mode 100644 index 0000000..e4c48f0 --- /dev/null +++ b/lib/onfido/models/document_properties_driving_licence_information.rb @@ -0,0 +1,241 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentPropertiesDrivingLicenceInformation + attr_accessor :category + + attr_accessor :obtainment_date + + attr_accessor :expiry_date + + attr_accessor :codes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category' => :'category', + :'obtainment_date' => :'obtainment_date', + :'expiry_date' => :'expiry_date', + :'codes' => :'codes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'category' => :'String', + :'obtainment_date' => :'Date', + :'expiry_date' => :'Date', + :'codes' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentPropertiesDrivingLicenceInformation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentPropertiesDrivingLicenceInformation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'obtainment_date') + self.obtainment_date = attributes[:'obtainment_date'] + end + + if attributes.key?(:'expiry_date') + self.expiry_date = attributes[:'expiry_date'] + end + + if attributes.key?(:'codes') + self.codes = attributes[:'codes'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + obtainment_date == o.obtainment_date && + expiry_date == o.expiry_date && + codes == o.codes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [category, obtainment_date, expiry_date, codes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_properties_extracted_data.rb b/lib/onfido/models/document_properties_extracted_data.rb new file mode 100644 index 0000000..c47d0b7 --- /dev/null +++ b/lib/onfido/models/document_properties_extracted_data.rb @@ -0,0 +1,394 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentPropertiesExtractedData + attr_accessor :document_number + + attr_accessor :date_of_birth + + attr_accessor :date_of_expiry + + attr_accessor :first_name + + attr_accessor :last_name + + attr_accessor :middle_name + + attr_accessor :full_name + + attr_accessor :spouse_name + + attr_accessor :widow_name + + attr_accessor :alias_name + + attr_accessor :gender + + attr_accessor :mrz_line1 + + attr_accessor :mrz_line2 + + attr_accessor :mrz_line3 + + attr_accessor :nationality + + attr_accessor :address_line_1 + + attr_accessor :address_line_2 + + attr_accessor :address_line_3 + + attr_accessor :address_line_4 + + attr_accessor :address_line_5 + + attr_accessor :issuing_authority + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'document_number' => :'document_number', + :'date_of_birth' => :'date_of_birth', + :'date_of_expiry' => :'date_of_expiry', + :'first_name' => :'first_name', + :'last_name' => :'last_name', + :'middle_name' => :'middle_name', + :'full_name' => :'full_name', + :'spouse_name' => :'spouse_name', + :'widow_name' => :'widow_name', + :'alias_name' => :'alias_name', + :'gender' => :'gender', + :'mrz_line1' => :'mrz_line1', + :'mrz_line2' => :'mrz_line2', + :'mrz_line3' => :'mrz_line3', + :'nationality' => :'nationality', + :'address_line_1' => :'address_line_1', + :'address_line_2' => :'address_line_2', + :'address_line_3' => :'address_line_3', + :'address_line_4' => :'address_line_4', + :'address_line_5' => :'address_line_5', + :'issuing_authority' => :'issuing_authority' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'document_number' => :'String', + :'date_of_birth' => :'Date', + :'date_of_expiry' => :'Date', + :'first_name' => :'String', + :'last_name' => :'String', + :'middle_name' => :'String', + :'full_name' => :'String', + :'spouse_name' => :'String', + :'widow_name' => :'String', + :'alias_name' => :'String', + :'gender' => :'String', + :'mrz_line1' => :'String', + :'mrz_line2' => :'String', + :'mrz_line3' => :'String', + :'nationality' => :'String', + :'address_line_1' => :'String', + :'address_line_2' => :'String', + :'address_line_3' => :'String', + :'address_line_4' => :'String', + :'address_line_5' => :'String', + :'issuing_authority' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentPropertiesExtractedData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentPropertiesExtractedData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'document_number') + self.document_number = attributes[:'document_number'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'date_of_expiry') + self.date_of_expiry = attributes[:'date_of_expiry'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'middle_name') + self.middle_name = attributes[:'middle_name'] + end + + if attributes.key?(:'full_name') + self.full_name = attributes[:'full_name'] + end + + if attributes.key?(:'spouse_name') + self.spouse_name = attributes[:'spouse_name'] + end + + if attributes.key?(:'widow_name') + self.widow_name = attributes[:'widow_name'] + end + + if attributes.key?(:'alias_name') + self.alias_name = attributes[:'alias_name'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'mrz_line1') + self.mrz_line1 = attributes[:'mrz_line1'] + end + + if attributes.key?(:'mrz_line2') + self.mrz_line2 = attributes[:'mrz_line2'] + end + + if attributes.key?(:'mrz_line3') + self.mrz_line3 = attributes[:'mrz_line3'] + end + + if attributes.key?(:'nationality') + self.nationality = attributes[:'nationality'] + end + + if attributes.key?(:'address_line_1') + self.address_line_1 = attributes[:'address_line_1'] + end + + if attributes.key?(:'address_line_2') + self.address_line_2 = attributes[:'address_line_2'] + end + + if attributes.key?(:'address_line_3') + self.address_line_3 = attributes[:'address_line_3'] + end + + if attributes.key?(:'address_line_4') + self.address_line_4 = attributes[:'address_line_4'] + end + + if attributes.key?(:'address_line_5') + self.address_line_5 = attributes[:'address_line_5'] + end + + if attributes.key?(:'issuing_authority') + self.issuing_authority = attributes[:'issuing_authority'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document_number == o.document_number && + date_of_birth == o.date_of_birth && + date_of_expiry == o.date_of_expiry && + first_name == o.first_name && + last_name == o.last_name && + middle_name == o.middle_name && + full_name == o.full_name && + spouse_name == o.spouse_name && + widow_name == o.widow_name && + alias_name == o.alias_name && + gender == o.gender && + mrz_line1 == o.mrz_line1 && + mrz_line2 == o.mrz_line2 && + mrz_line3 == o.mrz_line3 && + nationality == o.nationality && + address_line_1 == o.address_line_1 && + address_line_2 == o.address_line_2 && + address_line_3 == o.address_line_3 && + address_line_4 == o.address_line_4 && + address_line_5 == o.address_line_5 && + issuing_authority == o.issuing_authority + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [document_number, date_of_birth, date_of_expiry, first_name, last_name, middle_name, full_name, spouse_name, widow_name, alias_name, gender, mrz_line1, mrz_line2, mrz_line3, nationality, address_line_1, address_line_2, address_line_3, address_line_4, address_line_5, issuing_authority].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_properties_nfc.rb b/lib/onfido/models/document_properties_nfc.rb new file mode 100644 index 0000000..0842125 --- /dev/null +++ b/lib/onfido/models/document_properties_nfc.rb @@ -0,0 +1,322 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentPropertiesNfc + attr_accessor :document_type + + attr_accessor :issuing_country + + attr_accessor :full_name + + attr_accessor :document_number + + attr_accessor :nationality + + attr_accessor :date_of_birth + + attr_accessor :gender + + attr_accessor :date_of_expiry + + attr_accessor :personal_number + + attr_accessor :place_of_birth + + attr_accessor :address + + attr_accessor :issuing_date + + attr_accessor :issuing_authority + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'document_type' => :'document_type', + :'issuing_country' => :'issuing_country', + :'full_name' => :'full_name', + :'document_number' => :'document_number', + :'nationality' => :'nationality', + :'date_of_birth' => :'date_of_birth', + :'gender' => :'gender', + :'date_of_expiry' => :'date_of_expiry', + :'personal_number' => :'personal_number', + :'place_of_birth' => :'place_of_birth', + :'address' => :'address', + :'issuing_date' => :'issuing_date', + :'issuing_authority' => :'issuing_authority' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'document_type' => :'String', + :'issuing_country' => :'String', + :'full_name' => :'String', + :'document_number' => :'String', + :'nationality' => :'String', + :'date_of_birth' => :'Date', + :'gender' => :'String', + :'date_of_expiry' => :'Date', + :'personal_number' => :'String', + :'place_of_birth' => :'String', + :'address' => :'String', + :'issuing_date' => :'Date', + :'issuing_authority' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentPropertiesNfc` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentPropertiesNfc`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'full_name') + self.full_name = attributes[:'full_name'] + end + + if attributes.key?(:'document_number') + self.document_number = attributes[:'document_number'] + end + + if attributes.key?(:'nationality') + self.nationality = attributes[:'nationality'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'date_of_expiry') + self.date_of_expiry = attributes[:'date_of_expiry'] + end + + if attributes.key?(:'personal_number') + self.personal_number = attributes[:'personal_number'] + end + + if attributes.key?(:'place_of_birth') + self.place_of_birth = attributes[:'place_of_birth'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'issuing_date') + self.issuing_date = attributes[:'issuing_date'] + end + + if attributes.key?(:'issuing_authority') + self.issuing_authority = attributes[:'issuing_authority'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document_type == o.document_type && + issuing_country == o.issuing_country && + full_name == o.full_name && + document_number == o.document_number && + nationality == o.nationality && + date_of_birth == o.date_of_birth && + gender == o.gender && + date_of_expiry == o.date_of_expiry && + personal_number == o.personal_number && + place_of_birth == o.place_of_birth && + address == o.address && + issuing_date == o.issuing_date && + issuing_authority == o.issuing_authority + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [document_type, issuing_country, full_name, document_number, nationality, date_of_birth, gender, date_of_expiry, personal_number, place_of_birth, address, issuing_date, issuing_authority].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_report.rb b/lib/onfido/models/document_report.rb new file mode 100644 index 0000000..5a34a86 --- /dev/null +++ b/lib/onfido/models/document_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'DocumentBreakdown', + :'properties' => :'DocumentProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_response.rb b/lib/onfido/models/document_response.rb new file mode 100644 index 0000000..c788d29 --- /dev/null +++ b/lib/onfido/models/document_response.rb @@ -0,0 +1,272 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentResponse + # The unique identifier for the document + attr_accessor :id + + # The date and time at which the document was uploaded + attr_accessor :created_at + + # The uri of this resource + attr_accessor :href + + # The uri that can be used to download the document + attr_accessor :download_href + + # The name of the uploaded file + attr_accessor :file_name + + # The size of the file in bytes + attr_accessor :file_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'download_href' => :'download_href', + :'file_name' => :'file_name', + :'file_size' => :'file_size' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'download_href' => :'String', + :'file_name' => :'String', + :'file_size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'download_href') + self.download_href = attributes[:'download_href'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + download_href == o.download_href && + file_name == o.file_name && + file_size == o.file_size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, download_href, file_name, file_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_shared.rb b/lib/onfido/models/document_shared.rb new file mode 100644 index 0000000..5bfc1a1 --- /dev/null +++ b/lib/onfido/models/document_shared.rb @@ -0,0 +1,301 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentShared + # The file type of the uploaded file + attr_accessor :file_type + + # The type of document + attr_accessor :type + + # The side of the document, if applicable. The possible values are front and back + attr_accessor :side + + # The issuing country of the document, a 3-letter ISO code. + attr_accessor :issuing_country + + # The ID of the applicant whose document is being uploaded. + attr_accessor :applicant_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'file_type' => :'file_type', + :'type' => :'type', + :'side' => :'side', + :'issuing_country' => :'issuing_country', + :'applicant_id' => :'applicant_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'file_type' => :'String', + :'type' => :'String', + :'side' => :'String', + :'issuing_country' => :'CountryCodes', + :'applicant_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'file_type') + self.file_type = attributes[:'file_type'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'side') + self.side = attributes[:'side'] + end + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + file_type_validator = EnumAttributeValidator.new('String', ["jpg", "png", "pdf", "unknown_default_open_api"]) + return false unless file_type_validator.valid?(@file_type) + side_validator = EnumAttributeValidator.new('String', ["front", "back", "unknown_default_open_api"]) + return false unless side_validator.valid?(@side) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] file_type Object to be assigned + def file_type=(file_type) + validator = EnumAttributeValidator.new('String', ["jpg", "png", "pdf", "unknown_default_open_api"]) + unless validator.valid?(file_type) + fail ArgumentError, "invalid value for \"file_type\", must be one of #{validator.allowable_values}." + end + @file_type = file_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] side Object to be assigned + def side=(side) + validator = EnumAttributeValidator.new('String', ["front", "back", "unknown_default_open_api"]) + unless validator.valid?(side) + fail ArgumentError, "invalid value for \"side\", must be one of #{validator.allowable_values}." + end + @side = side + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + file_type == o.file_type && + type == o.type && + side == o.side && + issuing_country == o.issuing_country && + applicant_id == o.applicant_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [file_type, type, side, issuing_country, applicant_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_types.rb b/lib/onfido/models/document_types.rb new file mode 100644 index 0000000..6af7c62 --- /dev/null +++ b/lib/onfido/models/document_types.rb @@ -0,0 +1,64 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentTypes + PASSPORT = "passport".freeze + DRIVING_LICENCE = "driving_licence".freeze + NATIONAL_IDENTITY_CARD = "national_identity_card".freeze + RESIDENCE_PERMIT = "residence_permit".freeze + PASSPORT_CARD = "passport_card".freeze + TAX_ID = "tax_id".freeze + VISA = "visa".freeze + VOTER_ID = "voter_id".freeze + RESIDENCE_STATUS_DOCUMENT = "residence_status_document".freeze + POSTAL_IDENTITY_CARD = "postal_identity_card".freeze + SOCIAL_SECURITY_CARD = "social_security_card".freeze + WORK_PERMIT = "work_permit".freeze + ASYLUM_REGISTRATION_CARD = "asylum_registration_card".freeze + NATIONAL_HEALTH_INSURANCE_CARD = "national_health_insurance_card".freeze + MUNICIPALITY_IDENTITY_CARD = "municipality_identity_card".freeze + PRIVATE_OPERATORS_CARD = "private_operators_card".freeze + PROOF_OF_CITIZENSHIP = "proof_of_citizenship".freeze + SERVICE_ID_CARD = "service_id_card".freeze + IMMIGRATION_STATUS_DOCUMENT = "immigration_status_document".freeze + INDIGENOUS_CARD = "indigenous_card".freeze + VEHICLE_REGISTRATION_CARD = "vehicle_registration_card".freeze + CERTIFICATE_OF_NATURALISATION = "certificate_of_naturalisation".freeze + PROFESSIONAL_QUALIFICATION_CARD = "professional_qualification_card".freeze + CONSULAR_ID = "consular_id".freeze + INTERNATIONAL_DRIVING_LICENCE = "international_driving_licence".freeze + UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze + + def self.all_vars + @all_vars ||= [PASSPORT, DRIVING_LICENCE, NATIONAL_IDENTITY_CARD, RESIDENCE_PERMIT, PASSPORT_CARD, TAX_ID, VISA, VOTER_ID, RESIDENCE_STATUS_DOCUMENT, POSTAL_IDENTITY_CARD, SOCIAL_SECURITY_CARD, WORK_PERMIT, ASYLUM_REGISTRATION_CARD, NATIONAL_HEALTH_INSURANCE_CARD, MUNICIPALITY_IDENTITY_CARD, PRIVATE_OPERATORS_CARD, PROOF_OF_CITIZENSHIP, SERVICE_ID_CARD, IMMIGRATION_STATUS_DOCUMENT, INDIGENOUS_CARD, VEHICLE_REGISTRATION_CARD, CERTIFICATE_OF_NATURALISATION, PROFESSIONAL_QUALIFICATION_CARD, CONSULAR_ID, INTERNATIONAL_DRIVING_LICENCE, UNKNOWN_DEFAULT_OPEN_API].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if DocumentTypes.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #DocumentTypes" + end + end +end diff --git a/lib/onfido/models/document_video_report.rb b/lib/onfido/models/document_video_report.rb new file mode 100644 index 0000000..81bfe30 --- /dev/null +++ b/lib/onfido/models/document_video_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentVideoReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'DocumentBreakdown', + :'properties' => :'DocumentProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentVideoReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentVideoReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_video_with_address_information_report.rb b/lib/onfido/models/document_video_with_address_information_report.rb new file mode 100644 index 0000000..61239c7 --- /dev/null +++ b/lib/onfido/models/document_video_with_address_information_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentVideoWithAddressInformationReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'DocumentBreakdown', + :'properties' => :'DocumentProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentVideoWithAddressInformationReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentVideoWithAddressInformationReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_with_address_information_report.rb b/lib/onfido/models/document_with_address_information_report.rb new file mode 100644 index 0000000..b5f6927 --- /dev/null +++ b/lib/onfido/models/document_with_address_information_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentWithAddressInformationReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'DocumentBreakdown', + :'properties' => :'DocumentProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentWithAddressInformationReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentWithAddressInformationReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_with_driver_verification_report.rb b/lib/onfido/models/document_with_driver_verification_report.rb new file mode 100644 index 0000000..a5ceec9 --- /dev/null +++ b/lib/onfido/models/document_with_driver_verification_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentWithDriverVerificationReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'DocumentBreakdown', + :'properties' => :'DocumentWithDriverVerificationReportAllOfProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentWithDriverVerificationReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentWithDriverVerificationReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_with_driver_verification_report_all_of_properties.rb b/lib/onfido/models/document_with_driver_verification_report_all_of_properties.rb new file mode 100644 index 0000000..049f4ee --- /dev/null +++ b/lib/onfido/models/document_with_driver_verification_report_all_of_properties.rb @@ -0,0 +1,529 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentWithDriverVerificationReportAllOfProperties + attr_accessor :date_of_birth + + attr_accessor :date_of_expiry + + attr_accessor :document_numbers + + attr_accessor :document_type + + attr_accessor :first_name + + attr_accessor :gender + + attr_accessor :issuing_country + + attr_accessor :last_name + + attr_accessor :nationality + + attr_accessor :issuing_state + + attr_accessor :issuing_date + + attr_accessor :categorisation + + attr_accessor :mrz_line1 + + attr_accessor :mrz_line2 + + attr_accessor :mrz_line3 + + attr_accessor :address + + attr_accessor :place_of_birth + + attr_accessor :spouse_name + + attr_accessor :widow_name + + attr_accessor :alias_name + + attr_accessor :issuing_authority + + attr_accessor :real_id_compliance + + attr_accessor :address_lines + + attr_accessor :barcode + + attr_accessor :nfc + + attr_accessor :driving_licence_information + + attr_accessor :document_classification + + attr_accessor :extracted_data + + # True for **non-restricted** driving licences + attr_accessor :drivers_licence + + # True for **limited/restricted** driving license, including learner's permits + attr_accessor :restricted_licence + + # Underlying, non-normalised, licence category (e.g. \"Junior operators license\") + attr_accessor :raw_licence_category + + # Comma-separated vehicle classes that the user is qualified for + attr_accessor :raw_vehicle_classes + + # Detailed classes/categories information + attr_accessor :vehicle_class_details + + attr_accessor :passenger_vehicle + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'date_of_birth' => :'date_of_birth', + :'date_of_expiry' => :'date_of_expiry', + :'document_numbers' => :'document_numbers', + :'document_type' => :'document_type', + :'first_name' => :'first_name', + :'gender' => :'gender', + :'issuing_country' => :'issuing_country', + :'last_name' => :'last_name', + :'nationality' => :'nationality', + :'issuing_state' => :'issuing_state', + :'issuing_date' => :'issuing_date', + :'categorisation' => :'categorisation', + :'mrz_line1' => :'mrz_line1', + :'mrz_line2' => :'mrz_line2', + :'mrz_line3' => :'mrz_line3', + :'address' => :'address', + :'place_of_birth' => :'place_of_birth', + :'spouse_name' => :'spouse_name', + :'widow_name' => :'widow_name', + :'alias_name' => :'alias_name', + :'issuing_authority' => :'issuing_authority', + :'real_id_compliance' => :'real_id_compliance', + :'address_lines' => :'address_lines', + :'barcode' => :'barcode', + :'nfc' => :'nfc', + :'driving_licence_information' => :'driving_licence_information', + :'document_classification' => :'document_classification', + :'extracted_data' => :'extracted_data', + :'drivers_licence' => :'drivers_licence', + :'restricted_licence' => :'restricted_licence', + :'raw_licence_category' => :'raw_licence_category', + :'raw_vehicle_classes' => :'raw_vehicle_classes', + :'vehicle_class_details' => :'vehicle_class_details', + :'passenger_vehicle' => :'passenger_vehicle' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'date_of_birth' => :'Date', + :'date_of_expiry' => :'Date', + :'document_numbers' => :'Array', + :'document_type' => :'String', + :'first_name' => :'String', + :'gender' => :'String', + :'issuing_country' => :'String', + :'last_name' => :'String', + :'nationality' => :'String', + :'issuing_state' => :'String', + :'issuing_date' => :'Date', + :'categorisation' => :'String', + :'mrz_line1' => :'String', + :'mrz_line2' => :'String', + :'mrz_line3' => :'String', + :'address' => :'String', + :'place_of_birth' => :'String', + :'spouse_name' => :'String', + :'widow_name' => :'String', + :'alias_name' => :'String', + :'issuing_authority' => :'String', + :'real_id_compliance' => :'Boolean', + :'address_lines' => :'DocumentPropertiesAddressLines', + :'barcode' => :'Array', + :'nfc' => :'DocumentPropertiesNfc', + :'driving_licence_information' => :'DocumentPropertiesDrivingLicenceInformation', + :'document_classification' => :'DocumentPropertiesDocumentClassification', + :'extracted_data' => :'DocumentPropertiesExtractedData', + :'drivers_licence' => :'Boolean', + :'restricted_licence' => :'Boolean', + :'raw_licence_category' => :'String', + :'raw_vehicle_classes' => :'String', + :'vehicle_class_details' => :'Array', + :'passenger_vehicle' => :'DocumentWithDriverVerificationReportAllOfPropertiesAllOfPassengerVehicle' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DocumentProperties' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentWithDriverVerificationReportAllOfProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentWithDriverVerificationReportAllOfProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'date_of_expiry') + self.date_of_expiry = attributes[:'date_of_expiry'] + end + + if attributes.key?(:'document_numbers') + if (value = attributes[:'document_numbers']).is_a?(Array) + self.document_numbers = value + end + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'nationality') + self.nationality = attributes[:'nationality'] + end + + if attributes.key?(:'issuing_state') + self.issuing_state = attributes[:'issuing_state'] + end + + if attributes.key?(:'issuing_date') + self.issuing_date = attributes[:'issuing_date'] + end + + if attributes.key?(:'categorisation') + self.categorisation = attributes[:'categorisation'] + end + + if attributes.key?(:'mrz_line1') + self.mrz_line1 = attributes[:'mrz_line1'] + end + + if attributes.key?(:'mrz_line2') + self.mrz_line2 = attributes[:'mrz_line2'] + end + + if attributes.key?(:'mrz_line3') + self.mrz_line3 = attributes[:'mrz_line3'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'place_of_birth') + self.place_of_birth = attributes[:'place_of_birth'] + end + + if attributes.key?(:'spouse_name') + self.spouse_name = attributes[:'spouse_name'] + end + + if attributes.key?(:'widow_name') + self.widow_name = attributes[:'widow_name'] + end + + if attributes.key?(:'alias_name') + self.alias_name = attributes[:'alias_name'] + end + + if attributes.key?(:'issuing_authority') + self.issuing_authority = attributes[:'issuing_authority'] + end + + if attributes.key?(:'real_id_compliance') + self.real_id_compliance = attributes[:'real_id_compliance'] + end + + if attributes.key?(:'address_lines') + self.address_lines = attributes[:'address_lines'] + end + + if attributes.key?(:'barcode') + if (value = attributes[:'barcode']).is_a?(Array) + self.barcode = value + end + end + + if attributes.key?(:'nfc') + self.nfc = attributes[:'nfc'] + end + + if attributes.key?(:'driving_licence_information') + self.driving_licence_information = attributes[:'driving_licence_information'] + end + + if attributes.key?(:'document_classification') + self.document_classification = attributes[:'document_classification'] + end + + if attributes.key?(:'extracted_data') + self.extracted_data = attributes[:'extracted_data'] + end + + if attributes.key?(:'drivers_licence') + self.drivers_licence = attributes[:'drivers_licence'] + end + + if attributes.key?(:'restricted_licence') + self.restricted_licence = attributes[:'restricted_licence'] + end + + if attributes.key?(:'raw_licence_category') + self.raw_licence_category = attributes[:'raw_licence_category'] + end + + if attributes.key?(:'raw_vehicle_classes') + self.raw_vehicle_classes = attributes[:'raw_vehicle_classes'] + end + + if attributes.key?(:'vehicle_class_details') + if (value = attributes[:'vehicle_class_details']).is_a?(Array) + self.vehicle_class_details = value + end + end + + if attributes.key?(:'passenger_vehicle') + self.passenger_vehicle = attributes[:'passenger_vehicle'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + date_of_birth == o.date_of_birth && + date_of_expiry == o.date_of_expiry && + document_numbers == o.document_numbers && + document_type == o.document_type && + first_name == o.first_name && + gender == o.gender && + issuing_country == o.issuing_country && + last_name == o.last_name && + nationality == o.nationality && + issuing_state == o.issuing_state && + issuing_date == o.issuing_date && + categorisation == o.categorisation && + mrz_line1 == o.mrz_line1 && + mrz_line2 == o.mrz_line2 && + mrz_line3 == o.mrz_line3 && + address == o.address && + place_of_birth == o.place_of_birth && + spouse_name == o.spouse_name && + widow_name == o.widow_name && + alias_name == o.alias_name && + issuing_authority == o.issuing_authority && + real_id_compliance == o.real_id_compliance && + address_lines == o.address_lines && + barcode == o.barcode && + nfc == o.nfc && + driving_licence_information == o.driving_licence_information && + document_classification == o.document_classification && + extracted_data == o.extracted_data && + drivers_licence == o.drivers_licence && + restricted_licence == o.restricted_licence && + raw_licence_category == o.raw_licence_category && + raw_vehicle_classes == o.raw_vehicle_classes && + vehicle_class_details == o.vehicle_class_details && + passenger_vehicle == o.passenger_vehicle + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [date_of_birth, date_of_expiry, document_numbers, document_type, first_name, gender, issuing_country, last_name, nationality, issuing_state, issuing_date, categorisation, mrz_line1, mrz_line2, mrz_line3, address, place_of_birth, spouse_name, widow_name, alias_name, issuing_authority, real_id_compliance, address_lines, barcode, nfc, driving_licence_information, document_classification, extracted_data, drivers_licence, restricted_licence, raw_licence_category, raw_vehicle_classes, vehicle_class_details, passenger_vehicle].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle.rb b/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle.rb new file mode 100644 index 0000000..cfe6fdd --- /dev/null +++ b/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle.rb @@ -0,0 +1,236 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Normalised data for passenger cars + class DocumentWithDriverVerificationReportAllOfPropertiesAllOfPassengerVehicle + # Whether they are qualified for a passenger car, such as a “B” class in the UK + attr_accessor :is_qualified + + # Date the class qualification was obtained + attr_accessor :obtainment_date + + # Date the class qualification expires, which may be different to doc expiry + attr_accessor :expiry_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'is_qualified' => :'is_qualified', + :'obtainment_date' => :'obtainment_date', + :'expiry_date' => :'expiry_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'is_qualified' => :'Boolean', + :'obtainment_date' => :'Date', + :'expiry_date' => :'Date' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentWithDriverVerificationReportAllOfPropertiesAllOfPassengerVehicle` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentWithDriverVerificationReportAllOfPropertiesAllOfPassengerVehicle`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'is_qualified') + self.is_qualified = attributes[:'is_qualified'] + end + + if attributes.key?(:'obtainment_date') + self.obtainment_date = attributes[:'obtainment_date'] + end + + if attributes.key?(:'expiry_date') + self.expiry_date = attributes[:'expiry_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is_qualified == o.is_qualified && + obtainment_date == o.obtainment_date && + expiry_date == o.expiry_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [is_qualified, obtainment_date, expiry_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_vehicle_class_details_inner.rb b/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_vehicle_class_details_inner.rb new file mode 100644 index 0000000..8a699ff --- /dev/null +++ b/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_vehicle_class_details_inner.rb @@ -0,0 +1,245 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentWithDriverVerificationReportAllOfPropertiesAllOfVehicleClassDetailsInner + # Vehicle class/category + attr_accessor :category + + # Special conditions driver must meet + attr_accessor :codes + + # Category obtainment date + attr_accessor :obtainment_date + + # Category expiry date + attr_accessor :expiry_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category' => :'category', + :'codes' => :'codes', + :'obtainment_date' => :'obtainment_date', + :'expiry_date' => :'expiry_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'category' => :'String', + :'codes' => :'String', + :'obtainment_date' => :'Date', + :'expiry_date' => :'Date' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentWithDriverVerificationReportAllOfPropertiesAllOfVehicleClassDetailsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentWithDriverVerificationReportAllOfPropertiesAllOfVehicleClassDetailsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'codes') + self.codes = attributes[:'codes'] + end + + if attributes.key?(:'obtainment_date') + self.obtainment_date = attributes[:'obtainment_date'] + end + + if attributes.key?(:'expiry_date') + self.expiry_date = attributes[:'expiry_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + codes == o.codes && + obtainment_date == o.obtainment_date && + expiry_date == o.expiry_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [category, codes, obtainment_date, expiry_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/document_with_driving_licence_information_report.rb b/lib/onfido/models/document_with_driving_licence_information_report.rb new file mode 100644 index 0000000..4ad9b9c --- /dev/null +++ b/lib/onfido/models/document_with_driving_licence_information_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentWithDrivingLicenceInformationReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'DocumentBreakdown', + :'properties' => :'DocumentProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentWithDrivingLicenceInformationReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentWithDrivingLicenceInformationReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/documents_list.rb b/lib/onfido/models/documents_list.rb new file mode 100644 index 0000000..bfa8a34 --- /dev/null +++ b/lib/onfido/models/documents_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class DocumentsList + attr_accessor :documents + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'documents' => :'documents' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'documents' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::DocumentsList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::DocumentsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + else + self.documents = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @documents.nil? + invalid_properties.push('invalid value for "documents", documents cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @documents.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + documents == o.documents + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [documents].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/error.rb b/lib/onfido/models/error.rb new file mode 100644 index 0000000..2267acd --- /dev/null +++ b/lib/onfido/models/error.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Error + attr_accessor :error + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'error' => :'error' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'error' => :'ErrorProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Error` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [error].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/error1.rb b/lib/onfido/models/error1.rb new file mode 100644 index 0000000..ecb9f1d --- /dev/null +++ b/lib/onfido/models/error1.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Error1 + # The unique identifier of the uploaded document + attr_accessor :document_id + + attr_accessor :error + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'document_id' => :'document_id', + :'error' => :'error' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'document_id' => :'String', + :'error' => :'ErrorProperties1' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Error1` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Error1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'document_id') + self.document_id = attributes[:'document_id'] + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document_id == o.document_id && + error == o.error + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [document_id, error].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/error_properties.rb b/lib/onfido/models/error_properties.rb new file mode 100644 index 0000000..f823254 --- /dev/null +++ b/lib/onfido/models/error_properties.rb @@ -0,0 +1,234 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ErrorProperties + attr_accessor :type + + attr_accessor :message + + attr_accessor :fields + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'message' => :'message', + :'fields' => :'fields' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'message' => :'String', + :'fields' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ErrorProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ErrorProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Hash) + self.fields = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + message == o.message && + fields == o.fields + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, message, fields].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/error_properties1.rb b/lib/onfido/models/error_properties1.rb new file mode 100644 index 0000000..36c7363 --- /dev/null +++ b/lib/onfido/models/error_properties1.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ErrorProperties1 + attr_accessor :type + + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ErrorProperties1` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ErrorProperties1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/extract_request.rb b/lib/onfido/models/extract_request.rb new file mode 100644 index 0000000..5eeea90 --- /dev/null +++ b/lib/onfido/models/extract_request.rb @@ -0,0 +1,222 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ExtractRequest + # The unique identifier of the uploaded document to run extraction on + attr_accessor :document_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'document_id' => :'document_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'document_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ExtractRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ExtractRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'document_id') + self.document_id = attributes[:'document_id'] + else + self.document_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @document_id.nil? + invalid_properties.push('invalid value for "document_id", document_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @document_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document_id == o.document_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [document_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/extraction.rb b/lib/onfido/models/extraction.rb new file mode 100644 index 0000000..97e0e61 --- /dev/null +++ b/lib/onfido/models/extraction.rb @@ -0,0 +1,233 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Extraction + # The unique identifier of the uploaded document. + attr_accessor :document_id + + attr_accessor :document_classification + + attr_accessor :extracted_data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'document_id' => :'document_id', + :'document_classification' => :'document_classification', + :'extracted_data' => :'extracted_data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'document_id' => :'String', + :'document_classification' => :'ExtractionDocumentClassification', + :'extracted_data' => :'ExtractionExtractedData' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Extraction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Extraction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'document_id') + self.document_id = attributes[:'document_id'] + end + + if attributes.key?(:'document_classification') + self.document_classification = attributes[:'document_classification'] + end + + if attributes.key?(:'extracted_data') + self.extracted_data = attributes[:'extracted_data'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document_id == o.document_id && + document_classification == o.document_classification && + extracted_data == o.extracted_data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [document_id, document_classification, extracted_data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/extraction_document_classification.rb b/lib/onfido/models/extraction_document_classification.rb new file mode 100644 index 0000000..107f8cf --- /dev/null +++ b/lib/onfido/models/extraction_document_classification.rb @@ -0,0 +1,289 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ExtractionDocumentClassification + # Document country in 3-letter ISO code. + attr_accessor :issuing_country + + # Type of document. + attr_accessor :document_type + + # The state that issued the document (if available). + attr_accessor :issuing_state + + # The document subtype (if available). + attr_accessor :subtype + + # The document issuing version (if available). + attr_accessor :version + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'issuing_country' => :'issuing_country', + :'document_type' => :'document_type', + :'issuing_state' => :'issuing_state', + :'subtype' => :'subtype', + :'version' => :'version' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'issuing_country' => :'CountryCodes', + :'document_type' => :'DocumentTypes', + :'issuing_state' => :'String', + :'subtype' => :'String', + :'version' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ExtractionDocumentClassification` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ExtractionDocumentClassification`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'issuing_state') + self.issuing_state = attributes[:'issuing_state'] + end + + if attributes.key?(:'subtype') + self.subtype = attributes[:'subtype'] + end + + if attributes.key?(:'version') + self.version = attributes[:'version'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + subtype_validator = EnumAttributeValidator.new('String', ["full", "not_full", "provisional", "unknown_default_open_api"]) + return false unless subtype_validator.valid?(@subtype) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] subtype Object to be assigned + def subtype=(subtype) + validator = EnumAttributeValidator.new('String', ["full", "not_full", "provisional", "unknown_default_open_api"]) + unless validator.valid?(subtype) + fail ArgumentError, "invalid value for \"subtype\", must be one of #{validator.allowable_values}." + end + @subtype = subtype + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + issuing_country == o.issuing_country && + document_type == o.document_type && + issuing_state == o.issuing_state && + subtype == o.subtype && + version == o.version + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [issuing_country, document_type, issuing_state, subtype, version].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/extraction_extracted_data.rb b/lib/onfido/models/extraction_extracted_data.rb new file mode 100644 index 0000000..8fbf026 --- /dev/null +++ b/lib/onfido/models/extraction_extracted_data.rb @@ -0,0 +1,530 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ExtractionExtractedData + # The official document number. + attr_accessor :document_number + + # First name. + attr_accessor :first_name + + # Last name. + attr_accessor :last_name + + # Full name. + attr_accessor :full_name + + # Spouse name (French documents only). + attr_accessor :spouse_name + + # Widow name (French documents only). + attr_accessor :widow_name + + # Alias name (French documents only). + attr_accessor :alias_name + + # Gender (Valid values are Male and Female). + attr_accessor :gender + + # Date of birth in YYYY-MM-DD format. + attr_accessor :date_of_birth + + # Date of expiry in YYYY-MM-DD format. + attr_accessor :date_of_expiry + + # Date of expiry in YYYY-MM-DD format. + attr_accessor :expiry_date + + # Nationality in 3-letter ISO code. + attr_accessor :nationality + + # Line 1 of the MRZ code. + attr_accessor :mrz_line_1 + + # Line 2 of the MRZ code. + attr_accessor :mrz_line_2 + + # Line 3 of the MRZ code. + attr_accessor :mrz_line_3 + + # Line 1 of the address. + attr_accessor :address_1 + + # Line 2 of the address. + attr_accessor :address_2 + + # Line 3 of the address. + attr_accessor :address_3 + + # Line 4 of the address. + attr_accessor :address_4 + + # Line 5 of the address. + attr_accessor :address_5 + + # Issuing authority. + attr_accessor :issuing_authority + + # Document country in 3-letter ISO code. + attr_accessor :issuing_country + + # Type of document. + attr_accessor :document_type + + # Place of birth. + attr_accessor :place_of_birth + + # The state that issued the document. + attr_accessor :issuing_state + + # Issuing date in YYYY-MM-DD format. + attr_accessor :issuing_date + + # The owner's unique identification number. + attr_accessor :personal_number + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'document_number' => :'document_number', + :'first_name' => :'first_name', + :'last_name' => :'last_name', + :'full_name' => :'full_name', + :'spouse_name' => :'spouse_name', + :'widow_name' => :'widow_name', + :'alias_name' => :'alias_name', + :'gender' => :'gender', + :'date_of_birth' => :'date_of_birth', + :'date_of_expiry' => :'date_of_expiry', + :'expiry_date' => :'expiry_date', + :'nationality' => :'nationality', + :'mrz_line_1' => :'mrz_line_1', + :'mrz_line_2' => :'mrz_line_2', + :'mrz_line_3' => :'mrz_line_3', + :'address_1' => :'address_1', + :'address_2' => :'address_2', + :'address_3' => :'address_3', + :'address_4' => :'address_4', + :'address_5' => :'address_5', + :'issuing_authority' => :'issuing_authority', + :'issuing_country' => :'issuing_country', + :'document_type' => :'document_type', + :'place_of_birth' => :'place_of_birth', + :'issuing_state' => :'issuing_state', + :'issuing_date' => :'issuing_date', + :'personal_number' => :'personal_number' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'document_number' => :'String', + :'first_name' => :'String', + :'last_name' => :'String', + :'full_name' => :'String', + :'spouse_name' => :'String', + :'widow_name' => :'String', + :'alias_name' => :'String', + :'gender' => :'String', + :'date_of_birth' => :'Date', + :'date_of_expiry' => :'Date', + :'expiry_date' => :'Date', + :'nationality' => :'String', + :'mrz_line_1' => :'String', + :'mrz_line_2' => :'String', + :'mrz_line_3' => :'String', + :'address_1' => :'String', + :'address_2' => :'String', + :'address_3' => :'String', + :'address_4' => :'String', + :'address_5' => :'String', + :'issuing_authority' => :'String', + :'issuing_country' => :'CountryCodes', + :'document_type' => :'DocumentTypes', + :'place_of_birth' => :'String', + :'issuing_state' => :'String', + :'issuing_date' => :'Date', + :'personal_number' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ExtractionExtractedData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ExtractionExtractedData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'document_number') + self.document_number = attributes[:'document_number'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'full_name') + self.full_name = attributes[:'full_name'] + end + + if attributes.key?(:'spouse_name') + self.spouse_name = attributes[:'spouse_name'] + end + + if attributes.key?(:'widow_name') + self.widow_name = attributes[:'widow_name'] + end + + if attributes.key?(:'alias_name') + self.alias_name = attributes[:'alias_name'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'date_of_expiry') + self.date_of_expiry = attributes[:'date_of_expiry'] + end + + if attributes.key?(:'expiry_date') + self.expiry_date = attributes[:'expiry_date'] + end + + if attributes.key?(:'nationality') + self.nationality = attributes[:'nationality'] + end + + if attributes.key?(:'mrz_line_1') + self.mrz_line_1 = attributes[:'mrz_line_1'] + end + + if attributes.key?(:'mrz_line_2') + self.mrz_line_2 = attributes[:'mrz_line_2'] + end + + if attributes.key?(:'mrz_line_3') + self.mrz_line_3 = attributes[:'mrz_line_3'] + end + + if attributes.key?(:'address_1') + self.address_1 = attributes[:'address_1'] + end + + if attributes.key?(:'address_2') + self.address_2 = attributes[:'address_2'] + end + + if attributes.key?(:'address_3') + self.address_3 = attributes[:'address_3'] + end + + if attributes.key?(:'address_4') + self.address_4 = attributes[:'address_4'] + end + + if attributes.key?(:'address_5') + self.address_5 = attributes[:'address_5'] + end + + if attributes.key?(:'issuing_authority') + self.issuing_authority = attributes[:'issuing_authority'] + end + + if attributes.key?(:'issuing_country') + self.issuing_country = attributes[:'issuing_country'] + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'place_of_birth') + self.place_of_birth = attributes[:'place_of_birth'] + end + + if attributes.key?(:'issuing_state') + self.issuing_state = attributes[:'issuing_state'] + end + + if attributes.key?(:'issuing_date') + self.issuing_date = attributes[:'issuing_date'] + end + + if attributes.key?(:'personal_number') + self.personal_number = attributes[:'personal_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + pattern = Regexp.new(/^[A-Z]{3}$/) + if !@nationality.nil? && @nationality !~ pattern + invalid_properties.push("invalid value for \"nationality\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + gender_validator = EnumAttributeValidator.new('String', ["Male", "Female", "unknown_default_open_api"]) + return false unless gender_validator.valid?(@gender) + return false if !@nationality.nil? && @nationality !~ Regexp.new(/^[A-Z]{3}$/) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gender Object to be assigned + def gender=(gender) + validator = EnumAttributeValidator.new('String', ["Male", "Female", "unknown_default_open_api"]) + unless validator.valid?(gender) + fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}." + end + @gender = gender + end + + # Custom attribute writer method with validation + # @param [Object] nationality Value to be assigned + def nationality=(nationality) + if nationality.nil? + fail ArgumentError, 'nationality cannot be nil' + end + + pattern = Regexp.new(/^[A-Z]{3}$/) + if nationality !~ pattern + fail ArgumentError, "invalid value for \"nationality\", must conform to the pattern #{pattern}." + end + + @nationality = nationality + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document_number == o.document_number && + first_name == o.first_name && + last_name == o.last_name && + full_name == o.full_name && + spouse_name == o.spouse_name && + widow_name == o.widow_name && + alias_name == o.alias_name && + gender == o.gender && + date_of_birth == o.date_of_birth && + date_of_expiry == o.date_of_expiry && + expiry_date == o.expiry_date && + nationality == o.nationality && + mrz_line_1 == o.mrz_line_1 && + mrz_line_2 == o.mrz_line_2 && + mrz_line_3 == o.mrz_line_3 && + address_1 == o.address_1 && + address_2 == o.address_2 && + address_3 == o.address_3 && + address_4 == o.address_4 && + address_5 == o.address_5 && + issuing_authority == o.issuing_authority && + issuing_country == o.issuing_country && + document_type == o.document_type && + place_of_birth == o.place_of_birth && + issuing_state == o.issuing_state && + issuing_date == o.issuing_date && + personal_number == o.personal_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [document_number, first_name, last_name, full_name, spouse_name, widow_name, alias_name, gender, date_of_birth, date_of_expiry, expiry_date, nationality, mrz_line_1, mrz_line_2, mrz_line_3, address_1, address_2, address_3, address_4, address_5, issuing_authority, issuing_country, document_type, place_of_birth, issuing_state, issuing_date, personal_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown.rb b/lib/onfido/models/facial_similarity_motion_breakdown.rb new file mode 100644 index 0000000..c14d652 --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityMotionBreakdown + attr_accessor :face_comparison + + attr_accessor :image_integrity + + attr_accessor :visual_authenticity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_comparison' => :'face_comparison', + :'image_integrity' => :'image_integrity', + :'visual_authenticity' => :'visual_authenticity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_comparison' => :'FacialSimilarityMotionBreakdownFaceComparison', + :'image_integrity' => :'FacialSimilarityMotionBreakdownImageIntegrity', + :'visual_authenticity' => :'FacialSimilarityMotionBreakdownVisualAuthenticity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_comparison') + self.face_comparison = attributes[:'face_comparison'] + end + + if attributes.key?(:'image_integrity') + self.image_integrity = attributes[:'image_integrity'] + end + + if attributes.key?(:'visual_authenticity') + self.visual_authenticity = attributes[:'visual_authenticity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_comparison == o.face_comparison && + image_integrity == o.image_integrity && + visual_authenticity == o.visual_authenticity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_comparison, image_integrity, visual_authenticity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown_face_comparison.rb b/lib/onfido/models/facial_similarity_motion_breakdown_face_comparison.rb new file mode 100644 index 0000000..bf91318 --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown_face_comparison.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the face in the document matches the face in the motion capture. + class FacialSimilarityMotionBreakdownFaceComparison + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityPhotoBreakdownFaceComparisonBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdownFaceComparison` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdownFaceComparison`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity.rb b/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity.rb new file mode 100644 index 0000000..a2482ca --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the quality and integrity of the uploaded files were sufficient to perform a face comparison. + class FacialSimilarityMotionBreakdownImageIntegrity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityMotionBreakdownImageIntegrityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdownImageIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdownImageIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown.rb b/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown.rb new file mode 100644 index 0000000..bc29843 --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityMotionBreakdownImageIntegrityBreakdown + attr_accessor :face_detected + + attr_accessor :source_integrity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_detected' => :'face_detected', + :'source_integrity' => :'source_integrity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_detected' => :'FacialSimilarityMotionBreakdownImageIntegrityBreakdownFaceDetected', + :'source_integrity' => :'FacialSimilarityMotionBreakdownImageIntegrityBreakdownSourceIntegrity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdownImageIntegrityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdownImageIntegrityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_detected') + self.face_detected = attributes[:'face_detected'] + end + + if attributes.key?(:'source_integrity') + self.source_integrity = attributes[:'source_integrity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_detected == o.face_detected && + source_integrity == o.source_integrity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_detected, source_integrity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_face_detected.rb b/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_face_detected.rb new file mode 100644 index 0000000..285ca44 --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_face_detected.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts a single face of good enough quality has been found in both the document image and in the motion capture. + class FacialSimilarityMotionBreakdownImageIntegrityBreakdownFaceDetected + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdownImageIntegrityBreakdownFaceDetected` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdownImageIntegrityBreakdownFaceDetected`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_source_integrity.rb b/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_source_integrity.rb new file mode 100644 index 0000000..23ee446 --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_source_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the motion capture is trustworthy - e.g. not from a fake webcam. + class FacialSimilarityMotionBreakdownImageIntegrityBreakdownSourceIntegrity + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'VideoReasons' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdownImageIntegrityBreakdownSourceIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdownImageIntegrityBreakdownSourceIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity.rb b/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity.rb new file mode 100644 index 0000000..938d96d --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the person in the motion capture is real (not a spoof) and live. + class FacialSimilarityMotionBreakdownVisualAuthenticity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityMotionBreakdownVisualAuthenticityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdownVisualAuthenticity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdownVisualAuthenticity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown.rb b/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown.rb new file mode 100644 index 0000000..0821459 --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityMotionBreakdownVisualAuthenticityBreakdown + attr_accessor :liveness_detected + + attr_accessor :spoofing_detection + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'liveness_detected' => :'liveness_detected', + :'spoofing_detection' => :'spoofing_detection' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'liveness_detected' => :'FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownLivenessDetected', + :'spoofing_detection' => :'FacialSimilarityMotionBreakdownVisualAuthenticityBreakdownSpoofingDetection' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdownVisualAuthenticityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdownVisualAuthenticityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'liveness_detected') + self.liveness_detected = attributes[:'liveness_detected'] + end + + if attributes.key?(:'spoofing_detection') + self.spoofing_detection = attributes[:'spoofing_detection'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + liveness_detected == o.liveness_detected && + spoofing_detection == o.spoofing_detection + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [liveness_detected, spoofing_detection].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection.rb b/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection.rb new file mode 100644 index 0000000..fb7bd65 --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the motion capture is not a spoof (such as videos of digital screens). + class FacialSimilarityMotionBreakdownVisualAuthenticityBreakdownSpoofingDetection + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetectionProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionBreakdownVisualAuthenticityBreakdownSpoofingDetection` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionBreakdownVisualAuthenticityBreakdownSpoofingDetection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_motion_report.rb b/lib/onfido/models/facial_similarity_motion_report.rb new file mode 100644 index 0000000..1f0135d --- /dev/null +++ b/lib/onfido/models/facial_similarity_motion_report.rb @@ -0,0 +1,345 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityMotionReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'FacialSimilarityMotionBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityMotionReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityMotionReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown.rb b/lib/onfido/models/facial_similarity_photo_breakdown.rb new file mode 100644 index 0000000..4c40de8 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoBreakdown + attr_accessor :face_comparison + + attr_accessor :image_integrity + + attr_accessor :visual_authenticity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_comparison' => :'face_comparison', + :'image_integrity' => :'image_integrity', + :'visual_authenticity' => :'visual_authenticity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_comparison' => :'FacialSimilarityPhotoBreakdownFaceComparison', + :'image_integrity' => :'FacialSimilarityPhotoBreakdownImageIntegrity', + :'visual_authenticity' => :'FacialSimilarityPhotoBreakdownVisualAuthenticity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_comparison') + self.face_comparison = attributes[:'face_comparison'] + end + + if attributes.key?(:'image_integrity') + self.image_integrity = attributes[:'image_integrity'] + end + + if attributes.key?(:'visual_authenticity') + self.visual_authenticity = attributes[:'visual_authenticity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_comparison == o.face_comparison && + image_integrity == o.image_integrity && + visual_authenticity == o.visual_authenticity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_comparison, image_integrity, visual_authenticity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison.rb b/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison.rb new file mode 100644 index 0000000..6197bd5 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the face in the document matches the face in the live photo. + class FacialSimilarityPhotoBreakdownFaceComparison + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityPhotoBreakdownFaceComparisonBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownFaceComparison` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownFaceComparison`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown.rb b/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown.rb new file mode 100644 index 0000000..9700138 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoBreakdownFaceComparisonBreakdown + attr_accessor :face_match + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_match' => :'face_match' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_match' => :'FacialSimilarityPhotoBreakdownFaceComparisonBreakdownFaceMatch' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownFaceComparisonBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownFaceComparisonBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_match') + self.face_match = attributes[:'face_match'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_match == o.face_match + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_match].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match.rb b/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match.rb new file mode 100644 index 0000000..5f0340c --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Contains a score value under the properties bag. + class FacialSimilarityPhotoBreakdownFaceComparisonBreakdownFaceMatch + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'FacialSimilarityPhotoBreakdownFaceComparisonBreakdownFaceMatchProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownFaceComparisonBreakdownFaceMatch` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownFaceComparisonBreakdownFaceMatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match_properties.rb b/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match_properties.rb new file mode 100644 index 0000000..d4202c9 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match_properties.rb @@ -0,0 +1,225 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoBreakdownFaceComparisonBreakdownFaceMatchProperties + # A floating point number between 0 and 1 that expresses how similar the two faces are, where 1 is a perfect match. + attr_accessor :score + + # The UUID for the document containing the extracted face that was used for face matching. + attr_accessor :document_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'score' => :'score', + :'document_id' => :'document_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'score' => :'Float', + :'document_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownFaceComparisonBreakdownFaceMatchProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownFaceComparisonBreakdownFaceMatchProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'score') + self.score = attributes[:'score'] + end + + if attributes.key?(:'document_id') + self.document_id = attributes[:'document_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + score == o.score && + document_id == o.document_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [score, document_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity.rb b/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity.rb new file mode 100644 index 0000000..5b96a5d --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the quality and integrity of the uploaded files were sufficient to perform a face comparison. + class FacialSimilarityPhotoBreakdownImageIntegrity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityPhotoBreakdownImageIntegrityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownImageIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownImageIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown.rb b/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown.rb new file mode 100644 index 0000000..64dbb74 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoBreakdownImageIntegrityBreakdown + attr_accessor :face_detected + + attr_accessor :source_integrity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_detected' => :'face_detected', + :'source_integrity' => :'source_integrity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_detected' => :'FacialSimilarityPhotoBreakdownImageIntegrityBreakdownFaceDetected', + :'source_integrity' => :'FacialSimilarityPhotoBreakdownImageIntegrityBreakdownSourceIntegrity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownImageIntegrityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownImageIntegrityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_detected') + self.face_detected = attributes[:'face_detected'] + end + + if attributes.key?(:'source_integrity') + self.source_integrity = attributes[:'source_integrity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_detected == o.face_detected && + source_integrity == o.source_integrity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_detected, source_integrity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_face_detected.rb b/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_face_detected.rb new file mode 100644 index 0000000..c8af1bf --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_face_detected.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts a single face of good enough quality has been found in both the document image and the live photo. + class FacialSimilarityPhotoBreakdownImageIntegrityBreakdownFaceDetected + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownImageIntegrityBreakdownFaceDetected` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownImageIntegrityBreakdownFaceDetected`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_source_integrity.rb b/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_source_integrity.rb new file mode 100644 index 0000000..cc4cdf3 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_source_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the live photo is trustworthy - i.e. not digitally tampered, from a fake webcam, or from other dubious sources. + class FacialSimilarityPhotoBreakdownImageIntegrityBreakdownSourceIntegrity + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'PhotoReasons' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownImageIntegrityBreakdownSourceIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownImageIntegrityBreakdownSourceIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity.rb b/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity.rb new file mode 100644 index 0000000..3e63f35 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the person in the live photo is real and not a spoof. + class FacialSimilarityPhotoBreakdownVisualAuthenticity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownVisualAuthenticity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownVisualAuthenticity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown.rb b/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown.rb new file mode 100644 index 0000000..1c1c9c7 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdown + attr_accessor :spoofing_detection + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'spoofing_detection' => :'spoofing_detection' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'spoofing_detection' => :'FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetection' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'spoofing_detection') + self.spoofing_detection = attributes[:'spoofing_detection'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + spoofing_detection == o.spoofing_detection + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [spoofing_detection].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection.rb b/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection.rb new file mode 100644 index 0000000..685fc15 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Contains a score value under the properties bag. + class FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetection + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetectionProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetection` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection_properties.rb b/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection_properties.rb new file mode 100644 index 0000000..1bd8d53 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection_properties.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetectionProperties + # A floating point number between 0 and 1. The closer the score is to 0, the more likely it is to be a spoof. + attr_accessor :score + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'score' => :'score' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'score' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetectionProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetectionProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'score') + self.score = attributes[:'score'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + score == o.score + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [score].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown.rb b/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown.rb new file mode 100644 index 0000000..6fbd540 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoFullyAutoBreakdown + attr_accessor :face_comparison + + attr_accessor :image_integrity + + attr_accessor :visual_authenticity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_comparison' => :'face_comparison', + :'image_integrity' => :'image_integrity', + :'visual_authenticity' => :'visual_authenticity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_comparison' => :'FacialSimilarityPhotoBreakdownFaceComparison', + :'image_integrity' => :'FacialSimilarityPhotoFullyAutoBreakdownImageIntegrity', + :'visual_authenticity' => :'FacialSimilarityPhotoBreakdownVisualAuthenticity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoFullyAutoBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoFullyAutoBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_comparison') + self.face_comparison = attributes[:'face_comparison'] + end + + if attributes.key?(:'image_integrity') + self.image_integrity = attributes[:'image_integrity'] + end + + if attributes.key?(:'visual_authenticity') + self.visual_authenticity = attributes[:'visual_authenticity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_comparison == o.face_comparison && + image_integrity == o.image_integrity && + visual_authenticity == o.visual_authenticity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_comparison, image_integrity, visual_authenticity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity.rb b/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity.rb new file mode 100644 index 0000000..a42045a --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the quality and integrity of the uploaded files were sufficient to perform a face comparison. + class FacialSimilarityPhotoFullyAutoBreakdownImageIntegrity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoFullyAutoBreakdownImageIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoFullyAutoBreakdownImageIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown.rb b/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown.rb new file mode 100644 index 0000000..c07e2de --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdown + attr_accessor :face_detected + + attr_accessor :source_integrity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_detected' => :'face_detected', + :'source_integrity' => :'source_integrity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_detected' => :'FacialSimilarityPhotoBreakdownImageIntegrityBreakdownFaceDetected', + :'source_integrity' => :'FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdownSourceIntegrity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_detected') + self.face_detected = attributes[:'face_detected'] + end + + if attributes.key?(:'source_integrity') + self.source_integrity = attributes[:'source_integrity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_detected == o.face_detected && + source_integrity == o.source_integrity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_detected, source_integrity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity.rb b/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity.rb new file mode 100644 index 0000000..9349f03 --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the live photo is trustworthy - i.e. not digitally tampered, from a fake webcam, or from other dubious sources. + class FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdownSourceIntegrity + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'PhotoAutoReasons' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdownSourceIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoFullyAutoBreakdownImageIntegrityBreakdownSourceIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_fully_auto_report.rb b/lib/onfido/models/facial_similarity_photo_fully_auto_report.rb new file mode 100644 index 0000000..b90621a --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_fully_auto_report.rb @@ -0,0 +1,345 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoFullyAutoReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'FacialSimilarityPhotoFullyAutoBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoFullyAutoReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoFullyAutoReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_photo_report.rb b/lib/onfido/models/facial_similarity_photo_report.rb new file mode 100644 index 0000000..f7f047d --- /dev/null +++ b/lib/onfido/models/facial_similarity_photo_report.rb @@ -0,0 +1,345 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityPhotoReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'FacialSimilarityPhotoBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityPhotoReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityPhotoReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown.rb b/lib/onfido/models/facial_similarity_video_breakdown.rb new file mode 100644 index 0000000..0a19065 --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityVideoBreakdown + attr_accessor :face_comparison + + attr_accessor :image_integrity + + attr_accessor :visual_authenticity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_comparison' => :'face_comparison', + :'image_integrity' => :'image_integrity', + :'visual_authenticity' => :'visual_authenticity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_comparison' => :'FacialSimilarityVideoBreakdownFaceComparison', + :'image_integrity' => :'FacialSimilarityVideoBreakdownImageIntegrity', + :'visual_authenticity' => :'FacialSimilarityVideoBreakdownVisualAuthenticity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_comparison') + self.face_comparison = attributes[:'face_comparison'] + end + + if attributes.key?(:'image_integrity') + self.image_integrity = attributes[:'image_integrity'] + end + + if attributes.key?(:'visual_authenticity') + self.visual_authenticity = attributes[:'visual_authenticity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_comparison == o.face_comparison && + image_integrity == o.image_integrity && + visual_authenticity == o.visual_authenticity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_comparison, image_integrity, visual_authenticity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_face_comparison.rb b/lib/onfido/models/facial_similarity_video_breakdown_face_comparison.rb new file mode 100644 index 0000000..81e383c --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_face_comparison.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the face in the document matches the face in the live video. + class FacialSimilarityVideoBreakdownFaceComparison + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityPhotoBreakdownFaceComparisonBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownFaceComparison` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownFaceComparison`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_image_integrity.rb b/lib/onfido/models/facial_similarity_video_breakdown_image_integrity.rb new file mode 100644 index 0000000..71de11a --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_image_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the quality and integrity of the uploaded files were sufficient to perform a face comparison. + class FacialSimilarityVideoBreakdownImageIntegrity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityVideoBreakdownImageIntegrityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownImageIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownImageIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown.rb b/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown.rb new file mode 100644 index 0000000..54ad76e --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityVideoBreakdownImageIntegrityBreakdown + attr_accessor :face_detected + + attr_accessor :source_integrity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'face_detected' => :'face_detected', + :'source_integrity' => :'source_integrity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'face_detected' => :'FacialSimilarityVideoBreakdownImageIntegrityBreakdownFaceDetected', + :'source_integrity' => :'FacialSimilarityVideoBreakdownImageIntegrityBreakdownSourceIntegrity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownImageIntegrityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownImageIntegrityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'face_detected') + self.face_detected = attributes[:'face_detected'] + end + + if attributes.key?(:'source_integrity') + self.source_integrity = attributes[:'source_integrity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + face_detected == o.face_detected && + source_integrity == o.source_integrity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [face_detected, source_integrity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_face_detected.rb b/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_face_detected.rb new file mode 100644 index 0000000..daac0d1 --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_face_detected.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts a single face of good enough quality has been found in both the document image and the live video. + class FacialSimilarityVideoBreakdownImageIntegrityBreakdownFaceDetected + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownImageIntegrityBreakdownFaceDetected` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownImageIntegrityBreakdownFaceDetected`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_source_integrity.rb b/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_source_integrity.rb new file mode 100644 index 0000000..57b9210 --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_source_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the live video is trustworthy - e.g. not from a fake webcam. + class FacialSimilarityVideoBreakdownImageIntegrityBreakdownSourceIntegrity + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'VideoReasons' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownImageIntegrityBreakdownSourceIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownImageIntegrityBreakdownSourceIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity.rb b/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity.rb new file mode 100644 index 0000000..bd15d36 --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the person in the live video is real (not a spoof) and live. + class FacialSimilarityVideoBreakdownVisualAuthenticity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'FacialSimilarityVideoBreakdownVisualAuthenticityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownVisualAuthenticity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownVisualAuthenticity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown.rb b/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown.rb new file mode 100644 index 0000000..c418f4f --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityVideoBreakdownVisualAuthenticityBreakdown + attr_accessor :liveness_detected + + attr_accessor :spoofing_detection + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'liveness_detected' => :'liveness_detected', + :'spoofing_detection' => :'spoofing_detection' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'liveness_detected' => :'FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownLivenessDetected', + :'spoofing_detection' => :'FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownSpoofingDetection' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownVisualAuthenticityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownVisualAuthenticityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'liveness_detected') + self.liveness_detected = attributes[:'liveness_detected'] + end + + if attributes.key?(:'spoofing_detection') + self.spoofing_detection = attributes[:'spoofing_detection'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + liveness_detected == o.liveness_detected && + spoofing_detection == o.spoofing_detection + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [liveness_detected, spoofing_detection].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected.rb b/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected.rb new file mode 100644 index 0000000..fe1da16 --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the numbers and head movements were correctly executed. + class FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownLivenessDetected + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownLivenessDetected` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownLivenessDetected`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection.rb b/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection.rb new file mode 100644 index 0000000..7c00c97 --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the live video is not a spoof (such as videos of digital screens). + class FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownSpoofingDetection + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'FacialSimilarityPhotoBreakdownVisualAuthenticityBreakdownSpoofingDetectionProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownSpoofingDetection` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoBreakdownVisualAuthenticityBreakdownSpoofingDetection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/facial_similarity_video_report.rb b/lib/onfido/models/facial_similarity_video_report.rb new file mode 100644 index 0000000..d7e24c0 --- /dev/null +++ b/lib/onfido/models/facial_similarity_video_report.rb @@ -0,0 +1,345 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class FacialSimilarityVideoReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'FacialSimilarityVideoBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::FacialSimilarityVideoReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::FacialSimilarityVideoReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/id_number.rb b/lib/onfido/models/id_number.rb new file mode 100644 index 0000000..79f19a9 --- /dev/null +++ b/lib/onfido/models/id_number.rb @@ -0,0 +1,269 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdNumber + # Type of ID number. + attr_accessor :type + + # Value of ID number + attr_accessor :value + + # Two letter code of issuing state (state-issued driving licenses only) + attr_accessor :state_code + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'value' => :'value', + :'state_code' => :'state_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'value' => :'String', + :'state_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdNumber` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdNumber`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'state_code') + self.state_code = attributes[:'state_code'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["ssn", "social_insurance", "tax_id", "identity_card", "driving_licence", "share_code", "voter_id", "passport", "other", "unknown_default_open_api"]) + return false unless type_validator.valid?(@type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["ssn", "social_insurance", "tax_id", "identity_card", "driving_licence", "share_code", "voter_id", "passport", "other", "unknown_default_open_api"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + value == o.value && + state_code == o.state_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, value, state_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/id_photo.rb b/lib/onfido/models/id_photo.rb new file mode 100644 index 0000000..4822cb5 --- /dev/null +++ b/lib/onfido/models/id_photo.rb @@ -0,0 +1,289 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdPhoto + # The unique identifier for the photo. + attr_accessor :id + + # The date and time at which the photo was uploaded. + attr_accessor :created_at + + # The uri of this resource. + attr_accessor :href + + # The uri that can be used to download the photo. + attr_accessor :download_href + + # The name of the uploaded file. + attr_accessor :file_name + + # The file type of the uploaded file. + attr_accessor :file_type + + # The size of the file in bytes. + attr_accessor :file_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'download_href' => :'download_href', + :'file_name' => :'file_name', + :'file_type' => :'file_type', + :'file_size' => :'file_size' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'download_href' => :'String', + :'file_name' => :'String', + :'file_type' => :'String', + :'file_size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'IdPhotoResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdPhoto` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdPhoto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'download_href') + self.download_href = attributes[:'download_href'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_type') + self.file_type = attributes[:'file_type'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + download_href == o.download_href && + file_name == o.file_name && + file_type == o.file_type && + file_size == o.file_size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, download_href, file_name, file_type, file_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/id_photo_response.rb b/lib/onfido/models/id_photo_response.rb new file mode 100644 index 0000000..00268f1 --- /dev/null +++ b/lib/onfido/models/id_photo_response.rb @@ -0,0 +1,282 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdPhotoResponse + # The unique identifier for the photo. + attr_accessor :id + + # The date and time at which the photo was uploaded. + attr_accessor :created_at + + # The uri of this resource. + attr_accessor :href + + # The uri that can be used to download the photo. + attr_accessor :download_href + + # The name of the uploaded file. + attr_accessor :file_name + + # The file type of the uploaded file. + attr_accessor :file_type + + # The size of the file in bytes. + attr_accessor :file_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'download_href' => :'download_href', + :'file_name' => :'file_name', + :'file_type' => :'file_type', + :'file_size' => :'file_size' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'download_href' => :'String', + :'file_name' => :'String', + :'file_type' => :'String', + :'file_size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdPhotoResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdPhotoResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'download_href') + self.download_href = attributes[:'download_href'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_type') + self.file_type = attributes[:'file_type'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + download_href == o.download_href && + file_name == o.file_name && + file_type == o.file_type && + file_size == o.file_size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, download_href, file_name, file_type, file_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/id_photos_list.rb b/lib/onfido/models/id_photos_list.rb new file mode 100644 index 0000000..119629b --- /dev/null +++ b/lib/onfido/models/id_photos_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IDPhotosList + attr_accessor :id_photos + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id_photos' => :'id_photos' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id_photos' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IDPhotosList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IDPhotosList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id_photos') + if (value = attributes[:'id_photos']).is_a?(Array) + self.id_photos = value + end + else + self.id_photos = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id_photos.nil? + invalid_properties.push('invalid value for "id_photos", id_photos cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id_photos.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id_photos == o.id_photos + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id_photos].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown.rb b/lib/onfido/models/identity_enhanced_breakdown.rb new file mode 100644 index 0000000..ed174ce --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown.rb @@ -0,0 +1,241 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedBreakdown + attr_accessor :sources + + attr_accessor :address + + attr_accessor :date_of_birth + + attr_accessor :mortality + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sources' => :'sources', + :'address' => :'address', + :'date_of_birth' => :'date_of_birth', + :'mortality' => :'mortality' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sources' => :'IdentityEnhancedBreakdownSources', + :'address' => :'IdentityEnhancedBreakdownAddress', + :'date_of_birth' => :'IdentityEnhancedBreakdownDateOfBirth', + :'mortality' => :'IdentityEnhancedBreakdownMortality' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sources') + self.sources = attributes[:'sources'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'mortality') + self.mortality = attributes[:'mortality'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sources == o.sources && + address == o.address && + date_of_birth == o.date_of_birth && + mortality == o.mortality + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sources, address, date_of_birth, mortality].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_address.rb b/lib/onfido/models/identity_enhanced_breakdown_address.rb new file mode 100644 index 0000000..c9db619 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_address.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if the applicant's address matches any sources. + class IdentityEnhancedBreakdownAddress + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'IdentityEnhancedBreakdownAddressBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownAddress` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_address_breakdown.rb b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown.rb new file mode 100644 index 0000000..94c7faa --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedBreakdownAddressBreakdown + attr_accessor :credit_agencies + + attr_accessor :telephone_database + + attr_accessor :voting_register + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'credit_agencies' => :'credit_agencies', + :'telephone_database' => :'telephone_database', + :'voting_register' => :'voting_register' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'credit_agencies' => :'IdentityEnhancedBreakdownAddressBreakdownCreditAgencies', + :'telephone_database' => :'IdentityEnhancedBreakdownAddressBreakdownTelephoneDatabase', + :'voting_register' => :'IdentityEnhancedBreakdownAddressBreakdownVotingRegister' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownAddressBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownAddressBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'credit_agencies') + self.credit_agencies = attributes[:'credit_agencies'] + end + + if attributes.key?(:'telephone_database') + self.telephone_database = attributes[:'telephone_database'] + end + + if attributes.key?(:'voting_register') + self.voting_register = attributes[:'voting_register'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + credit_agencies == o.credit_agencies && + telephone_database == o.telephone_database && + voting_register == o.voting_register + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [credit_agencies, telephone_database, voting_register].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies.rb b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies.rb new file mode 100644 index 0000000..3c56420 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # The number of address matches against credit agencies. + class IdentityEnhancedBreakdownAddressBreakdownCreditAgencies + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'IdentityEnhancedBreakdownAddressBreakdownCreditAgenciesProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownAddressBreakdownCreditAgencies` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownAddressBreakdownCreditAgencies`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies_properties.rb b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies_properties.rb new file mode 100644 index 0000000..2823460 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies_properties.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedBreakdownAddressBreakdownCreditAgenciesProperties + attr_accessor :number_of_matches + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'number_of_matches' => :'number_of_matches' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'number_of_matches' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownAddressBreakdownCreditAgenciesProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownAddressBreakdownCreditAgenciesProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'number_of_matches') + self.number_of_matches = attributes[:'number_of_matches'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + number_of_matches == o.number_of_matches + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [number_of_matches].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_telephone_database.rb b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_telephone_database.rb new file mode 100644 index 0000000..5d7053e --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_telephone_database.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Address match against telephone database. + class IdentityEnhancedBreakdownAddressBreakdownTelephoneDatabase + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownAddressBreakdownTelephoneDatabase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownAddressBreakdownTelephoneDatabase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_voting_register.rb b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_voting_register.rb new file mode 100644 index 0000000..181feff --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_voting_register.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Address match against voting register. + class IdentityEnhancedBreakdownAddressBreakdownVotingRegister + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownAddressBreakdownVotingRegister` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownAddressBreakdownVotingRegister`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_date_of_birth.rb b/lib/onfido/models/identity_enhanced_breakdown_date_of_birth.rb new file mode 100644 index 0000000..f4d03eb --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_date_of_birth.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if the applicant's date of birth matches any sources. + class IdentityEnhancedBreakdownDateOfBirth + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'IdentityEnhancedBreakdownDateOfBirthBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownDateOfBirth` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownDateOfBirth`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown.rb b/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown.rb new file mode 100644 index 0000000..d3d8ec1 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedBreakdownDateOfBirthBreakdown + attr_accessor :credit_agencies + + attr_accessor :voting_register + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'credit_agencies' => :'credit_agencies', + :'voting_register' => :'voting_register' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'credit_agencies' => :'IdentityEnhancedBreakdownDateOfBirthBreakdownCreditAgencies', + :'voting_register' => :'IdentityEnhancedBreakdownDateOfBirthBreakdownVotingRegister' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownDateOfBirthBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownDateOfBirthBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'credit_agencies') + self.credit_agencies = attributes[:'credit_agencies'] + end + + if attributes.key?(:'voting_register') + self.voting_register = attributes[:'voting_register'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + credit_agencies == o.credit_agencies && + voting_register == o.voting_register + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [credit_agencies, voting_register].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_credit_agencies.rb b/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_credit_agencies.rb new file mode 100644 index 0000000..cbd2c95 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_credit_agencies.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Date of birth match against credit agencies. + class IdentityEnhancedBreakdownDateOfBirthBreakdownCreditAgencies + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownDateOfBirthBreakdownCreditAgencies` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownDateOfBirthBreakdownCreditAgencies`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_voting_register.rb b/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_voting_register.rb new file mode 100644 index 0000000..feb1920 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_voting_register.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Date of birth match against voting register. + class IdentityEnhancedBreakdownDateOfBirthBreakdownVotingRegister + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownDateOfBirthBreakdownVotingRegister` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownDateOfBirthBreakdownVotingRegister`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_mortality.rb b/lib/onfido/models/identity_enhanced_breakdown_mortality.rb new file mode 100644 index 0000000..174fd64 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_mortality.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if the applicant's details match any death records. + class IdentityEnhancedBreakdownMortality + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownMortality` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownMortality`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_sources.rb b/lib/onfido/models/identity_enhanced_breakdown_sources.rb new file mode 100644 index 0000000..20c85d7 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_sources.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if any sources that an applicant's details have been verified against have produced a match. + class IdentityEnhancedBreakdownSources + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'IdentityEnhancedBreakdownSourcesBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownSources` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownSources`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown.rb b/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown.rb new file mode 100644 index 0000000..d1dc7f4 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedBreakdownSourcesBreakdown + attr_accessor :total_sources + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_sources' => :'total_sources' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_sources' => :'IdentityEnhancedBreakdownSourcesBreakdownTotalSources' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownSourcesBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownSourcesBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total_sources') + self.total_sources = attributes[:'total_sources'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_sources == o.total_sources + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_sources].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources.rb b/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources.rb new file mode 100644 index 0000000..8cde2c7 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # The number of sources which produced a match to applicant details. + class IdentityEnhancedBreakdownSourcesBreakdownTotalSources + attr_accessor :result + + attr_accessor :properties + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'properties' => :'IdentityEnhancedBreakdownSourcesBreakdownTotalSourcesProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownSourcesBreakdownTotalSources` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownSourcesBreakdownTotalSources`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources_properties.rb b/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources_properties.rb new file mode 100644 index 0000000..a48a717 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources_properties.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedBreakdownSourcesBreakdownTotalSourcesProperties + attr_accessor :total_number_of_sources + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_number_of_sources' => :'total_number_of_sources' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_number_of_sources' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedBreakdownSourcesBreakdownTotalSourcesProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedBreakdownSourcesBreakdownTotalSourcesProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total_number_of_sources') + self.total_number_of_sources = attributes[:'total_number_of_sources'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_number_of_sources == o.total_number_of_sources + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_number_of_sources].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_properties.rb b/lib/onfido/models/identity_enhanced_properties.rb new file mode 100644 index 0000000..efdd43b --- /dev/null +++ b/lib/onfido/models/identity_enhanced_properties.rb @@ -0,0 +1,227 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedProperties + # Returns address number which has been matched. + attr_accessor :matched_address + + # Returns array of sources which contain matched addresses for the corresponding address number. + attr_accessor :matched_addresses + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'matched_address' => :'matched_address', + :'matched_addresses' => :'matched_addresses' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'matched_address' => :'Float', + :'matched_addresses' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'matched_address') + self.matched_address = attributes[:'matched_address'] + end + + if attributes.key?(:'matched_addresses') + if (value = attributes[:'matched_addresses']).is_a?(Array) + self.matched_addresses = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + matched_address == o.matched_address && + matched_addresses == o.matched_addresses + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [matched_address, matched_addresses].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_properties_matched_addresses_inner.rb b/lib/onfido/models/identity_enhanced_properties_matched_addresses_inner.rb new file mode 100644 index 0000000..6542333 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_properties_matched_addresses_inner.rb @@ -0,0 +1,227 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedPropertiesMatchedAddressesInner + # The address number. + attr_accessor :id + + # Sources which contain matched addresses. + attr_accessor :match_types + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'match_types' => :'match_types' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Float', + :'match_types' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedPropertiesMatchedAddressesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedPropertiesMatchedAddressesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'match_types') + if (value = attributes[:'match_types']).is_a?(Array) + self.match_types = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + match_types == o.match_types + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, match_types].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/identity_enhanced_report.rb b/lib/onfido/models/identity_enhanced_report.rb new file mode 100644 index 0000000..f866b31 --- /dev/null +++ b/lib/onfido/models/identity_enhanced_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IdentityEnhancedReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'IdentityEnhancedBreakdown', + :'properties' => :'IdentityEnhancedProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IdentityEnhancedReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IdentityEnhancedReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/india_pan_report.rb b/lib/onfido/models/india_pan_report.rb new file mode 100644 index 0000000..a6a65c2 --- /dev/null +++ b/lib/onfido/models/india_pan_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IndiaPanReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'IndiaPanReportAllOfBreakdown', + :'properties' => :'IndiaPanReportAllOfProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IndiaPanReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IndiaPanReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/india_pan_report_all_of_breakdown.rb b/lib/onfido/models/india_pan_report_all_of_breakdown.rb new file mode 100644 index 0000000..110077e --- /dev/null +++ b/lib/onfido/models/india_pan_report_all_of_breakdown.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IndiaPanReportAllOfBreakdown + attr_accessor :device + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device' => :'device' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'device' => :'IndiaPanReportAllOfBreakdownDevice' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IndiaPanReportAllOfBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IndiaPanReportAllOfBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'device') + self.device = attributes[:'device'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device == o.device + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/india_pan_report_all_of_breakdown_device.rb b/lib/onfido/models/india_pan_report_all_of_breakdown_device.rb new file mode 100644 index 0000000..e743ce6 --- /dev/null +++ b/lib/onfido/models/india_pan_report_all_of_breakdown_device.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IndiaPanReportAllOfBreakdownDevice + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'breakdown' => :'IndiaPanReportAllOfBreakdownDeviceBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IndiaPanReportAllOfBreakdownDevice` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IndiaPanReportAllOfBreakdownDevice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown.rb b/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown.rb new file mode 100644 index 0000000..72eb922 --- /dev/null +++ b/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IndiaPanReportAllOfBreakdownDeviceBreakdown + attr_accessor :pan_valid + + attr_accessor :name_match + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pan_valid' => :'pan_valid', + :'name_match' => :'name_match' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'pan_valid' => :'IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid', + :'name_match' => :'IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IndiaPanReportAllOfBreakdownDeviceBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IndiaPanReportAllOfBreakdownDeviceBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pan_valid') + self.pan_valid = attributes[:'pan_valid'] + end + + if attributes.key?(:'name_match') + self.name_match = attributes[:'name_match'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pan_valid == o.pan_valid && + name_match == o.name_match + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pan_valid, name_match].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid.rb b/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid.rb new file mode 100644 index 0000000..04d6410 --- /dev/null +++ b/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IndiaPanReportAllOfBreakdownDeviceBreakdownPanValid`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/india_pan_report_all_of_properties.rb b/lib/onfido/models/india_pan_report_all_of_properties.rb new file mode 100644 index 0000000..82e08b3 --- /dev/null +++ b/lib/onfido/models/india_pan_report_all_of_properties.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IndiaPanReportAllOfProperties + attr_accessor :device + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device' => :'device' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'device' => :'IndiaPanReportAllOfPropertiesDevice' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IndiaPanReportAllOfProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IndiaPanReportAllOfProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'device') + self.device = attributes[:'device'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device == o.device + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/india_pan_report_all_of_properties_device.rb b/lib/onfido/models/india_pan_report_all_of_properties_device.rb new file mode 100644 index 0000000..5ff2867 --- /dev/null +++ b/lib/onfido/models/india_pan_report_all_of_properties_device.rb @@ -0,0 +1,225 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class IndiaPanReportAllOfPropertiesDevice + # The applicant's PAN (10 digit alphanumeric number). + attr_accessor :pan + + # The applicant's full name. + attr_accessor :full_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pan' => :'pan', + :'full_name' => :'full_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'pan' => :'String', + :'full_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::IndiaPanReportAllOfPropertiesDevice` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::IndiaPanReportAllOfPropertiesDevice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pan') + self.pan = attributes[:'pan'] + end + + if attributes.key?(:'full_name') + self.full_name = attributes[:'full_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pan == o.pan && + full_name == o.full_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pan, full_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/known_faces_breakdown.rb b/lib/onfido/models/known_faces_breakdown.rb new file mode 100644 index 0000000..133efe0 --- /dev/null +++ b/lib/onfido/models/known_faces_breakdown.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class KnownFacesBreakdown + attr_accessor :previously_seen_faces + + attr_accessor :image_integrity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'previously_seen_faces' => :'previously_seen_faces', + :'image_integrity' => :'image_integrity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'previously_seen_faces' => :'KnownFacesBreakdownPreviouslySeenFaces', + :'image_integrity' => :'KnownFacesBreakdownImageIntegrity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::KnownFacesBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::KnownFacesBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'previously_seen_faces') + self.previously_seen_faces = attributes[:'previously_seen_faces'] + end + + if attributes.key?(:'image_integrity') + self.image_integrity = attributes[:'image_integrity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + previously_seen_faces == o.previously_seen_faces && + image_integrity == o.image_integrity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [previously_seen_faces, image_integrity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/known_faces_breakdown_image_integrity.rb b/lib/onfido/models/known_faces_breakdown_image_integrity.rb new file mode 100644 index 0000000..7872665 --- /dev/null +++ b/lib/onfido/models/known_faces_breakdown_image_integrity.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the uploaded live photo or live video and the content contained within it were of sufficient quality to perform a face comparison. + class KnownFacesBreakdownImageIntegrity + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::KnownFacesBreakdownImageIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::KnownFacesBreakdownImageIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/known_faces_breakdown_previously_seen_faces.rb b/lib/onfido/models/known_faces_breakdown_previously_seen_faces.rb new file mode 100644 index 0000000..a78d2aa --- /dev/null +++ b/lib/onfido/models/known_faces_breakdown_previously_seen_faces.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the applicant's most recent facial media (live photo or live video) matches any other live photos or live videos already in your Onfido account database. + class KnownFacesBreakdownPreviouslySeenFaces + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::KnownFacesBreakdownPreviouslySeenFaces` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::KnownFacesBreakdownPreviouslySeenFaces`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/known_faces_properties.rb b/lib/onfido/models/known_faces_properties.rb new file mode 100644 index 0000000..b88e7bb --- /dev/null +++ b/lib/onfido/models/known_faces_properties.rb @@ -0,0 +1,217 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class KnownFacesProperties + # Returns any matching applicant IDs as entries inside a matches array under a properties bag. + attr_accessor :matches + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'matches' => :'matches' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'matches' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::KnownFacesProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::KnownFacesProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'matches') + if (value = attributes[:'matches']).is_a?(Array) + self.matches = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + matches == o.matches + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [matches].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/known_faces_properties_matches_inner.rb b/lib/onfido/models/known_faces_properties_matches_inner.rb new file mode 100644 index 0000000..dc660a8 --- /dev/null +++ b/lib/onfido/models/known_faces_properties_matches_inner.rb @@ -0,0 +1,255 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class KnownFacesPropertiesMatchesInner + # The applicant ID of the matched applicant. + attr_accessor :applicant_id + + # A floating point number between 0 and 1 that expresses how similar the two faces are, where 1 is a perfect match. + attr_accessor :score + + # The corresponding UUID for the media type. + attr_accessor :media_id + + # The media type (for example live_photos or live_videos). + attr_accessor :media_type + + # Indicates if match is suspected based on fuzzy name matching feature. Dependent on feature being active for account, otherwise defaults to true. + attr_accessor :suspected + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'applicant_id' => :'applicant_id', + :'score' => :'score', + :'media_id' => :'media_id', + :'media_type' => :'media_type', + :'suspected' => :'suspected' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'applicant_id' => :'String', + :'score' => :'Float', + :'media_id' => :'String', + :'media_type' => :'String', + :'suspected' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::KnownFacesPropertiesMatchesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::KnownFacesPropertiesMatchesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + end + + if attributes.key?(:'score') + self.score = attributes[:'score'] + end + + if attributes.key?(:'media_id') + self.media_id = attributes[:'media_id'] + end + + if attributes.key?(:'media_type') + self.media_type = attributes[:'media_type'] + end + + if attributes.key?(:'suspected') + self.suspected = attributes[:'suspected'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + applicant_id == o.applicant_id && + score == o.score && + media_id == o.media_id && + media_type == o.media_type && + suspected == o.suspected + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [applicant_id, score, media_id, media_type, suspected].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/known_faces_report.rb b/lib/onfido/models/known_faces_report.rb new file mode 100644 index 0000000..b395c9a --- /dev/null +++ b/lib/onfido/models/known_faces_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class KnownFacesReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'KnownFacesBreakdown', + :'properties' => :'KnownFacesProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::KnownFacesReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::KnownFacesReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/live_photo.rb b/lib/onfido/models/live_photo.rb new file mode 100644 index 0000000..feffe1e --- /dev/null +++ b/lib/onfido/models/live_photo.rb @@ -0,0 +1,289 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class LivePhoto + # The unique identifier for the photo. + attr_accessor :id + + # The date and time at which the photo was uploaded. + attr_accessor :created_at + + # The uri of this resource. + attr_accessor :href + + # The uri that can be used to download the photo. + attr_accessor :download_href + + # The name of the uploaded file. + attr_accessor :file_name + + # The file type of the uploaded file. + attr_accessor :file_type + + # The size of the file in bytes. + attr_accessor :file_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'download_href' => :'download_href', + :'file_name' => :'file_name', + :'file_type' => :'file_type', + :'file_size' => :'file_size' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'download_href' => :'String', + :'file_name' => :'String', + :'file_type' => :'String', + :'file_size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'LivePhotoResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::LivePhoto` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::LivePhoto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'download_href') + self.download_href = attributes[:'download_href'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_type') + self.file_type = attributes[:'file_type'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + download_href == o.download_href && + file_name == o.file_name && + file_type == o.file_type && + file_size == o.file_size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, download_href, file_name, file_type, file_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/live_photo_response.rb b/lib/onfido/models/live_photo_response.rb new file mode 100644 index 0000000..4a51ebb --- /dev/null +++ b/lib/onfido/models/live_photo_response.rb @@ -0,0 +1,282 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class LivePhotoResponse + # The unique identifier for the photo. + attr_accessor :id + + # The date and time at which the photo was uploaded. + attr_accessor :created_at + + # The uri of this resource. + attr_accessor :href + + # The uri that can be used to download the photo. + attr_accessor :download_href + + # The name of the uploaded file. + attr_accessor :file_name + + # The file type of the uploaded file. + attr_accessor :file_type + + # The size of the file in bytes. + attr_accessor :file_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'download_href' => :'download_href', + :'file_name' => :'file_name', + :'file_type' => :'file_type', + :'file_size' => :'file_size' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'download_href' => :'String', + :'file_name' => :'String', + :'file_type' => :'String', + :'file_size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::LivePhotoResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::LivePhotoResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'download_href') + self.download_href = attributes[:'download_href'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_type') + self.file_type = attributes[:'file_type'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + download_href == o.download_href && + file_name == o.file_name && + file_type == o.file_type && + file_size == o.file_size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, download_href, file_name, file_type, file_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/live_photos_list.rb b/lib/onfido/models/live_photos_list.rb new file mode 100644 index 0000000..74357a8 --- /dev/null +++ b/lib/onfido/models/live_photos_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class LivePhotosList + attr_accessor :live_photos + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'live_photos' => :'live_photos' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'live_photos' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::LivePhotosList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::LivePhotosList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'live_photos') + if (value = attributes[:'live_photos']).is_a?(Array) + self.live_photos = value + end + else + self.live_photos = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @live_photos.nil? + invalid_properties.push('invalid value for "live_photos", live_photos cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @live_photos.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + live_photos == o.live_photos + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [live_photos].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/live_video.rb b/lib/onfido/models/live_video.rb new file mode 100644 index 0000000..e7533ec --- /dev/null +++ b/lib/onfido/models/live_video.rb @@ -0,0 +1,287 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class LiveVideo + # The unique identifier for the video. + attr_accessor :id + + # The date and time at which the video was uploaded. + attr_accessor :created_at + + # The uri of this resource. + attr_accessor :href + + # The uri that can be used to download the video. + attr_accessor :download_href + + # The name of the uploaded file. + attr_accessor :file_name + + # The size of the file in bytes. + attr_accessor :file_size + + # The file type of the uploaded file. + attr_accessor :file_type + + # Challenge the end user was asked to perform during the video recording. + attr_accessor :challenge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'download_href' => :'download_href', + :'file_name' => :'file_name', + :'file_size' => :'file_size', + :'file_type' => :'file_type', + :'challenge' => :'challenge' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'download_href' => :'String', + :'file_name' => :'String', + :'file_size' => :'Integer', + :'file_type' => :'String', + :'challenge' => :'Array>' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::LiveVideo` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::LiveVideo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'download_href') + self.download_href = attributes[:'download_href'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + + if attributes.key?(:'file_type') + self.file_type = attributes[:'file_type'] + end + + if attributes.key?(:'challenge') + if (value = attributes[:'challenge']).is_a?(Array) + self.challenge = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + download_href == o.download_href && + file_name == o.file_name && + file_size == o.file_size && + file_type == o.file_type && + challenge == o.challenge + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, download_href, file_name, file_size, file_type, challenge].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/liveo_videos_list.rb b/lib/onfido/models/liveo_videos_list.rb new file mode 100644 index 0000000..7d0cbab --- /dev/null +++ b/lib/onfido/models/liveo_videos_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class LiveoVideosList + attr_accessor :live_videos + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'live_videos' => :'live_videos' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'live_videos' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::LiveoVideosList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::LiveoVideosList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'live_videos') + if (value = attributes[:'live_videos']).is_a?(Array) + self.live_videos = value + end + else + self.live_videos = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @live_videos.nil? + invalid_properties.push('invalid value for "live_videos", live_videos cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @live_videos.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + live_videos == o.live_videos + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [live_videos].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/location.rb b/lib/onfido/models/location.rb new file mode 100644 index 0000000..48b615a --- /dev/null +++ b/lib/onfido/models/location.rb @@ -0,0 +1,254 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Location + # The applicant's ip address. + attr_accessor :ip_address + + # The applicant's country of residence in 3-letter ISO code. + attr_accessor :country_of_residence + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ip_address' => :'ip_address', + :'country_of_residence' => :'country_of_residence' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ip_address' => :'String', + :'country_of_residence' => :'CountryCodes' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'LocationShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Location` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Location`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'ip_address') + self.ip_address = attributes[:'ip_address'] + end + + if attributes.key?(:'country_of_residence') + self.country_of_residence = attributes[:'country_of_residence'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ip_address == o.ip_address && + country_of_residence == o.country_of_residence + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ip_address, country_of_residence].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/location_builder.rb b/lib/onfido/models/location_builder.rb new file mode 100644 index 0000000..3840697 --- /dev/null +++ b/lib/onfido/models/location_builder.rb @@ -0,0 +1,254 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class LocationBuilder + # The applicant's ip address. + attr_accessor :ip_address + + # The applicant's country of residence in 3-letter ISO code. + attr_accessor :country_of_residence + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ip_address' => :'ip_address', + :'country_of_residence' => :'country_of_residence' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ip_address' => :'String', + :'country_of_residence' => :'CountryCodes' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'LocationShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::LocationBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::LocationBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'ip_address') + self.ip_address = attributes[:'ip_address'] + end + + if attributes.key?(:'country_of_residence') + self.country_of_residence = attributes[:'country_of_residence'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ip_address == o.ip_address && + country_of_residence == o.country_of_residence + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ip_address, country_of_residence].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/location_shared.rb b/lib/onfido/models/location_shared.rb new file mode 100644 index 0000000..4cba00f --- /dev/null +++ b/lib/onfido/models/location_shared.rb @@ -0,0 +1,247 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class LocationShared + # The applicant's ip address. + attr_accessor :ip_address + + # The applicant's country of residence in 3-letter ISO code. + attr_accessor :country_of_residence + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ip_address' => :'ip_address', + :'country_of_residence' => :'country_of_residence' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'ip_address' => :'String', + :'country_of_residence' => :'CountryCodes' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::LocationShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::LocationShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'ip_address') + self.ip_address = attributes[:'ip_address'] + end + + if attributes.key?(:'country_of_residence') + self.country_of_residence = attributes[:'country_of_residence'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ip_address == o.ip_address && + country_of_residence == o.country_of_residence + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ip_address, country_of_residence].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/motion_capture.rb b/lib/onfido/models/motion_capture.rb new file mode 100644 index 0000000..e0b3c5d --- /dev/null +++ b/lib/onfido/models/motion_capture.rb @@ -0,0 +1,275 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class MotionCapture + # The unique identifier for the motion capture. + attr_accessor :id + + # The date and time at which the motion capture was uploaded. + attr_accessor :created_at + + # The uri of this resource. + attr_accessor :href + + # The uri that can be used to download the motion capture. + attr_accessor :download_href + + # The name of the uploaded file. + attr_accessor :file_name + + # The size of the file in bytes. + attr_accessor :file_size + + # The file type of the uploaded file. + attr_accessor :file_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'download_href' => :'download_href', + :'file_name' => :'file_name', + :'file_size' => :'file_size', + :'file_type' => :'file_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'download_href' => :'String', + :'file_name' => :'String', + :'file_size' => :'Integer', + :'file_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::MotionCapture` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::MotionCapture`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'download_href') + self.download_href = attributes[:'download_href'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + + if attributes.key?(:'file_type') + self.file_type = attributes[:'file_type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + download_href == o.download_href && + file_name == o.file_name && + file_size == o.file_size && + file_type == o.file_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, download_href, file_name, file_size, file_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/motion_captures_list.rb b/lib/onfido/models/motion_captures_list.rb new file mode 100644 index 0000000..10e3f63 --- /dev/null +++ b/lib/onfido/models/motion_captures_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class MotionCapturesList + attr_accessor :motion_captures + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'motion_captures' => :'motion_captures' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'motion_captures' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::MotionCapturesList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::MotionCapturesList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'motion_captures') + if (value = attributes[:'motion_captures']).is_a?(Array) + self.motion_captures = value + end + else + self.motion_captures = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @motion_captures.nil? + invalid_properties.push('invalid value for "motion_captures", motion_captures cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @motion_captures.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + motion_captures == o.motion_captures + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [motion_captures].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/photo_auto_reasons.rb b/lib/onfido/models/photo_auto_reasons.rb new file mode 100644 index 0000000..eeca7e6 --- /dev/null +++ b/lib/onfido/models/photo_auto_reasons.rb @@ -0,0 +1,255 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class PhotoAutoReasons + # Flags when evidence is found that the image was manipulated by Photoshop, or other software. + attr_accessor :digital_tampering + + # Flags when evidence is found that a fake webcam was used. + attr_accessor :fake_webcam + + # Flags when evidence is found that the live photo was taken more than 24 hours before live photo upload. + attr_accessor :time_of_capture + + # Flags when evidence is found that an Android emulator was used. + attr_accessor :emulator + + # Additional comma separated details such as the exact digital tampering software used, or the name of the fake webcam. + attr_accessor :reasons + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'digital_tampering' => :'digital_tampering', + :'fake_webcam' => :'fake_webcam', + :'time_of_capture' => :'time_of_capture', + :'emulator' => :'emulator', + :'reasons' => :'reasons' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'digital_tampering' => :'String', + :'fake_webcam' => :'String', + :'time_of_capture' => :'String', + :'emulator' => :'String', + :'reasons' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::PhotoAutoReasons` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::PhotoAutoReasons`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'digital_tampering') + self.digital_tampering = attributes[:'digital_tampering'] + end + + if attributes.key?(:'fake_webcam') + self.fake_webcam = attributes[:'fake_webcam'] + end + + if attributes.key?(:'time_of_capture') + self.time_of_capture = attributes[:'time_of_capture'] + end + + if attributes.key?(:'emulator') + self.emulator = attributes[:'emulator'] + end + + if attributes.key?(:'reasons') + self.reasons = attributes[:'reasons'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + digital_tampering == o.digital_tampering && + fake_webcam == o.fake_webcam && + time_of_capture == o.time_of_capture && + emulator == o.emulator && + reasons == o.reasons + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [digital_tampering, fake_webcam, time_of_capture, emulator, reasons].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/photo_reasons.rb b/lib/onfido/models/photo_reasons.rb new file mode 100644 index 0000000..65840b9 --- /dev/null +++ b/lib/onfido/models/photo_reasons.rb @@ -0,0 +1,255 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class PhotoReasons + # Flags when evidence is found that the image was manipulated by Photoshop, or other software. + attr_accessor :digital_tampering + + # Flags when evidence is found that a fake webcam was used. + attr_accessor :fake_webcam + + # Flags when evidence is found that the live photo was taken more than 24 hours before live photo upload. + attr_accessor :time_of_capture + + # Flags when evidence is found that an Android emulator was used. + attr_accessor :emulator + + # Additional comma separated details such as the exact digital tampering software used, or the name of the fake webcam. + attr_accessor :reasons + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'digital_tampering' => :'digital_tampering', + :'fake_webcam' => :'fake_webcam', + :'time_of_capture' => :'time_of_capture', + :'emulator' => :'emulator', + :'reasons' => :'reasons' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'digital_tampering' => :'String', + :'fake_webcam' => :'String', + :'time_of_capture' => :'String', + :'emulator' => :'String', + :'reasons' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::PhotoReasons` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::PhotoReasons`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'digital_tampering') + self.digital_tampering = attributes[:'digital_tampering'] + end + + if attributes.key?(:'fake_webcam') + self.fake_webcam = attributes[:'fake_webcam'] + end + + if attributes.key?(:'time_of_capture') + self.time_of_capture = attributes[:'time_of_capture'] + end + + if attributes.key?(:'emulator') + self.emulator = attributes[:'emulator'] + end + + if attributes.key?(:'reasons') + self.reasons = attributes[:'reasons'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + digital_tampering == o.digital_tampering && + fake_webcam == o.fake_webcam && + time_of_capture == o.time_of_capture && + emulator == o.emulator && + reasons == o.reasons + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [digital_tampering, fake_webcam, time_of_capture, emulator, reasons].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_breakdown.rb b/lib/onfido/models/proof_of_address_breakdown.rb new file mode 100644 index 0000000..76b149f --- /dev/null +++ b/lib/onfido/models/proof_of_address_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ProofOfAddressBreakdown + attr_accessor :data_comparison + + attr_accessor :document_classification + + attr_accessor :image_integrity + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data_comparison' => :'data_comparison', + :'document_classification' => :'document_classification', + :'image_integrity' => :'image_integrity' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data_comparison' => :'ProofOfAddressBreakdownDataComparison', + :'document_classification' => :'ProofOfAddressBreakdownDocumentClassification', + :'image_integrity' => :'ProofOfAddressBreakdownImageIntegrity' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data_comparison') + self.data_comparison = attributes[:'data_comparison'] + end + + if attributes.key?(:'document_classification') + self.document_classification = attributes[:'document_classification'] + end + + if attributes.key?(:'image_integrity') + self.image_integrity = attributes[:'image_integrity'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data_comparison == o.data_comparison && + document_classification == o.document_classification && + image_integrity == o.image_integrity + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data_comparison, document_classification, image_integrity].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_breakdown_data_comparison.rb b/lib/onfido/models/proof_of_address_breakdown_data_comparison.rb new file mode 100644 index 0000000..3b53599 --- /dev/null +++ b/lib/onfido/models/proof_of_address_breakdown_data_comparison.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the first name, last name and address provided by the applicant match those on the PoA document. + class ProofOfAddressBreakdownDataComparison + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'ProofOfAddressBreakdownDataComparisonBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressBreakdownDataComparison` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressBreakdownDataComparison`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_breakdown_data_comparison_breakdown.rb b/lib/onfido/models/proof_of_address_breakdown_data_comparison_breakdown.rb new file mode 100644 index 0000000..8d359d2 --- /dev/null +++ b/lib/onfido/models/proof_of_address_breakdown_data_comparison_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ProofOfAddressBreakdownDataComparisonBreakdown + attr_accessor :address + + attr_accessor :first_name + + attr_accessor :last_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'first_name' => :'first_name', + :'last_name' => :'last_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'first_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'last_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressBreakdownDataComparisonBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressBreakdownDataComparisonBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + first_name == o.first_name && + last_name == o.last_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, first_name, last_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_breakdown_document_classification.rb b/lib/onfido/models/proof_of_address_breakdown_document_classification.rb new file mode 100644 index 0000000..d2bbe3f --- /dev/null +++ b/lib/onfido/models/proof_of_address_breakdown_document_classification.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the document is of a valid type as PoA. + class ProofOfAddressBreakdownDocumentClassification + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'ProofOfAddressBreakdownDocumentClassificationBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressBreakdownDocumentClassification` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressBreakdownDocumentClassification`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_breakdown_document_classification_breakdown.rb b/lib/onfido/models/proof_of_address_breakdown_document_classification_breakdown.rb new file mode 100644 index 0000000..d0a0f30 --- /dev/null +++ b/lib/onfido/models/proof_of_address_breakdown_document_classification_breakdown.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ProofOfAddressBreakdownDocumentClassificationBreakdown + attr_accessor :supported_document + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'supported_document' => :'supported_document' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'supported_document' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressBreakdownDocumentClassificationBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressBreakdownDocumentClassificationBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'supported_document') + self.supported_document = attributes[:'supported_document'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + supported_document == o.supported_document + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [supported_document].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_breakdown_image_integrity.rb b/lib/onfido/models/proof_of_address_breakdown_image_integrity.rb new file mode 100644 index 0000000..dece505 --- /dev/null +++ b/lib/onfido/models/proof_of_address_breakdown_image_integrity.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the quality of the uploaded document was sufficient to verify the address. + class ProofOfAddressBreakdownImageIntegrity + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'ProofOfAddressBreakdownImageIntegrityBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressBreakdownImageIntegrity` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressBreakdownImageIntegrity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_breakdown_image_integrity_breakdown.rb b/lib/onfido/models/proof_of_address_breakdown_image_integrity_breakdown.rb new file mode 100644 index 0000000..7a53110 --- /dev/null +++ b/lib/onfido/models/proof_of_address_breakdown_image_integrity_breakdown.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ProofOfAddressBreakdownImageIntegrityBreakdown + attr_accessor :image_quality + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_quality' => :'image_quality' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_quality' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressBreakdownImageIntegrityBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressBreakdownImageIntegrityBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'image_quality') + self.image_quality = attributes[:'image_quality'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_quality == o.image_quality + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_quality].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_properties.rb b/lib/onfido/models/proof_of_address_properties.rb new file mode 100644 index 0000000..8f1970a --- /dev/null +++ b/lib/onfido/models/proof_of_address_properties.rb @@ -0,0 +1,319 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ProofOfAddressProperties + # This property provides the address on the document. + attr_accessor :address + + # This property provides the document type according to the set of supported documents. + attr_accessor :document_type + + # This property provides the first names on the document, including any initials and middle names. + attr_accessor :first_names + + # This property provided the last names on the document. + attr_accessor :last_names + + # This property provides the issue date of the document. + attr_accessor :issue_date + + # This property provides the document issuer (e.g. HSBC, British Gas). + attr_accessor :issuer + + # This property provides the summary period start date. + attr_accessor :summary_period_start + + # This property provides the summary period end date. + attr_accessor :summary_period_end + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'document_type' => :'document_type', + :'first_names' => :'first_names', + :'last_names' => :'last_names', + :'issue_date' => :'issue_date', + :'issuer' => :'issuer', + :'summary_period_start' => :'summary_period_start', + :'summary_period_end' => :'summary_period_end' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'address' => :'String', + :'document_type' => :'String', + :'first_names' => :'String', + :'last_names' => :'String', + :'issue_date' => :'Date', + :'issuer' => :'String', + :'summary_period_start' => :'Date', + :'summary_period_end' => :'Date' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'document_type') + self.document_type = attributes[:'document_type'] + end + + if attributes.key?(:'first_names') + self.first_names = attributes[:'first_names'] + end + + if attributes.key?(:'last_names') + self.last_names = attributes[:'last_names'] + end + + if attributes.key?(:'issue_date') + self.issue_date = attributes[:'issue_date'] + end + + if attributes.key?(:'issuer') + self.issuer = attributes[:'issuer'] + end + + if attributes.key?(:'summary_period_start') + self.summary_period_start = attributes[:'summary_period_start'] + end + + if attributes.key?(:'summary_period_end') + self.summary_period_end = attributes[:'summary_period_end'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + document_type_validator = EnumAttributeValidator.new('String', ["bank_building_society_statement", "utility_bill", "council_tax", "benefit_letters", "mortgage_statement", "mobile_phone_bill", "general_letter", "insurance_statement", "pension_property_statement_letter", "identity_document_with_address", "exchange_house_statement", "unknown_default_open_api"]) + return false unless document_type_validator.valid?(@document_type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] document_type Object to be assigned + def document_type=(document_type) + validator = EnumAttributeValidator.new('String', ["bank_building_society_statement", "utility_bill", "council_tax", "benefit_letters", "mortgage_statement", "mobile_phone_bill", "general_letter", "insurance_statement", "pension_property_statement_letter", "identity_document_with_address", "exchange_house_statement", "unknown_default_open_api"]) + unless validator.valid?(document_type) + fail ArgumentError, "invalid value for \"document_type\", must be one of #{validator.allowable_values}." + end + @document_type = document_type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + address == o.address && + document_type == o.document_type && + first_names == o.first_names && + last_names == o.last_names && + issue_date == o.issue_date && + issuer == o.issuer && + summary_period_start == o.summary_period_start && + summary_period_end == o.summary_period_end + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [address, document_type, first_names, last_names, issue_date, issuer, summary_period_start, summary_period_end].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/proof_of_address_report.rb b/lib/onfido/models/proof_of_address_report.rb new file mode 100644 index 0000000..c23df99 --- /dev/null +++ b/lib/onfido/models/proof_of_address_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ProofOfAddressReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'ProofOfAddressBreakdown', + :'properties' => :'ProofOfAddressProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ProofOfAddressReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ProofOfAddressReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/repeat_attempts_list.rb b/lib/onfido/models/repeat_attempts_list.rb new file mode 100644 index 0000000..e1b9359 --- /dev/null +++ b/lib/onfido/models/repeat_attempts_list.rb @@ -0,0 +1,292 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class RepeatAttemptsList + # The unique identifier of the completed Document report. + attr_accessor :report_id + + # An array of repeat attempt objects. If no repeat attempts were found, the array will be empty. The number of objects returned can increase over time if more matches are received. + attr_accessor :repeat_attempts + + # The total number of attempts using the same document, including the current report under assessment. + attr_accessor :attempts_count + + # A number between 0 and 1 which indicates the proportion of attempts that have been cleared, including the current report under assessment. + attr_accessor :attempts_clear_rate + + # The number of unique entries in the repeat_attempts field for which at least one of the fields is a mismatch. + attr_accessor :unique_mismatches_count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'report_id' => :'report_id', + :'repeat_attempts' => :'repeat_attempts', + :'attempts_count' => :'attempts_count', + :'attempts_clear_rate' => :'attempts_clear_rate', + :'unique_mismatches_count' => :'unique_mismatches_count' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'report_id' => :'String', + :'repeat_attempts' => :'Array', + :'attempts_count' => :'Integer', + :'attempts_clear_rate' => :'Float', + :'unique_mismatches_count' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::RepeatAttemptsList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::RepeatAttemptsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'report_id') + self.report_id = attributes[:'report_id'] + end + + if attributes.key?(:'repeat_attempts') + if (value = attributes[:'repeat_attempts']).is_a?(Array) + self.repeat_attempts = value + end + else + self.repeat_attempts = nil + end + + if attributes.key?(:'attempts_count') + self.attempts_count = attributes[:'attempts_count'] + end + + if attributes.key?(:'attempts_clear_rate') + self.attempts_clear_rate = attributes[:'attempts_clear_rate'] + end + + if attributes.key?(:'unique_mismatches_count') + self.unique_mismatches_count = attributes[:'unique_mismatches_count'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @repeat_attempts.nil? + invalid_properties.push('invalid value for "repeat_attempts", repeat_attempts cannot be nil.') + end + + if !@attempts_clear_rate.nil? && @attempts_clear_rate > 1 + invalid_properties.push('invalid value for "attempts_clear_rate", must be smaller than or equal to 1.') + end + + if !@attempts_clear_rate.nil? && @attempts_clear_rate < 0 + invalid_properties.push('invalid value for "attempts_clear_rate", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @repeat_attempts.nil? + return false if !@attempts_clear_rate.nil? && @attempts_clear_rate > 1 + return false if !@attempts_clear_rate.nil? && @attempts_clear_rate < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] attempts_clear_rate Value to be assigned + def attempts_clear_rate=(attempts_clear_rate) + if attempts_clear_rate.nil? + fail ArgumentError, 'attempts_clear_rate cannot be nil' + end + + if attempts_clear_rate > 1 + fail ArgumentError, 'invalid value for "attempts_clear_rate", must be smaller than or equal to 1.' + end + + if attempts_clear_rate < 0 + fail ArgumentError, 'invalid value for "attempts_clear_rate", must be greater than or equal to 0.' + end + + @attempts_clear_rate = attempts_clear_rate + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + report_id == o.report_id && + repeat_attempts == o.repeat_attempts && + attempts_count == o.attempts_count && + attempts_clear_rate == o.attempts_clear_rate && + unique_mismatches_count == o.unique_mismatches_count + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [report_id, repeat_attempts, attempts_count, attempts_clear_rate, unique_mismatches_count].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/repeat_attempts_list_repeat_attempts_inner.rb b/lib/onfido/models/repeat_attempts_list_repeat_attempts_inner.rb new file mode 100644 index 0000000..41e62aa --- /dev/null +++ b/lib/onfido/models/repeat_attempts_list_repeat_attempts_inner.rb @@ -0,0 +1,333 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class RepeatAttemptsListRepeatAttemptsInner + # The unique identifier of the matching Document report. + attr_accessor :report_id + + # The unique identifier of the applicant for the matching Document report. + attr_accessor :applicant_id + + # Whether the dates of birth are exactly the same or are different. + attr_accessor :date_of_birth + + # Whether the names are exactly the same or are different. + attr_accessor :names + + # The report result of this attempt. + attr_accessor :result + + # When the matching report was created. + attr_accessor :created_at + + # When the matching report was completed. + attr_accessor :completed_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'report_id' => :'report_id', + :'applicant_id' => :'applicant_id', + :'date_of_birth' => :'date_of_birth', + :'names' => :'names', + :'result' => :'result', + :'created_at' => :'created_at', + :'completed_at' => :'completed_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'report_id' => :'String', + :'applicant_id' => :'String', + :'date_of_birth' => :'String', + :'names' => :'String', + :'result' => :'String', + :'created_at' => :'Time', + :'completed_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::RepeatAttemptsListRepeatAttemptsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::RepeatAttemptsListRepeatAttemptsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'report_id') + self.report_id = attributes[:'report_id'] + end + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'names') + self.names = attributes[:'names'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'completed_at') + self.completed_at = attributes[:'completed_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + date_of_birth_validator = EnumAttributeValidator.new('String', ["match", "mismatch", "unknown_default_open_api"]) + return false unless date_of_birth_validator.valid?(@date_of_birth) + names_validator = EnumAttributeValidator.new('String', ["match", "mismatch", "unknown_default_open_api"]) + return false unless names_validator.valid?(@names) + result_validator = EnumAttributeValidator.new('String', ["clear", "consider", "unknown_default_open_api"]) + return false unless result_validator.valid?(@result) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] date_of_birth Object to be assigned + def date_of_birth=(date_of_birth) + validator = EnumAttributeValidator.new('String', ["match", "mismatch", "unknown_default_open_api"]) + unless validator.valid?(date_of_birth) + fail ArgumentError, "invalid value for \"date_of_birth\", must be one of #{validator.allowable_values}." + end + @date_of_birth = date_of_birth + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] names Object to be assigned + def names=(names) + validator = EnumAttributeValidator.new('String', ["match", "mismatch", "unknown_default_open_api"]) + unless validator.valid?(names) + fail ArgumentError, "invalid value for \"names\", must be one of #{validator.allowable_values}." + end + @names = names + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] result Object to be assigned + def result=(result) + validator = EnumAttributeValidator.new('String', ["clear", "consider", "unknown_default_open_api"]) + unless validator.valid?(result) + fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." + end + @result = result + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + report_id == o.report_id && + applicant_id == o.applicant_id && + date_of_birth == o.date_of_birth && + names == o.names && + result == o.result && + created_at == o.created_at && + completed_at == o.completed_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [report_id, applicant_id, date_of_birth, names, result, created_at, completed_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/report.rb b/lib/onfido/models/report.rb new file mode 100644 index 0000000..68e9cac --- /dev/null +++ b/lib/onfido/models/report.rb @@ -0,0 +1,93 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + module Report + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'DeviceIntelligenceReport', + :'DocumentReport', + :'DocumentVideoReport', + :'DocumentVideoWithAddressInformationReport', + :'DocumentWithAddressInformationReport', + :'DocumentWithDriverVerificationReport', + :'DocumentWithDrivingLicenceInformationReport', + :'FacialSimilarityMotionReport', + :'FacialSimilarityPhotoFullyAutoReport', + :'FacialSimilarityPhotoReport', + :'FacialSimilarityVideoReport', + :'IdentityEnhancedReport', + :'IndiaPanReport', + :'KnownFacesReport', + :'ProofOfAddressReport', + :'UsDrivingLicenceReport', + :'WatchlistAmlReport', + :'WatchlistEnhancedReport', + :'WatchlistPepsOnlyReport', + :'WatchlistSanctionsOnlyReport', + :'WatchlistStandardReport' + ] + end + + # Discriminator's property name (OpenAPI v3) + def openapi_discriminator_name + :'name' + end + + # Discriminator's mapping (OpenAPI v3) + def openapi_discriminator_mapping + { + :'device_intelligence' => :'DeviceIntelligenceReport', + :'document' => :'DocumentReport', + :'document_video' => :'DocumentVideoReport', + :'document_video_with_address_information' => :'DocumentVideoWithAddressInformationReport', + :'document_with_address_information' => :'DocumentWithAddressInformationReport', + :'document_with_driver_verification' => :'DocumentWithDriverVerificationReport', + :'document_with_driving_licence_information' => :'DocumentWithDrivingLicenceInformationReport', + :'facial_similarity_motion' => :'FacialSimilarityMotionReport', + :'facial_similarity_photo' => :'FacialSimilarityPhotoReport', + :'facial_similarity_photo_fully_auto' => :'FacialSimilarityPhotoFullyAutoReport', + :'facial_similarity_video' => :'FacialSimilarityVideoReport', + :'identity_enhanced' => :'IdentityEnhancedReport', + :'india_pan' => :'IndiaPanReport', + :'known_faces' => :'KnownFacesReport', + :'proof_of_address' => :'ProofOfAddressReport', + :'us_driving_licence' => :'UsDrivingLicenceReport', + :'watchlist_aml' => :'WatchlistAmlReport', + :'watchlist_enhanced' => :'WatchlistEnhancedReport', + :'watchlist_peps_only' => :'WatchlistPepsOnlyReport', + :'watchlist_sanctions_only' => :'WatchlistSanctionsOnlyReport', + :'watchlist_standard' => :'WatchlistStandardReport' + } + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + discriminator_value = data[openapi_discriminator_name] + return nil if discriminator_value.nil? + + klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym] + return nil unless klass + + Onfido.const_get(klass).build_from_hash(data) + end + end + end + +end diff --git a/lib/onfido/models/report_document.rb b/lib/onfido/models/report_document.rb new file mode 100644 index 0000000..e76877a --- /dev/null +++ b/lib/onfido/models/report_document.rb @@ -0,0 +1,222 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ReportDocument + # ID of uploaded document to use. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ReportDocument` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ReportDocument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/report_name.rb b/lib/onfido/models/report_name.rb new file mode 100644 index 0000000..bd534ec --- /dev/null +++ b/lib/onfido/models/report_name.rb @@ -0,0 +1,60 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ReportName + DOCUMENT = "document".freeze + DOCUMENT_VIDEO = "document_video".freeze + DOCUMENT_VIDEO_WITH_ADDRESS_INFORMATION = "document_video_with_address_information".freeze + DOCUMENT_WITH_ADDRESS_INFORMATION = "document_with_address_information".freeze + DOCUMENT_WITH_DRIVING_LICENCE_INFORMATION = "document_with_driving_licence_information".freeze + DOCUMENT_WITH_DRIVER_VERIFICATION = "document_with_driver_verification".freeze + FACIAL_SIMILARITY_PHOTO = "facial_similarity_photo".freeze + FACIAL_SIMILARITY_PHOTO_FULLY_AUTO = "facial_similarity_photo_fully_auto".freeze + FACIAL_SIMILARITY_VIDEO = "facial_similarity_video".freeze + FACIAL_SIMILARITY_MOTION = "facial_similarity_motion".freeze + KNOWN_FACES = "known_faces".freeze + IDENTITY_ENHANCED = "identity_enhanced".freeze + WATCHLIST_AML = "watchlist_aml".freeze + WATCHLIST_ENHANCED = "watchlist_enhanced".freeze + WATCHLIST_STANDARD = "watchlist_standard".freeze + WATCHLIST_PEPS_ONLY = "watchlist_peps_only".freeze + WATCHLIST_SANCTIONS_ONLY = "watchlist_sanctions_only".freeze + PROOF_OF_ADDRESS = "proof_of_address".freeze + US_DRIVING_LICENCE = "us_driving_licence".freeze + DEVICE_INTELLIGENCE = "device_intelligence".freeze + INDIA_PAN = "india_pan".freeze + UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze + + def self.all_vars + @all_vars ||= [DOCUMENT, DOCUMENT_VIDEO, DOCUMENT_VIDEO_WITH_ADDRESS_INFORMATION, DOCUMENT_WITH_ADDRESS_INFORMATION, DOCUMENT_WITH_DRIVING_LICENCE_INFORMATION, DOCUMENT_WITH_DRIVER_VERIFICATION, FACIAL_SIMILARITY_PHOTO, FACIAL_SIMILARITY_PHOTO_FULLY_AUTO, FACIAL_SIMILARITY_VIDEO, FACIAL_SIMILARITY_MOTION, KNOWN_FACES, IDENTITY_ENHANCED, WATCHLIST_AML, WATCHLIST_ENHANCED, WATCHLIST_STANDARD, WATCHLIST_PEPS_ONLY, WATCHLIST_SANCTIONS_ONLY, PROOF_OF_ADDRESS, US_DRIVING_LICENCE, DEVICE_INTELLIGENCE, INDIA_PAN, UNKNOWN_DEFAULT_OPEN_API].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ReportName.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ReportName" + end + end +end diff --git a/lib/onfido/models/report_result.rb b/lib/onfido/models/report_result.rb new file mode 100644 index 0000000..ca6bf1b --- /dev/null +++ b/lib/onfido/models/report_result.rb @@ -0,0 +1,42 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ReportResult + CLEAR = "clear".freeze + CONSIDER = "consider".freeze + UNIDENTIFIED = "unidentified".freeze + UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze + + def self.all_vars + @all_vars ||= [CLEAR, CONSIDER, UNIDENTIFIED, UNKNOWN_DEFAULT_OPEN_API].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ReportResult.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ReportResult" + end + end +end diff --git a/lib/onfido/models/report_shared.rb b/lib/onfido/models/report_shared.rb new file mode 100644 index 0000000..38795aa --- /dev/null +++ b/lib/onfido/models/report_shared.rb @@ -0,0 +1,329 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ReportShared + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ReportShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ReportShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/report_status.rb b/lib/onfido/models/report_status.rb new file mode 100644 index 0000000..3a52ce1 --- /dev/null +++ b/lib/onfido/models/report_status.rb @@ -0,0 +1,44 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ReportStatus + AWAITING_DATA = "awaiting_data".freeze + AWAITING_APPROVAL = "awaiting_approval".freeze + CANCELLED = "cancelled".freeze + COMPLETE = "complete".freeze + WITHDRAWN = "withdrawn".freeze + UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze + + def self.all_vars + @all_vars ||= [AWAITING_DATA, AWAITING_APPROVAL, CANCELLED, COMPLETE, WITHDRAWN, UNKNOWN_DEFAULT_OPEN_API].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ReportStatus.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ReportStatus" + end + end +end diff --git a/lib/onfido/models/report_sub_result.rb b/lib/onfido/models/report_sub_result.rb new file mode 100644 index 0000000..96b9ae7 --- /dev/null +++ b/lib/onfido/models/report_sub_result.rb @@ -0,0 +1,43 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ReportSubResult + CLEAR = "clear".freeze + REJECTED = "rejected".freeze + SUSPECTED = "suspected".freeze + CAUTION = "caution".freeze + UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze + + def self.all_vars + @all_vars ||= [CLEAR, REJECTED, SUSPECTED, CAUTION, UNKNOWN_DEFAULT_OPEN_API].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ReportSubResult.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ReportSubResult" + end + end +end diff --git a/lib/onfido/models/reports_list.rb b/lib/onfido/models/reports_list.rb new file mode 100644 index 0000000..797b3d0 --- /dev/null +++ b/lib/onfido/models/reports_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ReportsList + attr_accessor :reports + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reports' => :'reports' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reports' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ReportsList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ReportsList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reports') + if (value = attributes[:'reports']).is_a?(Array) + self.reports = value + end + else + self.reports = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @reports.nil? + invalid_properties.push('invalid value for "reports", reports cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @reports.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reports == o.reports + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reports].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/results_feedback.rb b/lib/onfido/models/results_feedback.rb new file mode 100644 index 0000000..4f68bd5 --- /dev/null +++ b/lib/onfido/models/results_feedback.rb @@ -0,0 +1,279 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class ResultsFeedback + # The expected result for the check or report. + attr_accessor :expected_result + + # The ID of the check (only if report_id is not provided). + attr_accessor :check_id + + # The ID of the check (only if check_id is not provided). + attr_accessor :report_id + + # Any additional information or feedback. + attr_accessor :feedback_notes + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expected_result' => :'expected_result', + :'check_id' => :'check_id', + :'report_id' => :'report_id', + :'feedback_notes' => :'feedback_notes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'expected_result' => :'String', + :'check_id' => :'String', + :'report_id' => :'String', + :'feedback_notes' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ResultsFeedback` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ResultsFeedback`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'expected_result') + self.expected_result = attributes[:'expected_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'report_id') + self.report_id = attributes[:'report_id'] + end + + if attributes.key?(:'feedback_notes') + self.feedback_notes = attributes[:'feedback_notes'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + expected_result_validator = EnumAttributeValidator.new('String', ["clear", "consider", "unknown_default_open_api"]) + return false unless expected_result_validator.valid?(@expected_result) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] expected_result Object to be assigned + def expected_result=(expected_result) + validator = EnumAttributeValidator.new('String', ["clear", "consider", "unknown_default_open_api"]) + unless validator.valid?(expected_result) + fail ArgumentError, "invalid value for \"expected_result\", must be one of #{validator.allowable_values}." + end + @expected_result = expected_result + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expected_result == o.expected_result && + check_id == o.check_id && + report_id == o.report_id && + feedback_notes == o.feedback_notes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expected_result, check_id, report_id, feedback_notes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/sdk_token.rb b/lib/onfido/models/sdk_token.rb new file mode 100644 index 0000000..a8eb3d3 --- /dev/null +++ b/lib/onfido/models/sdk_token.rb @@ -0,0 +1,229 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class SdkToken + # The generated SDK token + attr_accessor :token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'token' => :'token' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'SdkTokenResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::SdkToken` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::SdkToken`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'token') + self.token = attributes[:'token'] + else + self.token = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @token.nil? + invalid_properties.push('invalid value for "token", token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @token.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + token == o.token + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/sdk_token_builder.rb b/lib/onfido/models/sdk_token_builder.rb new file mode 100644 index 0000000..bcfad70 --- /dev/null +++ b/lib/onfido/models/sdk_token_builder.rb @@ -0,0 +1,259 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class SdkTokenBuilder + # The unique identifier of the applicant + attr_accessor :applicant_id + + # The referrer URL pattern + attr_accessor :referrer + + # The application ID (iOS or Android) + attr_accessor :application_id + + # The URL to be used by the Web SDK for the cross device flow. + attr_accessor :cross_device_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'applicant_id' => :'applicant_id', + :'referrer' => :'referrer', + :'application_id' => :'application_id', + :'cross_device_url' => :'cross_device_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'applicant_id' => :'String', + :'referrer' => :'String', + :'application_id' => :'String', + :'cross_device_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'SdkTokenRequest' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::SdkTokenBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::SdkTokenBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'referrer') + self.referrer = attributes[:'referrer'] + end + + if attributes.key?(:'application_id') + self.application_id = attributes[:'application_id'] + end + + if attributes.key?(:'cross_device_url') + self.cross_device_url = attributes[:'cross_device_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + applicant_id == o.applicant_id && + referrer == o.referrer && + application_id == o.application_id && + cross_device_url == o.cross_device_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [applicant_id, referrer, application_id, cross_device_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/sdk_token_request.rb b/lib/onfido/models/sdk_token_request.rb new file mode 100644 index 0000000..5f80ab7 --- /dev/null +++ b/lib/onfido/models/sdk_token_request.rb @@ -0,0 +1,252 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class SdkTokenRequest + # The unique identifier of the applicant + attr_accessor :applicant_id + + # The referrer URL pattern + attr_accessor :referrer + + # The application ID (iOS or Android) + attr_accessor :application_id + + # The URL to be used by the Web SDK for the cross device flow. + attr_accessor :cross_device_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'applicant_id' => :'applicant_id', + :'referrer' => :'referrer', + :'application_id' => :'application_id', + :'cross_device_url' => :'cross_device_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'applicant_id' => :'String', + :'referrer' => :'String', + :'application_id' => :'String', + :'cross_device_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::SdkTokenRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::SdkTokenRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'referrer') + self.referrer = attributes[:'referrer'] + end + + if attributes.key?(:'application_id') + self.application_id = attributes[:'application_id'] + end + + if attributes.key?(:'cross_device_url') + self.cross_device_url = attributes[:'cross_device_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + applicant_id == o.applicant_id && + referrer == o.referrer && + application_id == o.application_id && + cross_device_url == o.cross_device_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [applicant_id, referrer, application_id, cross_device_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/sdk_token_response.rb b/lib/onfido/models/sdk_token_response.rb new file mode 100644 index 0000000..55280af --- /dev/null +++ b/lib/onfido/models/sdk_token_response.rb @@ -0,0 +1,222 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class SdkTokenResponse + # The generated SDK token + attr_accessor :token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'token' => :'token' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::SdkTokenResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::SdkTokenResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'token') + self.token = attributes[:'token'] + else + self.token = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @token.nil? + invalid_properties.push('invalid value for "token", token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @token.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + token == o.token + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/task.rb b/lib/onfido/models/task.rb new file mode 100644 index 0000000..8d937be --- /dev/null +++ b/lib/onfido/models/task.rb @@ -0,0 +1,266 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Task + # The identifier for the Task. + attr_accessor :id + + # The identifier for the Task Definition. + attr_accessor :task_def_id + + # The date and time when the Task was created. + attr_accessor :created_at + + # The date and time when the Task was last updated. + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'task_def_id' => :'task_def_id', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'task_def_id' => :'String', + :'created_at' => :'Time', + :'updated_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Task` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Task`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'task_def_id') + self.task_def_id = attributes[:'task_def_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + pattern = Regexp.new(/^[0-9a-z-_]+$/) + if !@task_def_id.nil? && @task_def_id !~ pattern + invalid_properties.push("invalid value for \"task_def_id\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@task_def_id.nil? && @task_def_id !~ Regexp.new(/^[0-9a-z-_]+$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] task_def_id Value to be assigned + def task_def_id=(task_def_id) + if task_def_id.nil? + fail ArgumentError, 'task_def_id cannot be nil' + end + + pattern = Regexp.new(/^[0-9a-z-_]+$/) + if task_def_id !~ pattern + fail ArgumentError, "invalid value for \"task_def_id\", must conform to the pattern #{pattern}." + end + + @task_def_id = task_def_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + task_def_id == o.task_def_id && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, task_def_id, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/update_monitor_match_request.rb b/lib/onfido/models/update_monitor_match_request.rb new file mode 100644 index 0000000..fc81404 --- /dev/null +++ b/lib/onfido/models/update_monitor_match_request.rb @@ -0,0 +1,227 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class UpdateMonitorMatchRequest + attr_accessor :enable + + attr_accessor :disable + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enable' => :'enable', + :'disable' => :'disable' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enable' => :'Array', + :'disable' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UpdateMonitorMatchRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UpdateMonitorMatchRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enable') + if (value = attributes[:'enable']).is_a?(Array) + self.enable = value + end + end + + if attributes.key?(:'disable') + if (value = attributes[:'disable']).is_a?(Array) + self.disable = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enable == o.enable && + disable == o.disable + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enable, disable].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_breakdown.rb b/lib/onfido/models/us_driving_licence_breakdown.rb new file mode 100644 index 0000000..6b00916 --- /dev/null +++ b/lib/onfido/models/us_driving_licence_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class UsDrivingLicenceBreakdown + attr_accessor :document + + attr_accessor :address + + attr_accessor :personal + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'document' => :'document', + :'address' => :'address', + :'personal' => :'personal' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'document' => :'UsDrivingLicenceBreakdownDocument', + :'address' => :'UsDrivingLicenceBreakdownAddress', + :'personal' => :'UsDrivingLicenceBreakdownPersonal' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'document') + self.document = attributes[:'document'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'personal') + self.personal = attributes[:'personal'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + document == o.document && + address == o.address && + personal == o.personal + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [document, address, personal].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_breakdown_address.rb b/lib/onfido/models/us_driving_licence_breakdown_address.rb new file mode 100644 index 0000000..d1cd003 --- /dev/null +++ b/lib/onfido/models/us_driving_licence_breakdown_address.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the address data provided matches a real driving license in the DMV driver's license database. + class UsDrivingLicenceBreakdownAddress + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'UsDrivingLicenceBreakdownAddressBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBreakdownAddress` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBreakdownAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_breakdown_address_breakdown.rb b/lib/onfido/models/us_driving_licence_breakdown_address_breakdown.rb new file mode 100644 index 0000000..84eaed8 --- /dev/null +++ b/lib/onfido/models/us_driving_licence_breakdown_address_breakdown.rb @@ -0,0 +1,259 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class UsDrivingLicenceBreakdownAddressBreakdown + attr_accessor :city + + attr_accessor :line_1 + + attr_accessor :line_2 + + attr_accessor :state_code + + attr_accessor :zip4 + + attr_accessor :zip5 + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'city' => :'city', + :'line_1' => :'line_1', + :'line_2' => :'line_2', + :'state_code' => :'state_code', + :'zip4' => :'zip4', + :'zip5' => :'zip5' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'city' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'line_1' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'line_2' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'state_code' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'zip4' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'zip5' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBreakdownAddressBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBreakdownAddressBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'line_1') + self.line_1 = attributes[:'line_1'] + end + + if attributes.key?(:'line_2') + self.line_2 = attributes[:'line_2'] + end + + if attributes.key?(:'state_code') + self.state_code = attributes[:'state_code'] + end + + if attributes.key?(:'zip4') + self.zip4 = attributes[:'zip4'] + end + + if attributes.key?(:'zip5') + self.zip5 = attributes[:'zip5'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + city == o.city && + line_1 == o.line_1 && + line_2 == o.line_2 && + state_code == o.state_code && + zip4 == o.zip4 && + zip5 == o.zip5 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [city, line_1, line_2, state_code, zip4, zip5].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_breakdown_document.rb b/lib/onfido/models/us_driving_licence_breakdown_document.rb new file mode 100644 index 0000000..cb791ae --- /dev/null +++ b/lib/onfido/models/us_driving_licence_breakdown_document.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the document data provided matches a real driving license in the DMV driver's license database. + class UsDrivingLicenceBreakdownDocument + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'UsDrivingLicenceBreakdownDocumentBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBreakdownDocument` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBreakdownDocument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_breakdown_document_breakdown.rb b/lib/onfido/models/us_driving_licence_breakdown_document_breakdown.rb new file mode 100644 index 0000000..dcfd9fb --- /dev/null +++ b/lib/onfido/models/us_driving_licence_breakdown_document_breakdown.rb @@ -0,0 +1,241 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class UsDrivingLicenceBreakdownDocumentBreakdown + attr_accessor :category + + attr_accessor :expiration_date + + attr_accessor :issue_date + + attr_accessor :document_number + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category' => :'category', + :'expiration_date' => :'expiration_date', + :'issue_date' => :'issue_date', + :'document_number' => :'document_number' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'category' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'expiration_date' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'issue_date' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'document_number' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBreakdownDocumentBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBreakdownDocumentBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'issue_date') + self.issue_date = attributes[:'issue_date'] + end + + if attributes.key?(:'document_number') + self.document_number = attributes[:'document_number'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + expiration_date == o.expiration_date && + issue_date == o.issue_date && + document_number == o.document_number + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [category, expiration_date, issue_date, document_number].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_breakdown_personal.rb b/lib/onfido/models/us_driving_licence_breakdown_personal.rb new file mode 100644 index 0000000..00dfea4 --- /dev/null +++ b/lib/onfido/models/us_driving_licence_breakdown_personal.rb @@ -0,0 +1,224 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts whether the personal data provided matches a real driving license in the DMV driver's license database. + class UsDrivingLicenceBreakdownPersonal + attr_accessor :result + + attr_accessor :breakdown + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'breakdown' => :'breakdown' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'breakdown' => :'UsDrivingLicenceBreakdownPersonalBreakdown' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBreakdownPersonal` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBreakdownPersonal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + breakdown == o.breakdown + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, breakdown].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_breakdown_personal_breakdown.rb b/lib/onfido/models/us_driving_licence_breakdown_personal_breakdown.rb new file mode 100644 index 0000000..49240f2 --- /dev/null +++ b/lib/onfido/models/us_driving_licence_breakdown_personal_breakdown.rb @@ -0,0 +1,322 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class UsDrivingLicenceBreakdownPersonalBreakdown + attr_accessor :first_name + + attr_accessor :name_suffix + + attr_accessor :height + + attr_accessor :weight + + attr_accessor :sex_code + + attr_accessor :eye_color + + attr_accessor :date_of_birth + + attr_accessor :last_name + + attr_accessor :middle_name + + attr_accessor :first_name_fuzzy + + attr_accessor :middle_name_fuzzy + + attr_accessor :last_name_fuzzy + + attr_accessor :middle_initial + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'first_name' => :'first_name', + :'name_suffix' => :'name_suffix', + :'height' => :'height', + :'weight' => :'weight', + :'sex_code' => :'sex_code', + :'eye_color' => :'eye_color', + :'date_of_birth' => :'date_of_birth', + :'last_name' => :'last_name', + :'middle_name' => :'middle_name', + :'first_name_fuzzy' => :'first_name_fuzzy', + :'middle_name_fuzzy' => :'middle_name_fuzzy', + :'last_name_fuzzy' => :'last_name_fuzzy', + :'middle_initial' => :'middle_initial' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'first_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'name_suffix' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'height' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'weight' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'sex_code' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'eye_color' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'date_of_birth' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'last_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'middle_name' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'first_name_fuzzy' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'middle_name_fuzzy' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'last_name_fuzzy' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry', + :'middle_initial' => :'DocumentBreakdownDataComparisonBreakdownIssuingCountry' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBreakdownPersonalBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBreakdownPersonalBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'name_suffix') + self.name_suffix = attributes[:'name_suffix'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'weight') + self.weight = attributes[:'weight'] + end + + if attributes.key?(:'sex_code') + self.sex_code = attributes[:'sex_code'] + end + + if attributes.key?(:'eye_color') + self.eye_color = attributes[:'eye_color'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'middle_name') + self.middle_name = attributes[:'middle_name'] + end + + if attributes.key?(:'first_name_fuzzy') + self.first_name_fuzzy = attributes[:'first_name_fuzzy'] + end + + if attributes.key?(:'middle_name_fuzzy') + self.middle_name_fuzzy = attributes[:'middle_name_fuzzy'] + end + + if attributes.key?(:'last_name_fuzzy') + self.last_name_fuzzy = attributes[:'last_name_fuzzy'] + end + + if attributes.key?(:'middle_initial') + self.middle_initial = attributes[:'middle_initial'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_name == o.first_name && + name_suffix == o.name_suffix && + height == o.height && + weight == o.weight && + sex_code == o.sex_code && + eye_color == o.eye_color && + date_of_birth == o.date_of_birth && + last_name == o.last_name && + middle_name == o.middle_name && + first_name_fuzzy == o.first_name_fuzzy && + middle_name_fuzzy == o.middle_name_fuzzy && + last_name_fuzzy == o.last_name_fuzzy && + middle_initial == o.middle_initial + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [first_name, name_suffix, height, weight, sex_code, eye_color, date_of_birth, last_name, middle_name, first_name_fuzzy, middle_name_fuzzy, last_name_fuzzy, middle_initial].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_builder.rb b/lib/onfido/models/us_driving_licence_builder.rb new file mode 100644 index 0000000..8caf623 --- /dev/null +++ b/lib/onfido/models/us_driving_licence_builder.rb @@ -0,0 +1,505 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class UsDrivingLicenceBuilder + # Driving licence ID number + attr_accessor :id_number + + # Two letter code of issuing state (state-issued driving licenses only) + attr_accessor :issue_state + + # Line 1 of the address + attr_accessor :address_line_1 + + # Line 2 of the address + attr_accessor :address_line_2 + + # The city of the owner's address + attr_accessor :city + + # Date of birth in yyyy-mm-dd format + attr_accessor :date_of_birth + + # Document category. + attr_accessor :document_category + + # Expiration date of the driving licence in yyyy-mm-dd format + attr_accessor :expiration_date + + # Eye color code. + attr_accessor :eye_color_code + + # The owner's first name + attr_accessor :first_name + + attr_accessor :gender + + # Issue date in yyyy-mm-dd format + attr_accessor :issue_date + + # The owner's surname + attr_accessor :last_name + + # The owner's middle name + attr_accessor :middle_name + + # The owner's name suffix + attr_accessor :name_suffix + + # The postcode or ZIP of the owner's address + attr_accessor :postal_code + + # 2-characters state code + attr_accessor :state + + # Weight in pounds + attr_accessor :weight_measure + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id_number' => :'id_number', + :'issue_state' => :'issue_state', + :'address_line_1' => :'address_line_1', + :'address_line_2' => :'address_line_2', + :'city' => :'city', + :'date_of_birth' => :'date_of_birth', + :'document_category' => :'document_category', + :'expiration_date' => :'expiration_date', + :'eye_color_code' => :'eye_color_code', + :'first_name' => :'first_name', + :'gender' => :'gender', + :'issue_date' => :'issue_date', + :'last_name' => :'last_name', + :'middle_name' => :'middle_name', + :'name_suffix' => :'name_suffix', + :'postal_code' => :'postal_code', + :'state' => :'state', + :'weight_measure' => :'weight_measure' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id_number' => :'String', + :'issue_state' => :'String', + :'address_line_1' => :'String', + :'address_line_2' => :'String', + :'city' => :'String', + :'date_of_birth' => :'Date', + :'document_category' => :'String', + :'expiration_date' => :'Date', + :'eye_color_code' => :'String', + :'first_name' => :'String', + :'gender' => :'String', + :'issue_date' => :'Date', + :'last_name' => :'String', + :'middle_name' => :'String', + :'name_suffix' => :'String', + :'postal_code' => :'String', + :'state' => :'String', + :'weight_measure' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'UsDrivingLicenceShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id_number') + self.id_number = attributes[:'id_number'] + else + self.id_number = nil + end + + if attributes.key?(:'issue_state') + self.issue_state = attributes[:'issue_state'] + else + self.issue_state = nil + end + + if attributes.key?(:'address_line_1') + self.address_line_1 = attributes[:'address_line_1'] + end + + if attributes.key?(:'address_line_2') + self.address_line_2 = attributes[:'address_line_2'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'document_category') + self.document_category = attributes[:'document_category'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'eye_color_code') + self.eye_color_code = attributes[:'eye_color_code'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'issue_date') + self.issue_date = attributes[:'issue_date'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'middle_name') + self.middle_name = attributes[:'middle_name'] + end + + if attributes.key?(:'name_suffix') + self.name_suffix = attributes[:'name_suffix'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'weight_measure') + self.weight_measure = attributes[:'weight_measure'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id_number.nil? + invalid_properties.push('invalid value for "id_number", id_number cannot be nil.') + end + + if @issue_state.nil? + invalid_properties.push('invalid value for "issue_state", issue_state cannot be nil.') + end + + pattern = Regexp.new(/^[A-Z]{2}$/) + if @issue_state !~ pattern + invalid_properties.push("invalid value for \"issue_state\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[A-Z]{2}$/) + if !@state.nil? && @state !~ pattern + invalid_properties.push("invalid value for \"state\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id_number.nil? + return false if @issue_state.nil? + return false if @issue_state !~ Regexp.new(/^[A-Z]{2}$/) + document_category_validator = EnumAttributeValidator.new('String', ["driver license", "driver permit", "id card", "unknown_default_open_api"]) + return false unless document_category_validator.valid?(@document_category) + eye_color_code_validator = EnumAttributeValidator.new('String', ["BLK", "BLU", "BRO", "DIC", "GRY", "GRN", "HAZ", "MAR", "PNK", "unknown_default_open_api"]) + return false unless eye_color_code_validator.valid?(@eye_color_code) + gender_validator = EnumAttributeValidator.new('String', ["Male", "Female", "unknown_default_open_api"]) + return false unless gender_validator.valid?(@gender) + return false if !@state.nil? && @state !~ Regexp.new(/^[A-Z]{2}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] issue_state Value to be assigned + def issue_state=(issue_state) + if issue_state.nil? + fail ArgumentError, 'issue_state cannot be nil' + end + + pattern = Regexp.new(/^[A-Z]{2}$/) + if issue_state !~ pattern + fail ArgumentError, "invalid value for \"issue_state\", must conform to the pattern #{pattern}." + end + + @issue_state = issue_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] document_category Object to be assigned + def document_category=(document_category) + validator = EnumAttributeValidator.new('String', ["driver license", "driver permit", "id card", "unknown_default_open_api"]) + unless validator.valid?(document_category) + fail ArgumentError, "invalid value for \"document_category\", must be one of #{validator.allowable_values}." + end + @document_category = document_category + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] eye_color_code Object to be assigned + def eye_color_code=(eye_color_code) + validator = EnumAttributeValidator.new('String', ["BLK", "BLU", "BRO", "DIC", "GRY", "GRN", "HAZ", "MAR", "PNK", "unknown_default_open_api"]) + unless validator.valid?(eye_color_code) + fail ArgumentError, "invalid value for \"eye_color_code\", must be one of #{validator.allowable_values}." + end + @eye_color_code = eye_color_code + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gender Object to be assigned + def gender=(gender) + validator = EnumAttributeValidator.new('String', ["Male", "Female", "unknown_default_open_api"]) + unless validator.valid?(gender) + fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}." + end + @gender = gender + end + + # Custom attribute writer method with validation + # @param [Object] state Value to be assigned + def state=(state) + if state.nil? + fail ArgumentError, 'state cannot be nil' + end + + pattern = Regexp.new(/^[A-Z]{2}$/) + if state !~ pattern + fail ArgumentError, "invalid value for \"state\", must conform to the pattern #{pattern}." + end + + @state = state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id_number == o.id_number && + issue_state == o.issue_state && + address_line_1 == o.address_line_1 && + address_line_2 == o.address_line_2 && + city == o.city && + date_of_birth == o.date_of_birth && + document_category == o.document_category && + expiration_date == o.expiration_date && + eye_color_code == o.eye_color_code && + first_name == o.first_name && + gender == o.gender && + issue_date == o.issue_date && + last_name == o.last_name && + middle_name == o.middle_name && + name_suffix == o.name_suffix && + postal_code == o.postal_code && + state == o.state && + weight_measure == o.weight_measure + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id_number, issue_state, address_line_1, address_line_2, city, date_of_birth, document_category, expiration_date, eye_color_code, first_name, gender, issue_date, last_name, middle_name, name_suffix, postal_code, state, weight_measure].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_report.rb b/lib/onfido/models/us_driving_licence_report.rb new file mode 100644 index 0000000..03c5760 --- /dev/null +++ b/lib/onfido/models/us_driving_licence_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class UsDrivingLicenceReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'UsDrivingLicenceBreakdown', + :'properties' => :'DocumentProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/us_driving_licence_shared.rb b/lib/onfido/models/us_driving_licence_shared.rb new file mode 100644 index 0000000..6e7346b --- /dev/null +++ b/lib/onfido/models/us_driving_licence_shared.rb @@ -0,0 +1,499 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # An object that contains all accepted fields for the Driver's License Data Verification report. + class UsDrivingLicenceShared + # Driving licence ID number + attr_accessor :id_number + + # Two letter code of issuing state (state-issued driving licenses only) + attr_accessor :issue_state + + # Line 1 of the address + attr_accessor :address_line_1 + + # Line 2 of the address + attr_accessor :address_line_2 + + # The city of the owner's address + attr_accessor :city + + # Date of birth in yyyy-mm-dd format + attr_accessor :date_of_birth + + # Document category. + attr_accessor :document_category + + # Expiration date of the driving licence in yyyy-mm-dd format + attr_accessor :expiration_date + + # Eye color code. + attr_accessor :eye_color_code + + # The owner's first name + attr_accessor :first_name + + attr_accessor :gender + + # Issue date in yyyy-mm-dd format + attr_accessor :issue_date + + # The owner's surname + attr_accessor :last_name + + # The owner's middle name + attr_accessor :middle_name + + # The owner's name suffix + attr_accessor :name_suffix + + # The postcode or ZIP of the owner's address + attr_accessor :postal_code + + # 2-characters state code + attr_accessor :state + + # Weight in pounds + attr_accessor :weight_measure + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id_number' => :'id_number', + :'issue_state' => :'issue_state', + :'address_line_1' => :'address_line_1', + :'address_line_2' => :'address_line_2', + :'city' => :'city', + :'date_of_birth' => :'date_of_birth', + :'document_category' => :'document_category', + :'expiration_date' => :'expiration_date', + :'eye_color_code' => :'eye_color_code', + :'first_name' => :'first_name', + :'gender' => :'gender', + :'issue_date' => :'issue_date', + :'last_name' => :'last_name', + :'middle_name' => :'middle_name', + :'name_suffix' => :'name_suffix', + :'postal_code' => :'postal_code', + :'state' => :'state', + :'weight_measure' => :'weight_measure' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id_number' => :'String', + :'issue_state' => :'String', + :'address_line_1' => :'String', + :'address_line_2' => :'String', + :'city' => :'String', + :'date_of_birth' => :'Date', + :'document_category' => :'String', + :'expiration_date' => :'Date', + :'eye_color_code' => :'String', + :'first_name' => :'String', + :'gender' => :'String', + :'issue_date' => :'Date', + :'last_name' => :'String', + :'middle_name' => :'String', + :'name_suffix' => :'String', + :'postal_code' => :'String', + :'state' => :'String', + :'weight_measure' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::UsDrivingLicenceShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::UsDrivingLicenceShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id_number') + self.id_number = attributes[:'id_number'] + else + self.id_number = nil + end + + if attributes.key?(:'issue_state') + self.issue_state = attributes[:'issue_state'] + else + self.issue_state = nil + end + + if attributes.key?(:'address_line_1') + self.address_line_1 = attributes[:'address_line_1'] + end + + if attributes.key?(:'address_line_2') + self.address_line_2 = attributes[:'address_line_2'] + end + + if attributes.key?(:'city') + self.city = attributes[:'city'] + end + + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + + if attributes.key?(:'document_category') + self.document_category = attributes[:'document_category'] + end + + if attributes.key?(:'expiration_date') + self.expiration_date = attributes[:'expiration_date'] + end + + if attributes.key?(:'eye_color_code') + self.eye_color_code = attributes[:'eye_color_code'] + end + + if attributes.key?(:'first_name') + self.first_name = attributes[:'first_name'] + end + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'issue_date') + self.issue_date = attributes[:'issue_date'] + end + + if attributes.key?(:'last_name') + self.last_name = attributes[:'last_name'] + end + + if attributes.key?(:'middle_name') + self.middle_name = attributes[:'middle_name'] + end + + if attributes.key?(:'name_suffix') + self.name_suffix = attributes[:'name_suffix'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'weight_measure') + self.weight_measure = attributes[:'weight_measure'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id_number.nil? + invalid_properties.push('invalid value for "id_number", id_number cannot be nil.') + end + + if @issue_state.nil? + invalid_properties.push('invalid value for "issue_state", issue_state cannot be nil.') + end + + pattern = Regexp.new(/^[A-Z]{2}$/) + if @issue_state !~ pattern + invalid_properties.push("invalid value for \"issue_state\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/^[A-Z]{2}$/) + if !@state.nil? && @state !~ pattern + invalid_properties.push("invalid value for \"state\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id_number.nil? + return false if @issue_state.nil? + return false if @issue_state !~ Regexp.new(/^[A-Z]{2}$/) + document_category_validator = EnumAttributeValidator.new('String', ["driver license", "driver permit", "id card", "unknown_default_open_api"]) + return false unless document_category_validator.valid?(@document_category) + eye_color_code_validator = EnumAttributeValidator.new('String', ["BLK", "BLU", "BRO", "DIC", "GRY", "GRN", "HAZ", "MAR", "PNK", "unknown_default_open_api"]) + return false unless eye_color_code_validator.valid?(@eye_color_code) + gender_validator = EnumAttributeValidator.new('String', ["Male", "Female", "unknown_default_open_api"]) + return false unless gender_validator.valid?(@gender) + return false if !@state.nil? && @state !~ Regexp.new(/^[A-Z]{2}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] issue_state Value to be assigned + def issue_state=(issue_state) + if issue_state.nil? + fail ArgumentError, 'issue_state cannot be nil' + end + + pattern = Regexp.new(/^[A-Z]{2}$/) + if issue_state !~ pattern + fail ArgumentError, "invalid value for \"issue_state\", must conform to the pattern #{pattern}." + end + + @issue_state = issue_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] document_category Object to be assigned + def document_category=(document_category) + validator = EnumAttributeValidator.new('String', ["driver license", "driver permit", "id card", "unknown_default_open_api"]) + unless validator.valid?(document_category) + fail ArgumentError, "invalid value for \"document_category\", must be one of #{validator.allowable_values}." + end + @document_category = document_category + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] eye_color_code Object to be assigned + def eye_color_code=(eye_color_code) + validator = EnumAttributeValidator.new('String', ["BLK", "BLU", "BRO", "DIC", "GRY", "GRN", "HAZ", "MAR", "PNK", "unknown_default_open_api"]) + unless validator.valid?(eye_color_code) + fail ArgumentError, "invalid value for \"eye_color_code\", must be one of #{validator.allowable_values}." + end + @eye_color_code = eye_color_code + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gender Object to be assigned + def gender=(gender) + validator = EnumAttributeValidator.new('String', ["Male", "Female", "unknown_default_open_api"]) + unless validator.valid?(gender) + fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}." + end + @gender = gender + end + + # Custom attribute writer method with validation + # @param [Object] state Value to be assigned + def state=(state) + if state.nil? + fail ArgumentError, 'state cannot be nil' + end + + pattern = Regexp.new(/^[A-Z]{2}$/) + if state !~ pattern + fail ArgumentError, "invalid value for \"state\", must conform to the pattern #{pattern}." + end + + @state = state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id_number == o.id_number && + issue_state == o.issue_state && + address_line_1 == o.address_line_1 && + address_line_2 == o.address_line_2 && + city == o.city && + date_of_birth == o.date_of_birth && + document_category == o.document_category && + expiration_date == o.expiration_date && + eye_color_code == o.eye_color_code && + first_name == o.first_name && + gender == o.gender && + issue_date == o.issue_date && + last_name == o.last_name && + middle_name == o.middle_name && + name_suffix == o.name_suffix && + postal_code == o.postal_code && + state == o.state && + weight_measure == o.weight_measure + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id_number, issue_state, address_line_1, address_line_2, city, date_of_birth, document_category, expiration_date, eye_color_code, first_name, gender, issue_date, last_name, middle_name, name_suffix, postal_code, state, weight_measure].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/video_reasons.rb b/lib/onfido/models/video_reasons.rb new file mode 100644 index 0000000..1a98c40 --- /dev/null +++ b/lib/onfido/models/video_reasons.rb @@ -0,0 +1,245 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class VideoReasons + # Flags when evidence is found that a fake webcam was used. + attr_accessor :fake_webcam + + # Flags when evidence is found that the video was uploaded in an attempt to circumvent the randomness of the speaking and head turn challenges + attr_accessor :challenge_reuse + + # Flags when evidence is found that an Android emulator was used. + attr_accessor :emulator + + # Additional comma separated details such as the name of the fake webcam. + attr_accessor :reasons + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'fake_webcam' => :'fake_webcam', + :'challenge_reuse' => :'challenge_reuse', + :'emulator' => :'emulator', + :'reasons' => :'reasons' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'fake_webcam' => :'String', + :'challenge_reuse' => :'String', + :'emulator' => :'String', + :'reasons' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::VideoReasons` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::VideoReasons`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'fake_webcam') + self.fake_webcam = attributes[:'fake_webcam'] + end + + if attributes.key?(:'challenge_reuse') + self.challenge_reuse = attributes[:'challenge_reuse'] + end + + if attributes.key?(:'emulator') + self.emulator = attributes[:'emulator'] + end + + if attributes.key?(:'reasons') + self.reasons = attributes[:'reasons'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + fake_webcam == o.fake_webcam && + challenge_reuse == o.challenge_reuse && + emulator == o.emulator && + reasons == o.reasons + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [fake_webcam, challenge_reuse, emulator, reasons].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_aml_breakdown.rb b/lib/onfido/models/watchlist_aml_breakdown.rb new file mode 100644 index 0000000..52be9e5 --- /dev/null +++ b/lib/onfido/models/watchlist_aml_breakdown.rb @@ -0,0 +1,241 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistAmlBreakdown + attr_accessor :sanction + + attr_accessor :politically_exposed_person + + attr_accessor :legal_and_regulatory_warnings + + attr_accessor :adverse_media + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sanction' => :'sanction', + :'politically_exposed_person' => :'politically_exposed_person', + :'legal_and_regulatory_warnings' => :'legal_and_regulatory_warnings', + :'adverse_media' => :'adverse_media' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sanction' => :'WatchlistAmlBreakdownSanction', + :'politically_exposed_person' => :'WatchlistAmlBreakdownPoliticallyExposedPerson', + :'legal_and_regulatory_warnings' => :'WatchlistAmlBreakdownLegalAndRegulatoryWarnings', + :'adverse_media' => :'WatchlistAmlBreakdownAdverseMedia' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistAmlBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistAmlBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sanction') + self.sanction = attributes[:'sanction'] + end + + if attributes.key?(:'politically_exposed_person') + self.politically_exposed_person = attributes[:'politically_exposed_person'] + end + + if attributes.key?(:'legal_and_regulatory_warnings') + self.legal_and_regulatory_warnings = attributes[:'legal_and_regulatory_warnings'] + end + + if attributes.key?(:'adverse_media') + self.adverse_media = attributes[:'adverse_media'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sanction == o.sanction && + politically_exposed_person == o.politically_exposed_person && + legal_and_regulatory_warnings == o.legal_and_regulatory_warnings && + adverse_media == o.adverse_media + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sanction, politically_exposed_person, legal_and_regulatory_warnings, adverse_media].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_aml_breakdown_adverse_media.rb b/lib/onfido/models/watchlist_aml_breakdown_adverse_media.rb new file mode 100644 index 0000000..ffc31d2 --- /dev/null +++ b/lib/onfido/models/watchlist_aml_breakdown_adverse_media.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if there are any records found of negative events reported by publicly and generally available media sources. + class WatchlistAmlBreakdownAdverseMedia + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistAmlBreakdownAdverseMedia` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistAmlBreakdownAdverseMedia`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_aml_breakdown_legal_and_regulatory_warnings.rb b/lib/onfido/models/watchlist_aml_breakdown_legal_and_regulatory_warnings.rb new file mode 100644 index 0000000..2af27c3 --- /dev/null +++ b/lib/onfido/models/watchlist_aml_breakdown_legal_and_regulatory_warnings.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if there are any records found in Law-Enforcement and Regulatory bodies Monitored Lists (including Terrorism, Money Laundering and Most Wanted lists). + class WatchlistAmlBreakdownLegalAndRegulatoryWarnings + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistAmlBreakdownLegalAndRegulatoryWarnings` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistAmlBreakdownLegalAndRegulatoryWarnings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_aml_breakdown_politically_exposed_person.rb b/lib/onfido/models/watchlist_aml_breakdown_politically_exposed_person.rb new file mode 100644 index 0000000..dbcf57d --- /dev/null +++ b/lib/onfido/models/watchlist_aml_breakdown_politically_exposed_person.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if there are any records found in the proprietary database of Politically Exposed Persons sourced from government lists, websites and other media sources. + class WatchlistAmlBreakdownPoliticallyExposedPerson + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistAmlBreakdownPoliticallyExposedPerson` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistAmlBreakdownPoliticallyExposedPerson`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_aml_breakdown_sanction.rb b/lib/onfido/models/watchlist_aml_breakdown_sanction.rb new file mode 100644 index 0000000..51e1e25 --- /dev/null +++ b/lib/onfido/models/watchlist_aml_breakdown_sanction.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Asserts if there are any records found in Government and International Organisations Sanctions Lists. + class WatchlistAmlBreakdownSanction + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistAmlBreakdownSanction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistAmlBreakdownSanction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_aml_properties.rb b/lib/onfido/models/watchlist_aml_properties.rb new file mode 100644 index 0000000..2faf523 --- /dev/null +++ b/lib/onfido/models/watchlist_aml_properties.rb @@ -0,0 +1,217 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistAmlProperties + # Returns any matches including, but not limited to, name and date of birth of match, aliases and associates, and relevant events and sources. + attr_accessor :records + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'records' => :'records' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'records' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistAmlProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistAmlProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'records') + if (value = attributes[:'records']).is_a?(Array) + self.records = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + records == o.records + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [records].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_aml_report.rb b/lib/onfido/models/watchlist_aml_report.rb new file mode 100644 index 0000000..81dc68a --- /dev/null +++ b/lib/onfido/models/watchlist_aml_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistAmlReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'WatchlistAmlBreakdown', + :'properties' => :'WatchlistAmlProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistAmlReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistAmlReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_enhanced_breakdown.rb b/lib/onfido/models/watchlist_enhanced_breakdown.rb new file mode 100644 index 0000000..79227e1 --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_breakdown.rb @@ -0,0 +1,241 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedBreakdown + attr_accessor :politically_exposed_person + + attr_accessor :sanction + + attr_accessor :adverse_media + + attr_accessor :monitored_lists + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'politically_exposed_person' => :'politically_exposed_person', + :'sanction' => :'sanction', + :'adverse_media' => :'adverse_media', + :'monitored_lists' => :'monitored_lists' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'politically_exposed_person' => :'WatchlistAmlBreakdownPoliticallyExposedPerson', + :'sanction' => :'WatchlistAmlBreakdownSanction', + :'adverse_media' => :'WatchlistAmlBreakdownAdverseMedia', + :'monitored_lists' => :'WatchlistAmlBreakdownLegalAndRegulatoryWarnings' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistEnhancedBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistEnhancedBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'politically_exposed_person') + self.politically_exposed_person = attributes[:'politically_exposed_person'] + end + + if attributes.key?(:'sanction') + self.sanction = attributes[:'sanction'] + end + + if attributes.key?(:'adverse_media') + self.adverse_media = attributes[:'adverse_media'] + end + + if attributes.key?(:'monitored_lists') + self.monitored_lists = attributes[:'monitored_lists'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + politically_exposed_person == o.politically_exposed_person && + sanction == o.sanction && + adverse_media == o.adverse_media && + monitored_lists == o.monitored_lists + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [politically_exposed_person, sanction, adverse_media, monitored_lists].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_enhanced_properties.rb b/lib/onfido/models/watchlist_enhanced_properties.rb new file mode 100644 index 0000000..ff0131a --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties.rb @@ -0,0 +1,217 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedProperties + # Returns any matches including, but not limited to, name and date of birth of match, aliases and associates, and relevant events and sources. + attr_accessor :records + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'records' => :'records' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'records' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistEnhancedProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistEnhancedProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'records') + if (value = attributes[:'records']).is_a?(Array) + self.records = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + records == o.records + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [records].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_enhanced_report.rb b/lib/onfido/models/watchlist_enhanced_report.rb new file mode 100644 index 0000000..1c91152 --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'WatchlistEnhancedBreakdown', + :'properties' => :'WatchlistEnhancedProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistEnhancedReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistEnhancedReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_monitor.rb b/lib/onfido/models/watchlist_monitor.rb new file mode 100644 index 0000000..3a746b4 --- /dev/null +++ b/lib/onfido/models/watchlist_monitor.rb @@ -0,0 +1,327 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistMonitor + # The unique identifier for the monitor. + attr_accessor :id + + # The date and time at which the monitor was created. + attr_accessor :created_at + + # The date and time at which the monitor was deleted. If the monitor is still active, this field will be null. + attr_accessor :deleted_at + + # The ID for the applicant associated with the monitor. + attr_accessor :applicant_id + + # The name of the report type the monitor creates. Can be either \"watchlist_standard\" or \"watchlist_aml\". + attr_accessor :report_name + + # A list of tags associated with this monitor. These tags will be applied to each check this monitor creates. + attr_accessor :tags + + # Indicates whether the object was created in the sandbox or not. + attr_accessor :sandbox + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'deleted_at' => :'deleted_at', + :'applicant_id' => :'applicant_id', + :'report_name' => :'report_name', + :'tags' => :'tags', + :'sandbox' => :'sandbox' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'deleted_at' => :'Time', + :'applicant_id' => :'String', + :'report_name' => :'String', + :'tags' => :'Array', + :'sandbox' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistMonitor` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistMonitor`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'deleted_at') + self.deleted_at = attributes[:'deleted_at'] + end + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'report_name') + self.report_name = attributes[:'report_name'] + else + self.report_name = nil + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'sandbox') + self.sandbox = attributes[:'sandbox'] + else + self.sandbox = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + if @report_name.nil? + invalid_properties.push('invalid value for "report_name", report_name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + return false if @report_name.nil? + report_name_validator = EnumAttributeValidator.new('String', ["watchlist_standard", "watchlist_aml", "unknown_default_open_api"]) + return false unless report_name_validator.valid?(@report_name) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] report_name Object to be assigned + def report_name=(report_name) + validator = EnumAttributeValidator.new('String', ["watchlist_standard", "watchlist_aml", "unknown_default_open_api"]) + unless validator.valid?(report_name) + fail ArgumentError, "invalid value for \"report_name\", must be one of #{validator.allowable_values}." + end + @report_name = report_name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + deleted_at == o.deleted_at && + applicant_id == o.applicant_id && + report_name == o.report_name && + tags == o.tags && + sandbox == o.sandbox + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, deleted_at, applicant_id, report_name, tags, sandbox].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_monitor_match.rb b/lib/onfido/models/watchlist_monitor_match.rb new file mode 100644 index 0000000..2e9f9b9 --- /dev/null +++ b/lib/onfido/models/watchlist_monitor_match.rb @@ -0,0 +1,225 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistMonitorMatch + # Monitor ID + attr_accessor :id + + # Monitor status + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'status' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistMonitorMatch` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistMonitorMatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_peps_only_report.rb b/lib/onfido/models/watchlist_peps_only_report.rb new file mode 100644 index 0000000..d575bcd --- /dev/null +++ b/lib/onfido/models/watchlist_peps_only_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistPepsOnlyReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'WatchlistStandardBreakdown', + :'properties' => :'WatchlistStandardProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistPepsOnlyReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistPepsOnlyReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_sanctions_only_report.rb b/lib/onfido/models/watchlist_sanctions_only_report.rb new file mode 100644 index 0000000..7303e71 --- /dev/null +++ b/lib/onfido/models/watchlist_sanctions_only_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistSanctionsOnlyReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'WatchlistStandardBreakdown', + :'properties' => :'WatchlistStandardProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistSanctionsOnlyReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistSanctionsOnlyReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_standard_breakdown.rb b/lib/onfido/models/watchlist_standard_breakdown.rb new file mode 100644 index 0000000..945b506 --- /dev/null +++ b/lib/onfido/models/watchlist_standard_breakdown.rb @@ -0,0 +1,232 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistStandardBreakdown + attr_accessor :sanction + + attr_accessor :politically_exposed_person + + attr_accessor :legal_and_regulatory_warnings + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sanction' => :'sanction', + :'politically_exposed_person' => :'politically_exposed_person', + :'legal_and_regulatory_warnings' => :'legal_and_regulatory_warnings' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sanction' => :'WatchlistAmlBreakdownSanction', + :'politically_exposed_person' => :'WatchlistAmlBreakdownPoliticallyExposedPerson', + :'legal_and_regulatory_warnings' => :'WatchlistAmlBreakdownLegalAndRegulatoryWarnings' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistStandardBreakdown` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistStandardBreakdown`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sanction') + self.sanction = attributes[:'sanction'] + end + + if attributes.key?(:'politically_exposed_person') + self.politically_exposed_person = attributes[:'politically_exposed_person'] + end + + if attributes.key?(:'legal_and_regulatory_warnings') + self.legal_and_regulatory_warnings = attributes[:'legal_and_regulatory_warnings'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sanction == o.sanction && + politically_exposed_person == o.politically_exposed_person && + legal_and_regulatory_warnings == o.legal_and_regulatory_warnings + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sanction, politically_exposed_person, legal_and_regulatory_warnings].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_standard_properties.rb b/lib/onfido/models/watchlist_standard_properties.rb new file mode 100644 index 0000000..b4c3127 --- /dev/null +++ b/lib/onfido/models/watchlist_standard_properties.rb @@ -0,0 +1,217 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistStandardProperties + # Returns any matches including, but not limited to, name and date of birth of match, aliases and associates, and relevant events and sources. + attr_accessor :records + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'records' => :'records' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'records' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistStandardProperties` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistStandardProperties`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'records') + if (value = attributes[:'records']).is_a?(Array) + self.records = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + records == o.records + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [records].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/watchlist_standard_report.rb b/lib/onfido/models/watchlist_standard_report.rb new file mode 100644 index 0000000..81093c4 --- /dev/null +++ b/lib/onfido/models/watchlist_standard_report.rb @@ -0,0 +1,354 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistStandardReport + # The unique identifier for the report. Read-only. + attr_accessor :id + + # The date and time at which the report was first initiated. Read-only. + attr_accessor :created_at + + # The API endpoint to retrieve the report. Read-only. + attr_accessor :href + + attr_accessor :status + + attr_accessor :result + + attr_accessor :sub_result + + # The ID of the check to which the report belongs. Read-only. + attr_accessor :check_id + + # Array of objects with document ids that were used in the Onfido engine. [ONLY POPULATED FOR DOCUMENT AND FACIAL SIMILARITY REPORTS] + attr_accessor :documents + + attr_accessor :name + + attr_accessor :breakdown + + attr_accessor :properties + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'created_at' => :'created_at', + :'href' => :'href', + :'status' => :'status', + :'result' => :'result', + :'sub_result' => :'sub_result', + :'check_id' => :'check_id', + :'documents' => :'documents', + :'name' => :'name', + :'breakdown' => :'breakdown', + :'properties' => :'properties' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'created_at' => :'Time', + :'href' => :'String', + :'status' => :'ReportStatus', + :'result' => :'ReportResult', + :'sub_result' => :'ReportSubResult', + :'check_id' => :'String', + :'documents' => :'Array', + :'name' => :'ReportName', + :'breakdown' => :'WatchlistStandardBreakdown', + :'properties' => :'WatchlistStandardProperties' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ReportShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistStandardReport` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistStandardReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + + if attributes.key?(:'sub_result') + self.sub_result = attributes[:'sub_result'] + end + + if attributes.key?(:'check_id') + self.check_id = attributes[:'check_id'] + end + + if attributes.key?(:'documents') + if (value = attributes[:'documents']).is_a?(Array) + self.documents = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'breakdown') + self.breakdown = attributes[:'breakdown'] + end + + if attributes.key?(:'properties') + self.properties = attributes[:'properties'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + created_at == o.created_at && + href == o.href && + status == o.status && + result == o.result && + sub_result == o.sub_result && + check_id == o.check_id && + documents == o.documents && + name == o.name && + breakdown == o.breakdown && + properties == o.properties + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, created_at, href, status, result, sub_result, check_id, documents, name, breakdown, properties].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook.rb b/lib/onfido/models/webhook.rb new file mode 100644 index 0000000..08db5bb --- /dev/null +++ b/lib/onfido/models/webhook.rb @@ -0,0 +1,304 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class Webhook + # Determine if the webhook is active. + attr_accessor :enabled + + # The events that will be published to the webhook. If the events parameter is omitted all the events will be subscribed. + attr_accessor :events + + # The environments from which the webhook will receive events. Allowed values are “sandbox” and “live”. If the environments parameter is omitted the webhook will receive events from both environments. + attr_accessor :environments + + # Webhook version used to control the payload object when sending webhooks. + attr_accessor :payload_version + + # The unique identifier of the webhook. + attr_accessor :id + + # The url that will listen to notifications (must be https). + attr_accessor :url + + # Webhook secret token used to sign the webhook's payload. + attr_accessor :token + + # The API endpoint to retrieve the webhook. + attr_accessor :href + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'events' => :'events', + :'environments' => :'environments', + :'payload_version' => :'payload_version', + :'id' => :'id', + :'url' => :'url', + :'token' => :'token', + :'href' => :'href' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'events' => :'Array', + :'environments' => :'Array', + :'payload_version' => :'Integer', + :'id' => :'String', + :'url' => :'String', + :'token' => :'String', + :'href' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'WebhookResponse', + :'WebhookShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::Webhook` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::Webhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + + if attributes.key?(:'environments') + if (value = attributes[:'environments']).is_a?(Array) + self.environments = value + end + end + + if attributes.key?(:'payload_version') + self.payload_version = attributes[:'payload_version'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'token') + self.token = attributes[:'token'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + events == o.events && + environments == o.environments && + payload_version == o.payload_version && + id == o.id && + url == o.url && + token == o.token && + href == o.href + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, events, environments, payload_version, id, url, token, href].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_builder.rb b/lib/onfido/models/webhook_builder.rb new file mode 100644 index 0000000..0ab525b --- /dev/null +++ b/lib/onfido/models/webhook_builder.rb @@ -0,0 +1,274 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookBuilder + # Determine if the webhook is active. + attr_accessor :enabled + + # The events that will be published to the webhook. If the events parameter is omitted all the events will be subscribed. + attr_accessor :events + + # The environments from which the webhook will receive events. Allowed values are “sandbox” and “live”. If the environments parameter is omitted the webhook will receive events from both environments. + attr_accessor :environments + + # Webhook version used to control the payload object when sending webhooks. + attr_accessor :payload_version + + # The url that will listen to notifications (must be https). + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'events' => :'events', + :'environments' => :'environments', + :'payload_version' => :'payload_version', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'events' => :'Array', + :'environments' => :'Array', + :'payload_version' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'WebhookCreate', + :'WebhookShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + + if attributes.key?(:'environments') + if (value = attributes[:'environments']).is_a?(Array) + self.environments = value + end + end + + if attributes.key?(:'payload_version') + self.payload_version = attributes[:'payload_version'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @url.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + events == o.events && + environments == o.environments && + payload_version == o.payload_version && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, events, environments, payload_version, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_create.rb b/lib/onfido/models/webhook_create.rb new file mode 100644 index 0000000..3483bcd --- /dev/null +++ b/lib/onfido/models/webhook_create.rb @@ -0,0 +1,222 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookCreate + # The url that will listen to notifications (must be https). + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookCreate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @url.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_event.rb b/lib/onfido/models/webhook_event.rb new file mode 100644 index 0000000..09f9805 --- /dev/null +++ b/lib/onfido/models/webhook_event.rb @@ -0,0 +1,214 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookEvent + attr_accessor :payload + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payload' => :'payload' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'payload' => :'WebhookEventPayload' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'payload') + self.payload = attributes[:'payload'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payload == o.payload + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [payload].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_event_payload.rb b/lib/onfido/models/webhook_event_payload.rb new file mode 100644 index 0000000..255b6df --- /dev/null +++ b/lib/onfido/models/webhook_event_payload.rb @@ -0,0 +1,273 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookEventPayload + # Indicates the resource affected by this event. + attr_accessor :resource_type + + # The event that triggered this webhook. + attr_accessor :action + + attr_accessor :object + + # The resource affected by this event. + attr_accessor :resource + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'resource_type' => :'resource_type', + :'action' => :'action', + :'object' => :'object', + :'resource' => :'resource' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'resource_type' => :'String', + :'action' => :'WebhookEventType', + :'object' => :'WebhookEventPayloadObject', + :'resource' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookEventPayload` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookEventPayload`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'resource_type') + self.resource_type = attributes[:'resource_type'] + else + self.resource_type = nil + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'resource') + self.resource = attributes[:'resource'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @resource_type.nil? + invalid_properties.push('invalid value for "resource_type", resource_type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @resource_type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + resource_type == o.resource_type && + action == o.action && + object == o.object && + resource == o.resource + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [resource_type, action, object, resource].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_event_payload_object.rb b/lib/onfido/models/webhook_event_payload_object.rb new file mode 100644 index 0000000..0dc4696 --- /dev/null +++ b/lib/onfido/models/webhook_event_payload_object.rb @@ -0,0 +1,260 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # The object affected by this event. + class WebhookEventPayloadObject + # The unique identifier of the resource. + attr_accessor :id + + # The current state of the object, if available. + attr_accessor :status + + # The date and time when the operation was completed, if available. + attr_accessor :completed_at_iso8601 + + # The uri of the resource. + attr_accessor :href + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'status' => :'status', + :'completed_at_iso8601' => :'completed_at_iso8601', + :'href' => :'href' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'status' => :'String', + :'completed_at_iso8601' => :'Time', + :'href' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookEventPayloadObject` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookEventPayloadObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'completed_at_iso8601') + self.completed_at_iso8601 = attributes[:'completed_at_iso8601'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + else + self.href = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @href.nil? + invalid_properties.push('invalid value for "href", href cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @href.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + status == o.status && + completed_at_iso8601 == o.completed_at_iso8601 && + href == o.href + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, status, completed_at_iso8601, href].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_event_type.rb b/lib/onfido/models/webhook_event_type.rb new file mode 100644 index 0000000..634353f --- /dev/null +++ b/lib/onfido/models/webhook_event_type.rb @@ -0,0 +1,56 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookEventType + AUDIT_LOG_CREATED = "audit_log.created".freeze + WATCHLIST_MONITOR_MATCHES_UPDATED = "watchlist_monitor.matches_updated".freeze + WORKFLOW_RUN_COMPLETED = "workflow_run.completed".freeze + WORKFLOW_TASK_STARTED = "workflow_task.started".freeze + WORKFLOW_TASK_COMPLETED = "workflow_task.completed".freeze + CHECK_STARTED = "check.started".freeze + CHECK_REOPENED = "check.reopened".freeze + CHECK_WITHDRAWN = "check.withdrawn".freeze + CHECK_COMPLETED = "check.completed".freeze + CHECK_FORM_COMPLETED = "check.form_completed".freeze + REPORT_WITHDRAWN = "report.withdrawn".freeze + REPORT_RESUMED = "report.resumed".freeze + REPORT_CANCELLED = "report.cancelled".freeze + REPORT_AWAITING_APPROVAL = "report.awaiting_approval".freeze + REPORT_COMPLETED = "report.completed".freeze + WORKFLOW_TIMELINE_FILE_CREATED = "workflow_timeline_file.created".freeze + WORKFLOW_SIGNED_EVIDENCE_FILE_CREATED = "workflow_signed_evidence_file.created".freeze + UNKNOWN_DEFAULT_OPEN_API = "unknown_default_open_api".freeze + + def self.all_vars + @all_vars ||= [AUDIT_LOG_CREATED, WATCHLIST_MONITOR_MATCHES_UPDATED, WORKFLOW_RUN_COMPLETED, WORKFLOW_TASK_STARTED, WORKFLOW_TASK_COMPLETED, CHECK_STARTED, CHECK_REOPENED, CHECK_WITHDRAWN, CHECK_COMPLETED, CHECK_FORM_COMPLETED, REPORT_WITHDRAWN, REPORT_RESUMED, REPORT_CANCELLED, REPORT_AWAITING_APPROVAL, REPORT_COMPLETED, WORKFLOW_TIMELINE_FILE_CREATED, WORKFLOW_SIGNED_EVIDENCE_FILE_CREATED, UNKNOWN_DEFAULT_OPEN_API].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if WebhookEventType.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #WebhookEventType" + end + end +end diff --git a/lib/onfido/models/webhook_resend.rb b/lib/onfido/models/webhook_resend.rb new file mode 100644 index 0000000..0be5aa2 --- /dev/null +++ b/lib/onfido/models/webhook_resend.rb @@ -0,0 +1,216 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookResend + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookResend` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookResend`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_response.rb b/lib/onfido/models/webhook_response.rb new file mode 100644 index 0000000..6525a42 --- /dev/null +++ b/lib/onfido/models/webhook_response.rb @@ -0,0 +1,252 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookResponse + # The unique identifier of the webhook. + attr_accessor :id + + # The url that will listen to notifications (must be https). + attr_accessor :url + + # Webhook secret token used to sign the webhook's payload. + attr_accessor :token + + # The API endpoint to retrieve the webhook. + attr_accessor :href + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'url' => :'url', + :'token' => :'token', + :'href' => :'href' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'url' => :'String', + :'token' => :'String', + :'href' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'token') + self.token = attributes[:'token'] + end + + if attributes.key?(:'href') + self.href = attributes[:'href'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + url == o.url && + token == o.token && + href == o.href + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, url, token, href].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_shared.rb b/lib/onfido/models/webhook_shared.rb new file mode 100644 index 0000000..45bb091 --- /dev/null +++ b/lib/onfido/models/webhook_shared.rb @@ -0,0 +1,249 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookShared + # Determine if the webhook is active. + attr_accessor :enabled + + # The events that will be published to the webhook. If the events parameter is omitted all the events will be subscribed. + attr_accessor :events + + # The environments from which the webhook will receive events. Allowed values are “sandbox” and “live”. If the environments parameter is omitted the webhook will receive events from both environments. + attr_accessor :environments + + # Webhook version used to control the payload object when sending webhooks. + attr_accessor :payload_version + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'events' => :'events', + :'environments' => :'environments', + :'payload_version' => :'payload_version' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'events' => :'Array', + :'environments' => :'Array', + :'payload_version' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + + if attributes.key?(:'environments') + if (value = attributes[:'environments']).is_a?(Array) + self.environments = value + end + end + + if attributes.key?(:'payload_version') + self.payload_version = attributes[:'payload_version'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + events == o.events && + environments == o.environments && + payload_version == o.payload_version + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, events, environments, payload_version].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_update.rb b/lib/onfido/models/webhook_update.rb new file mode 100644 index 0000000..8274e20 --- /dev/null +++ b/lib/onfido/models/webhook_update.rb @@ -0,0 +1,215 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookUpdate + # The url that will listen to notifications (must be https). + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookUpdate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhook_updater.rb b/lib/onfido/models/webhook_updater.rb new file mode 100644 index 0000000..a01f041 --- /dev/null +++ b/lib/onfido/models/webhook_updater.rb @@ -0,0 +1,267 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhookUpdater + # Determine if the webhook is active. + attr_accessor :enabled + + # The events that will be published to the webhook. If the events parameter is omitted all the events will be subscribed. + attr_accessor :events + + # The environments from which the webhook will receive events. Allowed values are “sandbox” and “live”. If the environments parameter is omitted the webhook will receive events from both environments. + attr_accessor :environments + + # Webhook version used to control the payload object when sending webhooks. + attr_accessor :payload_version + + # The url that will listen to notifications (must be https). + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'events' => :'events', + :'environments' => :'environments', + :'payload_version' => :'payload_version', + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'events' => :'Array', + :'environments' => :'Array', + :'payload_version' => :'Integer', + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'WebhookShared', + :'WebhookUpdate' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhookUpdater` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhookUpdater`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + + if attributes.key?(:'environments') + if (value = attributes[:'environments']).is_a?(Array) + self.environments = value + end + end + + if attributes.key?(:'payload_version') + self.payload_version = attributes[:'payload_version'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + events == o.events && + environments == o.environments && + payload_version == o.payload_version && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, events, environments, payload_version, url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhooks_list.rb b/lib/onfido/models/webhooks_list.rb new file mode 100644 index 0000000..23c60ad --- /dev/null +++ b/lib/onfido/models/webhooks_list.rb @@ -0,0 +1,223 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhooksList + attr_accessor :webhooks + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'webhooks' => :'webhooks' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'webhooks' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhooksList` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhooksList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'webhooks') + if (value = attributes[:'webhooks']).is_a?(Array) + self.webhooks = value + end + else + self.webhooks = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @webhooks.nil? + invalid_properties.push('invalid value for "webhooks", webhooks cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @webhooks.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + webhooks == o.webhooks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [webhooks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/webhooks_resend_item.rb b/lib/onfido/models/webhooks_resend_item.rb new file mode 100644 index 0000000..c5383ac --- /dev/null +++ b/lib/onfido/models/webhooks_resend_item.rb @@ -0,0 +1,261 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WebhooksResendItem + # ID of the resource whose webhooks are to be retriggered. + attr_accessor :resource_id + + # The events that should retrigger webhooks. Accepts values check.completed. + attr_accessor :event + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'resource_id' => :'resource_id', + :'event' => :'event' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'resource_id' => :'String', + :'event' => :'WebhookEventType' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WebhooksResendItem` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WebhooksResendItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'resource_id') + self.resource_id = attributes[:'resource_id'] + else + self.resource_id = nil + end + + if attributes.key?(:'event') + self.event = attributes[:'event'] + else + self.event = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @resource_id.nil? + invalid_properties.push('invalid value for "resource_id", resource_id cannot be nil.') + end + + if @event.nil? + invalid_properties.push('invalid value for "event", event cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @resource_id.nil? + return false if @event.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + resource_id == o.resource_id && + event == o.event + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [resource_id, event].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/workflow_run.rb b/lib/onfido/models/workflow_run.rb new file mode 100644 index 0000000..a885efe --- /dev/null +++ b/lib/onfido/models/workflow_run.rb @@ -0,0 +1,416 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WorkflowRun + # The unique identifier for the Applicant. + attr_accessor :applicant_id + + # The unique identifier for the Workflow. + attr_accessor :workflow_id + + # Tags or labels assigned to the workflow run. + attr_accessor :tags + + attr_accessor :link + + # The date and time when the Workflow Run was created. + attr_accessor :created_at + + # The date and time when the Workflow Run was last updated. + attr_accessor :updated_at + + # The unique identifier for the Workflow Run. + attr_accessor :id + + # The identifier for the Workflow version. + attr_accessor :workflow_version_id + + # The URL for viewing the Workflow Run results on your Onfido Dashboard. + attr_accessor :dashboard_url + + # The status of the Workflow Run. + attr_accessor :status + + # Output object contains all of the properties configured on the Workflow version. + attr_accessor :output + + # The reasons the Workflow Run outcome was reached. Configurable when creating the Workflow version. + attr_accessor :reasons + + attr_accessor :error + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'applicant_id' => :'applicant_id', + :'workflow_id' => :'workflow_id', + :'tags' => :'tags', + :'link' => :'link', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'id' => :'id', + :'workflow_version_id' => :'workflow_version_id', + :'dashboard_url' => :'dashboard_url', + :'status' => :'status', + :'output' => :'output', + :'reasons' => :'reasons', + :'error' => :'error' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'applicant_id' => :'String', + :'workflow_id' => :'String', + :'tags' => :'Array', + :'link' => :'WorkflowRunSharedLink', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'id' => :'String', + :'workflow_version_id' => :'Integer', + :'dashboard_url' => :'String', + :'status' => :'String', + :'output' => :'Object', + :'reasons' => :'Array', + :'error' => :'WorkflowRunResponseError' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'tags', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'WorkflowRunResponse', + :'WorkflowRunShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WorkflowRun` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WorkflowRun`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'workflow_id') + self.workflow_id = attributes[:'workflow_id'] + else + self.workflow_id = nil + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'workflow_version_id') + self.workflow_version_id = attributes[:'workflow_version_id'] + end + + if attributes.key?(:'dashboard_url') + self.dashboard_url = attributes[:'dashboard_url'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'output') + self.output = attributes[:'output'] + end + + if attributes.key?(:'reasons') + if (value = attributes[:'reasons']).is_a?(Array) + self.reasons = value + end + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + if @workflow_id.nil? + invalid_properties.push('invalid value for "workflow_id", workflow_id cannot be nil.') + end + + if !@tags.nil? && @tags.length > 30 + invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 30.') + end + + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + return false if @workflow_id.nil? + return false if !@tags.nil? && @tags.length > 30 + return false if @id.nil? + status_validator = EnumAttributeValidator.new('String', ["awaiting_input", "processing", "abandoned", "error", "approved", "review", "declined", "unknown_default_open_api"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method with validation + # @param [Object] tags Value to be assigned + def tags=(tags) + if !tags.nil? && tags.length > 30 + fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 30.' + end + + @tags = tags + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["awaiting_input", "processing", "abandoned", "error", "approved", "review", "declined", "unknown_default_open_api"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + applicant_id == o.applicant_id && + workflow_id == o.workflow_id && + tags == o.tags && + link == o.link && + created_at == o.created_at && + updated_at == o.updated_at && + id == o.id && + workflow_version_id == o.workflow_version_id && + dashboard_url == o.dashboard_url && + status == o.status && + output == o.output && + reasons == o.reasons && + error == o.error + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [applicant_id, workflow_id, tags, link, created_at, updated_at, id, workflow_version_id, dashboard_url, status, output, reasons, error].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/workflow_run_builder.rb b/lib/onfido/models/workflow_run_builder.rb new file mode 100644 index 0000000..4b72334 --- /dev/null +++ b/lib/onfido/models/workflow_run_builder.rb @@ -0,0 +1,316 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WorkflowRunBuilder + # The unique identifier for the Applicant. + attr_accessor :applicant_id + + # The unique identifier for the Workflow. + attr_accessor :workflow_id + + # Tags or labels assigned to the workflow run. + attr_accessor :tags + + attr_accessor :link + + # The date and time when the Workflow Run was created. + attr_accessor :created_at + + # The date and time when the Workflow Run was last updated. + attr_accessor :updated_at + + # Object with Custom Input Data to be used in the Workflow Run. + attr_accessor :custom_data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'applicant_id' => :'applicant_id', + :'workflow_id' => :'workflow_id', + :'tags' => :'tags', + :'link' => :'link', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'custom_data' => :'custom_data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'applicant_id' => :'String', + :'workflow_id' => :'String', + :'tags' => :'Array', + :'link' => :'WorkflowRunSharedLink', + :'created_at' => :'Time', + :'updated_at' => :'Time', + :'custom_data' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'tags', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'WorkflowRunRequest', + :'WorkflowRunShared' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WorkflowRunBuilder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WorkflowRunBuilder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'workflow_id') + self.workflow_id = attributes[:'workflow_id'] + else + self.workflow_id = nil + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'custom_data') + if (value = attributes[:'custom_data']).is_a?(Hash) + self.custom_data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + if @workflow_id.nil? + invalid_properties.push('invalid value for "workflow_id", workflow_id cannot be nil.') + end + + if !@tags.nil? && @tags.length > 30 + invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 30.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + return false if @workflow_id.nil? + return false if !@tags.nil? && @tags.length > 30 + true + end + + # Custom attribute writer method with validation + # @param [Object] tags Value to be assigned + def tags=(tags) + if !tags.nil? && tags.length > 30 + fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 30.' + end + + @tags = tags + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + applicant_id == o.applicant_id && + workflow_id == o.workflow_id && + tags == o.tags && + link == o.link && + created_at == o.created_at && + updated_at == o.updated_at && + custom_data == o.custom_data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [applicant_id, workflow_id, tags, link, created_at, updated_at, custom_data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/workflow_run_request.rb b/lib/onfido/models/workflow_run_request.rb new file mode 100644 index 0000000..6f81041 --- /dev/null +++ b/lib/onfido/models/workflow_run_request.rb @@ -0,0 +1,217 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WorkflowRunRequest + # Object with Custom Input Data to be used in the Workflow Run. + attr_accessor :custom_data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'custom_data' => :'custom_data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'custom_data' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WorkflowRunRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WorkflowRunRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'custom_data') + if (value = attributes[:'custom_data']).is_a?(Hash) + self.custom_data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + custom_data == o.custom_data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [custom_data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/workflow_run_response.rb b/lib/onfido/models/workflow_run_response.rb new file mode 100644 index 0000000..bdbd4b6 --- /dev/null +++ b/lib/onfido/models/workflow_run_response.rb @@ -0,0 +1,317 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WorkflowRunResponse + # The unique identifier for the Workflow Run. + attr_accessor :id + + # The identifier for the Workflow version. + attr_accessor :workflow_version_id + + # The URL for viewing the Workflow Run results on your Onfido Dashboard. + attr_accessor :dashboard_url + + # The status of the Workflow Run. + attr_accessor :status + + # Output object contains all of the properties configured on the Workflow version. + attr_accessor :output + + # The reasons the Workflow Run outcome was reached. Configurable when creating the Workflow version. + attr_accessor :reasons + + attr_accessor :error + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'workflow_version_id' => :'workflow_version_id', + :'dashboard_url' => :'dashboard_url', + :'status' => :'status', + :'output' => :'output', + :'reasons' => :'reasons', + :'error' => :'error' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'workflow_version_id' => :'Integer', + :'dashboard_url' => :'String', + :'status' => :'String', + :'output' => :'Object', + :'reasons' => :'Array', + :'error' => :'WorkflowRunResponseError' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WorkflowRunResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WorkflowRunResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'workflow_version_id') + self.workflow_version_id = attributes[:'workflow_version_id'] + end + + if attributes.key?(:'dashboard_url') + self.dashboard_url = attributes[:'dashboard_url'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'output') + self.output = attributes[:'output'] + end + + if attributes.key?(:'reasons') + if (value = attributes[:'reasons']).is_a?(Array) + self.reasons = value + end + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + status_validator = EnumAttributeValidator.new('String', ["awaiting_input", "processing", "abandoned", "error", "approved", "review", "declined", "unknown_default_open_api"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["awaiting_input", "processing", "abandoned", "error", "approved", "review", "declined", "unknown_default_open_api"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + workflow_version_id == o.workflow_version_id && + dashboard_url == o.dashboard_url && + status == o.status && + output == o.output && + reasons == o.reasons && + error == o.error + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, workflow_version_id, dashboard_url, status, output, reasons, error].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/workflow_run_response_error.rb b/lib/onfido/models/workflow_run_response_error.rb new file mode 100644 index 0000000..1bf3564 --- /dev/null +++ b/lib/onfido/models/workflow_run_response_error.rb @@ -0,0 +1,226 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Error object. Only set when the Workflow Run status is 'error'. + class WorkflowRunResponseError + # The type of error. + attr_accessor :type + + # A textual description of the error. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WorkflowRunResponseError` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WorkflowRunResponseError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/workflow_run_shared.rb b/lib/onfido/models/workflow_run_shared.rb new file mode 100644 index 0000000..4621ddb --- /dev/null +++ b/lib/onfido/models/workflow_run_shared.rb @@ -0,0 +1,296 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WorkflowRunShared + # The unique identifier for the Applicant. + attr_accessor :applicant_id + + # The unique identifier for the Workflow. + attr_accessor :workflow_id + + # Tags or labels assigned to the workflow run. + attr_accessor :tags + + attr_accessor :link + + # The date and time when the Workflow Run was created. + attr_accessor :created_at + + # The date and time when the Workflow Run was last updated. + attr_accessor :updated_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'applicant_id' => :'applicant_id', + :'workflow_id' => :'workflow_id', + :'tags' => :'tags', + :'link' => :'link', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'applicant_id' => :'String', + :'workflow_id' => :'String', + :'tags' => :'Array', + :'link' => :'WorkflowRunSharedLink', + :'created_at' => :'Time', + :'updated_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'tags', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WorkflowRunShared` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WorkflowRunShared`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'applicant_id') + self.applicant_id = attributes[:'applicant_id'] + else + self.applicant_id = nil + end + + if attributes.key?(:'workflow_id') + self.workflow_id = attributes[:'workflow_id'] + else + self.workflow_id = nil + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @applicant_id.nil? + invalid_properties.push('invalid value for "applicant_id", applicant_id cannot be nil.') + end + + if @workflow_id.nil? + invalid_properties.push('invalid value for "workflow_id", workflow_id cannot be nil.') + end + + if !@tags.nil? && @tags.length > 30 + invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 30.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @applicant_id.nil? + return false if @workflow_id.nil? + return false if !@tags.nil? && @tags.length > 30 + true + end + + # Custom attribute writer method with validation + # @param [Object] tags Value to be assigned + def tags=(tags) + if !tags.nil? && tags.length > 30 + fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 30.' + end + + @tags = tags + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + applicant_id == o.applicant_id && + workflow_id == o.workflow_id && + tags == o.tags && + link == o.link && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [applicant_id, workflow_id, tags, link, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/models/workflow_run_shared_link.rb b/lib/onfido/models/workflow_run_shared_link.rb new file mode 100644 index 0000000..b745c94 --- /dev/null +++ b/lib/onfido/models/workflow_run_shared_link.rb @@ -0,0 +1,290 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Onfido + # Object for the configuration of the Workflow Run link. + class WorkflowRunSharedLink + # Link to access the Workflow Run without the need to integrate with Onfido's SDKs. + attr_accessor :url + + # When the interactive section of the Workflow Run has completed successfully, the user will be redirected to this URL instead of seeing the default Onfido 'thank you' page. + attr_accessor :completed_redirect_url + + # When the link has expired, the user will be immediately redirected to this URL instead of seeing the default Onfido error message. + attr_accessor :expired_redirect_url + + # Date and time when the link will expire. + attr_accessor :expires_at + + # The code for the language when the workflow run is acessed using the link. + attr_accessor :language + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'completed_redirect_url' => :'completed_redirect_url', + :'expired_redirect_url' => :'expired_redirect_url', + :'expires_at' => :'expires_at', + :'language' => :'language' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'completed_redirect_url' => :'String', + :'expired_redirect_url' => :'String', + :'expires_at' => :'Time', + :'language' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WorkflowRunSharedLink` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WorkflowRunSharedLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'completed_redirect_url') + self.completed_redirect_url = attributes[:'completed_redirect_url'] + end + + if attributes.key?(:'expired_redirect_url') + self.expired_redirect_url = attributes[:'expired_redirect_url'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + + if attributes.key?(:'language') + self.language = attributes[:'language'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + language_validator = EnumAttributeValidator.new('String', ["en_US", "de_DE", "es_ES", "fr_FR", "it_IT", "pt_PT", "nl_NL", "unknown_default_open_api"]) + return false unless language_validator.valid?(@language) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] language Object to be assigned + def language=(language) + validator = EnumAttributeValidator.new('String', ["en_US", "de_DE", "es_ES", "fr_FR", "it_IT", "pt_PT", "nl_NL", "unknown_default_open_api"]) + unless validator.valid?(language) + fail ArgumentError, "invalid value for \"language\", must be one of #{validator.allowable_values}." + end + @language = language + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + completed_redirect_url == o.completed_redirect_url && + expired_redirect_url == o.expired_redirect_url && + expires_at == o.expires_at && + language == o.language + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, completed_redirect_url, expired_redirect_url, expires_at, language].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Onfido.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onfido/options.rb b/lib/onfido/options.rb deleted file mode 100644 index de128ac..0000000 --- a/lib/onfido/options.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Options - REGIONS = %w[eu us ca].freeze - - def initialize(api_key:, region:, open_timeout: 10, read_timeout: 30, unknown_api_url: nil) - @api_key = api_key - @region = region.to_s.downcase - @open_timeout = open_timeout - @read_timeout = read_timeout - @unknown_api_url = unknown_api_url - - raise "Unknown region #{@region}" unless REGIONS.include?(@region) - end - - def rest_client - @rest_client ||= RestClient::Resource.new( - base_url, - read_timeout: read_timeout, - open_timeout: open_timeout, - headers: { - 'Authorization' => "Token token=#{api_key}", - 'Accept' => 'application/json', - 'User-Agent' => "onfido-ruby/#{Onfido::VERSION}" - } - ) - end - - private - - attr_reader :api_key, :open_timeout, :read_timeout - - def base_url - @unknown_api_url || "https://api.#{@region}.onfido.com/v3.6/" - end - end -end diff --git a/lib/onfido/resource.rb b/lib/onfido/resource.rb deleted file mode 100644 index b1460e9..0000000 --- a/lib/onfido/resource.rb +++ /dev/null @@ -1,153 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Resource # rubocop:todo Metrics/ClassLength - VALID_HTTP_METHODS = %i[get post put delete].freeze - REQUEST_TIMEOUT_HTTP_CODE = 408 - ADDITIONAL_HEADERS = { 'Content-Type' => 'application/json; charset=utf-8' }.freeze - - def initialize(options) - @rest_client = options.rest_client - end - - private - - attr_reader :rest_client - - def get(path:) - handle_request { rest_client[path].get(ADDITIONAL_HEADERS) } - end - - def post(path:, payload: nil, send_json: true) - parsed_payload = send_json ? payload.to_json : payload - additional_headers = send_json ? ADDITIONAL_HEADERS : {} - - handle_request { rest_client[path].post(parsed_payload, additional_headers) } - end - - def put(path:, payload: nil) - handle_request { rest_client[path].put(payload.to_json, ADDITIONAL_HEADERS) } - end - - def patch(path:, payload: nil) - handle_request { rest_client[path].patch(payload.to_json, ADDITIONAL_HEADERS) } - end - - def delete(path:) - handle_request { rest_client[path].delete(ADDITIONAL_HEADERS) } - end - - def handle_request - response = yield - - # response should be parsed only when there is a response expected - parse(response) unless response.code == 204 # no_content - rescue RestClient::ExceptionWithResponse => e - if e.response && !timeout_response?(e.response) - handle_api_error(e.response) - else - handle_restclient_error(e) - end - rescue RestClient::Exception, Errno::ECONNREFUSED => e - handle_restclient_error(e) - end - - def parse(response) - content_type = response.headers[:content_type] - if content_type&.include?('application/json') - JSON.parse(response.body.to_s) - else - response.body - end - rescue JSON::ParserError - general_api_error(response.code, response.body) - end - - def timeout_response?(response) - response.code.to_i == REQUEST_TIMEOUT_HTTP_CODE - end - - # There seems to be a serialization issue with the HTTP client - # which does not serialize the payload properly. - # Have a look here https://gist.github.com/PericlesTheo/cb35139c57107ab3c84a - - def build_query(payload) - if payload[:file] - payload - else - Rack::Utils.build_nested_query(payload) - end - end - - def handle_api_error(response) - parsed_response = parse(response) - - general_api_error(response.code, response.body) unless parsed_response['error'] - - error_class = response.code.to_i >= 500 ? ServerError : RequestError - - raise error_class.new( - parsed_response['error']['message'], - response_code: response.code, - response_body: response.body - ) - end - - def general_api_error(response_code, response_body) - error_class = response_code.to_i >= 500 ? ServerError : RequestError - - raise error_class.new( - "Invalid response object from API: #{response_body} " \ - "(HTTP response code was #{response_code})", - response_code: response_code, - response_body: response_body - ) - end - - def handle_restclient_error(error) # rubocop:todo Metrics/MethodLength - connection_message = - 'Please check your internet connection and try again. ' \ - 'If this problem persists, you should let us know at info@onfido.com.' - - message = - case error - when RestClient::RequestTimeout - "Could not connect to Onfido . #{connection_message}" - - when RestClient::ServerBrokeConnection - "The connection to the server broke before the request completed. #{connection_message}" - - when RestClient::SSLCertificateNotVerified - "Could not verify Onfido's SSL certificate. Please make sure " \ - 'that your network is not intercepting certificates. ' - - when RestClient::BadGateway - "Could not connect to Onfido. Server may be overloaded." \ - - when SocketError - 'Unexpected error when trying to connect to Onfido. ' \ - 'You may be seeing this message because your DNS is not working. ' \ - "To check, try running 'host onfido.com' from the command line." - - else - 'Unexpected error communicating with Onfido. ' \ - 'If this problem persists, let us know at info@onfido.com.' - end - - full_message = message + "\n\n(Network error: #{error.message})" - - raise ConnectionError, full_message - end - - def validate_file!(file) - return if file.respond_to?(:read) && file.respond_to?(:path) - - raise ArgumentError, 'File must be a `File`-like object which responds to ' \ - '`#read` and `#path`' - end - - def stringify_query_params(hashed_params) - URI.encode_www_form_component(hashed_params.map{ |k,v| "#{k}=#{v}" }.join("&")) - end - end -end diff --git a/lib/onfido/resources/address.rb b/lib/onfido/resources/address.rb deleted file mode 100644 index 6efc608..0000000 --- a/lib/onfido/resources/address.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Address < Resource - def all(postcode) - get(path: "addresses/pick?postcode=#{postcode.delete(' ')}") - end - end -end diff --git a/lib/onfido/resources/applicant.rb b/lib/onfido/resources/applicant.rb deleted file mode 100644 index 836f1ac..0000000 --- a/lib/onfido/resources/applicant.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Applicant < Resource - def create(payload) - post(path: 'applicants', payload: payload) - end - - def update(applicant_id, payload) - put(path: "applicants/#{applicant_id}", payload: payload) - end - - def destroy(applicant_id) - delete(path: "applicants/#{applicant_id}") - end - - def find(applicant_id) - get(path: "applicants/#{applicant_id}") - end - - def all(page: 1, per_page: 20) - get(path: "applicants?page=#{page}&per_page=#{per_page}") - end - - def restore(applicant_id) - post(path: "applicants/#{applicant_id}/restore") - end - end -end diff --git a/lib/onfido/resources/check.rb b/lib/onfido/resources/check.rb deleted file mode 100644 index 32d2f3a..0000000 --- a/lib/onfido/resources/check.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Check < Resource - def create(applicant_id:, report_names:, **payload) - payload[:applicant_id] = applicant_id - payload[:report_names] = report_names - - post(path: 'checks', payload: payload) - end - - def find(check_id) - get(path: "checks/#{check_id}") - end - - def all(applicant_id) - get(path: "checks?applicant_id=#{applicant_id}") - end - - def resume(check_id) - post(path: "checks/#{check_id}/resume") - end - - def download(check_id) - get(path: "checks/#{check_id}/download") - end - end -end diff --git a/lib/onfido/resources/document.rb b/lib/onfido/resources/document.rb deleted file mode 100644 index cc8b899..0000000 --- a/lib/onfido/resources/document.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Document < Resource - # with open-uri the file can be a link or an actual file - - def create(applicant_id:, file:, type:, **payload) - validate_file!(file) - payload[:applicant_id] = applicant_id - payload[:file] = file - payload[:type] = type - - post(path: 'documents', payload: payload, send_json: false) - end - - def find(document_id) - get(path: "documents/#{document_id}") - end - - def download(document_id) - get(path: "documents/#{document_id}/download") - end - - def all(applicant_id) - get(path: "documents?applicant_id=#{applicant_id}") - end - end -end diff --git a/lib/onfido/resources/extraction.rb b/lib/onfido/resources/extraction.rb deleted file mode 100644 index 6dde24a..0000000 --- a/lib/onfido/resources/extraction.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Extraction < Resource - def create(document_id:) - payload = { document_id: document_id } - - post(path: 'extractions', payload: payload) - end - end -end diff --git a/lib/onfido/resources/live_photo.rb b/lib/onfido/resources/live_photo.rb deleted file mode 100644 index 2b7de3c..0000000 --- a/lib/onfido/resources/live_photo.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class LivePhoto < Resource - # with open-uri the file can be a link or an actual file - - def create(applicant_id:, file:, **payload) - validate_file!(file) - payload[:applicant_id] = applicant_id - payload[:file] = file - - post(path: 'live_photos', payload: payload, send_json: false) - end - - def find(live_photo_id) - get(path: "live_photos/#{live_photo_id}") - end - - def download(live_photo_id) - get(path: "live_photos/#{live_photo_id}/download") - end - - def all(applicant_id) - get(path: "live_photos?applicant_id=#{applicant_id}") - end - end -end diff --git a/lib/onfido/resources/live_video.rb b/lib/onfido/resources/live_video.rb deleted file mode 100644 index 093fc1c..0000000 --- a/lib/onfido/resources/live_video.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class LiveVideo < Resource - def find(live_video_id) - get(path: "live_videos/#{live_video_id}") - end - - def download(live_video_id) - get(path: "live_videos/#{live_video_id}/download") - end - - def all(applicant_id) - get(path: "live_videos?applicant_id=#{applicant_id}") - end - end -end diff --git a/lib/onfido/resources/monitor.rb b/lib/onfido/resources/monitor.rb deleted file mode 100644 index 64903ed..0000000 --- a/lib/onfido/resources/monitor.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Monitor < Resource - def create(applicant_id:, report_name:, **payload) - payload[:applicant_id] = applicant_id - payload[:report_name] = report_name - - post(path: 'watchlist_monitors', payload: payload) - end - - def find(monitor_id) - get(path: "watchlist_monitors/#{monitor_id}") - end - - def all(applicant_id) - get(path: "watchlist_monitors?applicant_id=#{applicant_id}") - end - - def destroy(monitor_id) - delete(path: "watchlist_monitors/#{monitor_id}") - end - - def list_matches(monitor_id) - get(path: "watchlist_monitors/#{monitor_id}/matches") - end - - def set_match_status(monitor_id, **payload) - patch(path: "watchlist_monitors/#{monitor_id}/matches", payload: payload) - end - end -end diff --git a/lib/onfido/resources/motion_capture.rb b/lib/onfido/resources/motion_capture.rb deleted file mode 100644 index bd6f45f..0000000 --- a/lib/onfido/resources/motion_capture.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class MotionCapture < Resource - def find(motion_capture_id) - get(path: "motion_captures/#{motion_capture_id}") - end - - def download(motion_capture_id) - get(path: "motion_captures/#{motion_capture_id}/download") - end - - def frame(motion_capture_id) - get(path: "motion_captures/#{motion_capture_id}/frame") - end - - def all(applicant_id) - get(path: "motion_captures?applicant_id=#{applicant_id}") - end - end -end diff --git a/lib/onfido/resources/report.rb b/lib/onfido/resources/report.rb deleted file mode 100644 index b909dde..0000000 --- a/lib/onfido/resources/report.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Report < Resource - def find(report_id) - get(path: "reports/#{report_id}") - end - - def all(check_id) - get(path: "reports?check_id=#{check_id}") - end - - def resume(report_id) - post(path: "reports/#{report_id}/resume") - end - - def cancel(report_id) - post(path: "reports/#{report_id}/cancel") - end - end -end diff --git a/lib/onfido/resources/sdk_token.rb b/lib/onfido/resources/sdk_token.rb deleted file mode 100644 index 20f82ef..0000000 --- a/lib/onfido/resources/sdk_token.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class SdkToken < Resource - def create(applicant_id:, **payload) - payload[:applicant_id] = applicant_id - post(path: 'sdk_token', payload: payload) - end - end -end diff --git a/lib/onfido/resources/webhook.rb b/lib/onfido/resources/webhook.rb deleted file mode 100644 index f0f9f3b..0000000 --- a/lib/onfido/resources/webhook.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class Webhook < Resource - def create(url:, **payload) - payload[:url] = url - post(path: 'webhooks', payload: payload) - end - - def find(webhooks_id) - get(path: "webhooks/#{webhooks_id}") - end - - def all - get(path: 'webhooks') - end - - def destroy(webhook_id) - delete(path: "webhooks/#{webhook_id}") - end - - # As well as being a normal resource, Onfido::Webhook also supports - # verifying the authenticity of a webhook by comparing the signature on the - # request to one computed from the body - def self.valid?(request_body, request_signature, token) - if [request_body, request_signature, token].any?(&:nil?) - raise ArgumentError, 'A request body, request signature and token ' \ - 'must be provided' - end - - computed_signature = generate_signature(request_body, token) - Rack::Utils.secure_compare(request_signature, computed_signature) - end - - def self.generate_signature(request_body, token) - OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, request_body) - end - private_class_method :generate_signature - end -end diff --git a/lib/onfido/resources/workflow_run.rb b/lib/onfido/resources/workflow_run.rb deleted file mode 100644 index c44b613..0000000 --- a/lib/onfido/resources/workflow_run.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Onfido - class WorkflowRun < Resource - def create(payload) - post(path: 'workflow_runs', payload: payload) - end - - def find(workflow_run_id) - get(path: "workflow_runs/#{workflow_run_id}") - end - - def all(query_params = {}) - get(path: "workflow_runs?#{stringify_query_params(query_params)}") - end - - def evidence(workflow_run_id) - get(path: "workflow_runs/#{workflow_run_id}/signed_evidence_file") - end - end -end diff --git a/lib/onfido/version.rb b/lib/onfido/version.rb index 7dda9dc..adbeffe 100644 --- a/lib/onfido/version.rb +++ b/lib/onfido/version.rb @@ -1,5 +1,15 @@ -# frozen_string_literal: true +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end module Onfido - VERSION = '2.9.0' + VERSION = '1.0.0' end diff --git a/lib/onfido/webhook_event_verifier.rb b/lib/onfido/webhook_event_verifier.rb new file mode 100644 index 0000000..c3b2cac --- /dev/null +++ b/lib/onfido/webhook_event_verifier.rb @@ -0,0 +1,20 @@ +require "json" +require "openssl" + +module Onfido + class OnfidoInvalidSignatureError < StandardError; end + + class WebhookEventVerifier + def initialize(webhook_token) + @webhook_token = webhook_token + end + + def read_payload(event_body, signature) + event_signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), @webhook_token, event_body) + + raise(OnfidoInvalidSignatureError, "Invalid signature for webhook event") unless OpenSSL.secure_compare(signature, event_signature) + + WebhookEvent.build_from_hash(JSON.parse(event_body)["payload"]) + end + end +end \ No newline at end of file diff --git a/onfido.gemspec b/onfido.gemspec index e8c8b2f..6c2445d 100644 --- a/onfido.gemspec +++ b/onfido.gemspec @@ -1,34 +1,43 @@ -# frozen_string_literal: true - -lib = File.expand_path('lib', __dir__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'onfido/version' - -Gem::Specification.new do |spec| - spec.name = 'onfido' - spec.version = Onfido::VERSION - spec.authors = ['Onfido'] - spec.email = ['engineering@onfido.com'] - spec.summary = 'A wrapper for Onfido API' - spec.description = "A thin wrapper for Onfido's API. This gem only supports "\ - "v3 of the Onfido API. Refer to Onfido's "\ - 'API documentation for details of the expected '\ - 'requests and responses.' - spec.homepage = 'http://github.com/onfido/onfido-ruby' - spec.license = 'MIT' - - spec.files = `git ls-files -z`.split("\x0") - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.4.0' - - spec.add_development_dependency 'rspec', '~> 3.1' - spec.add_development_dependency 'rspec-its', '~> 1.2' - spec.add_development_dependency 'rubocop', '~> 1.11' - spec.add_development_dependency 'sinatra', '~> 1.4' - spec.add_development_dependency 'webmock', '~> 3.0' - - spec.add_dependency 'rack', '>= 1.6.0' - spec.add_dependency 'rest-client', '~> 2.0' +# -*- encoding: utf-8 -*- + +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +$:.push File.expand_path("../lib", __FILE__) +require "onfido/version" + +Gem::Specification.new do |s| + s.name = "onfido" + s.version = Onfido::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["OpenAPI-Generator"] + s.email = [""] + s.homepage = "https://openapi-generator.tech" + s.summary = "Onfido API v3.6 Ruby Gem" + s.description = "The Onfido API (v3.6)" + s.license = "Unlicense" + s.required_ruby_version = ">= 2.7" + s.metadata = {} + + s.add_runtime_dependency 'faraday', '>= 1.0.1', '< 3.0' + s.add_runtime_dependency 'faraday-multipart' + s.add_runtime_dependency 'marcel' + s.add_runtime_dependency 'openssl' + + s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' + s.add_development_dependency 'rspec-its', '~> 1.2' + + s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } + s.test_files = `find spec/*`.split("\n") + s.executables = [] + s.require_paths = ["lib"] end