From 8155929ba5c317be53dca1419e6be366f0f5d104 Mon Sep 17 00:00:00 2001 From: dvacca-onfido <134616519+dvacca-onfido@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:41:33 +0000 Subject: [PATCH] Upgrade after onfido-openapi-spec change 08508b9 --- .release.json | 8 +- README.md | 2 +- lib/onfido.rb | 8 + lib/onfido/api_client.rb | 2 +- .../models/watchlist_enhanced_properties.rb | 2 +- ...hlist_enhanced_properties_records_inner.rb | 311 ++++++++++++++++++ ..._properties_records_inner_address_inner.rb | 281 ++++++++++++++++ ...ed_properties_records_inner_alias_inner.rb | 223 +++++++++++++ ...roperties_records_inner_associate_inner.rb | 232 +++++++++++++ ...roperties_records_inner_attribute_inner.rb | 223 +++++++++++++ ...ed_properties_records_inner_event_inner.rb | 250 ++++++++++++++ ...erties_records_inner_event_inner_source.rb | 241 ++++++++++++++ ...d_properties_records_inner_source_inner.rb | 241 ++++++++++++++ lib/onfido/version.rb | 2 +- 14 files changed, 2018 insertions(+), 8 deletions(-) create mode 100644 lib/onfido/models/watchlist_enhanced_properties_records_inner.rb create mode 100644 lib/onfido/models/watchlist_enhanced_properties_records_inner_address_inner.rb create mode 100644 lib/onfido/models/watchlist_enhanced_properties_records_inner_alias_inner.rb create mode 100644 lib/onfido/models/watchlist_enhanced_properties_records_inner_associate_inner.rb create mode 100644 lib/onfido/models/watchlist_enhanced_properties_records_inner_attribute_inner.rb create mode 100644 lib/onfido/models/watchlist_enhanced_properties_records_inner_event_inner.rb create mode 100644 lib/onfido/models/watchlist_enhanced_properties_records_inner_event_inner_source.rb create mode 100644 lib/onfido/models/watchlist_enhanced_properties_records_inner_source_inner.rb diff --git a/.release.json b/.release.json index c99859c..0b7e16b 100644 --- a/.release.json +++ b/.release.json @@ -1,9 +1,9 @@ { "source": { "repo_url": "https://github.com/onfido/onfido-openapi-spec", - "short_sha": "f5555a0", - "long_sha": "f5555a0a68778432f3b4854885b496116ac3730c", - "version": "v3.3.1" + "short_sha": "08508b9", + "long_sha": "08508b9517238b3becb4265130633a418a8ee319", + "version": "v3.5.0" }, - "release": "v3.3.1" + "release": "v3.4.0" } diff --git a/README.md b/README.md index 649ec53..c29b4e0 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This version uses Onfido API v3.6. Refer to our [API versioning guide](https://d ### Installation ```ruby -gem onfido, '~> 3.3.1' +gem onfido, '~> 3.4.0' ``` Configure with your API token, region and optional timeout (default value is 30): diff --git a/lib/onfido.rb b/lib/onfido.rb index 34765cc..9881d7e 100644 --- a/lib/onfido.rb +++ b/lib/onfido.rb @@ -257,6 +257,14 @@ require 'onfido/models/watchlist_aml_report' require 'onfido/models/watchlist_enhanced_breakdown' require 'onfido/models/watchlist_enhanced_properties' +require 'onfido/models/watchlist_enhanced_properties_records_inner' +require 'onfido/models/watchlist_enhanced_properties_records_inner_address_inner' +require 'onfido/models/watchlist_enhanced_properties_records_inner_alias_inner' +require 'onfido/models/watchlist_enhanced_properties_records_inner_associate_inner' +require 'onfido/models/watchlist_enhanced_properties_records_inner_attribute_inner' +require 'onfido/models/watchlist_enhanced_properties_records_inner_event_inner' +require 'onfido/models/watchlist_enhanced_properties_records_inner_event_inner_source' +require 'onfido/models/watchlist_enhanced_properties_records_inner_source_inner' require 'onfido/models/watchlist_enhanced_report' require 'onfido/models/watchlist_monitor' require 'onfido/models/watchlist_monitor_builder' diff --git a/lib/onfido/api_client.rb b/lib/onfido/api_client.rb index 6639cbe..caa9963 100644 --- a/lib/onfido/api_client.rb +++ b/lib/onfido/api_client.rb @@ -34,7 +34,7 @@ class ApiClient # @option config [Configuration] Configuration for initializing the object, default to Configuration.default def initialize(config = Configuration.default) @config = config - @user_agent = "onfido-ruby/3.3.1" + @user_agent = "onfido-ruby/3.4.0" @default_headers = { 'Content-Type' => 'application/json', 'User-Agent' => @user_agent diff --git a/lib/onfido/models/watchlist_enhanced_properties.rb b/lib/onfido/models/watchlist_enhanced_properties.rb index 58eb173..34c8df7 100644 --- a/lib/onfido/models/watchlist_enhanced_properties.rb +++ b/lib/onfido/models/watchlist_enhanced_properties.rb @@ -33,7 +33,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'records' => :'Array' + :'records' => :'Array' } end diff --git a/lib/onfido/models/watchlist_enhanced_properties_records_inner.rb b/lib/onfido/models/watchlist_enhanced_properties_records_inner.rb new file mode 100644 index 0000000..9562e5b --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties_records_inner.rb @@ -0,0 +1,311 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.6.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedPropertiesRecordsInner + # All addresses on file. + attr_accessor :address + + # Any names that the person is also known as. + attr_accessor :_alias + + # Any linked persons, for example family relatives or business partners. + attr_accessor :associate + + # Information about the person, for example hair color or nationality. + attr_accessor :attribute + + # All the date of births on file. + attr_accessor :date_of_birth + + # Information about events that have occurred to the person, for example deportation or arrest. + attr_accessor :event + + # The name on file + attr_accessor :full_name + + # The role, country and date of each position. + attr_accessor :position + + # Details about where the information was obtained. + attr_accessor :source + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'address' => :'address', + :'_alias' => :'alias', + :'associate' => :'associate', + :'attribute' => :'attribute', + :'date_of_birth' => :'date_of_birth', + :'event' => :'event', + :'full_name' => :'full_name', + :'position' => :'position', + :'source' => :'source' + } + 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' => :'Array', + :'_alias' => :'Array', + :'associate' => :'Array', + :'attribute' => :'Array', + :'date_of_birth' => :'Array', + :'event' => :'Array', + :'full_name' => :'String', + :'position' => :'Array', + :'source' => :'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::WatchlistEnhancedPropertiesRecordsInner` 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::WatchlistEnhancedPropertiesRecordsInner`. 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') + if (value = attributes[:'address']).is_a?(Array) + self.address = value + end + end + + if attributes.key?(:'_alias') + if (value = attributes[:'_alias']).is_a?(Array) + self._alias = value + end + end + + if attributes.key?(:'associate') + if (value = attributes[:'associate']).is_a?(Array) + self.associate = value + end + end + + if attributes.key?(:'attribute') + if (value = attributes[:'attribute']).is_a?(Array) + self.attribute = value + end + end + + if attributes.key?(:'date_of_birth') + if (value = attributes[:'date_of_birth']).is_a?(Array) + self.date_of_birth = value + end + end + + if attributes.key?(:'event') + if (value = attributes[:'event']).is_a?(Array) + self.event = value + end + end + + if attributes.key?(:'full_name') + self.full_name = attributes[:'full_name'] + end + + if attributes.key?(:'position') + if (value = attributes[:'position']).is_a?(Array) + self.position = value + end + end + + if attributes.key?(:'source') + if (value = attributes[:'source']).is_a?(Array) + self.source = 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 && + address == o.address && + _alias == o._alias && + associate == o.associate && + attribute == o.attribute && + date_of_birth == o.date_of_birth && + event == o.event && + full_name == o.full_name && + position == o.position && + source == o.source + 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, _alias, associate, attribute, date_of_birth, event, full_name, position, source].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_records_inner_address_inner.rb b/lib/onfido/models/watchlist_enhanced_properties_records_inner_address_inner.rb new file mode 100644 index 0000000..cd28bdc --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties_records_inner_address_inner.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.6.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedPropertiesRecordsInnerAddressInner + attr_accessor :address_line1 + + attr_accessor :country + + attr_accessor :postal_code + + attr_accessor :state_province + + attr_accessor :town + + attr_accessor :locator_type + + 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_line1' => :'address_line1', + :'country' => :'country', + :'postal_code' => :'postal_code', + :'state_province' => :'state_province', + :'town' => :'town', + :'locator_type' => :'locator_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_line1' => :'String', + :'country' => :'CountryCodes', + :'postal_code' => :'String', + :'state_province' => :'String', + :'town' => :'String', + :'locator_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::WatchlistEnhancedPropertiesRecordsInnerAddressInner` 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::WatchlistEnhancedPropertiesRecordsInnerAddressInner`. 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_line1') + self.address_line1 = attributes[:'address_line1'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + end + + if attributes.key?(:'postal_code') + self.postal_code = attributes[:'postal_code'] + end + + if attributes.key?(:'state_province') + self.state_province = attributes[:'state_province'] + end + + if attributes.key?(:'town') + self.town = attributes[:'town'] + end + + if attributes.key?(:'locator_type') + self.locator_type = attributes[:'locator_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_line1 == o.address_line1 && + country == o.country && + postal_code == o.postal_code && + state_province == o.state_province && + town == o.town && + locator_type == o.locator_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_line1, country, postal_code, state_province, town, locator_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/watchlist_enhanced_properties_records_inner_alias_inner.rb b/lib/onfido/models/watchlist_enhanced_properties_records_inner_alias_inner.rb new file mode 100644 index 0000000..e34cba4 --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties_records_inner_alias_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.6.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedPropertiesRecordsInnerAliasInner + attr_accessor :alias_name + + attr_accessor :alias_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'alias_name' => :'alias_name', + :'alias_type' => :'alias_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 + { + :'alias_name' => :'String', + :'alias_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::WatchlistEnhancedPropertiesRecordsInnerAliasInner` 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::WatchlistEnhancedPropertiesRecordsInnerAliasInner`. 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?(:'alias_name') + self.alias_name = attributes[:'alias_name'] + end + + if attributes.key?(:'alias_type') + self.alias_type = attributes[:'alias_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 && + alias_name == o.alias_name && + alias_type == o.alias_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 + [alias_name, alias_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/watchlist_enhanced_properties_records_inner_associate_inner.rb b/lib/onfido/models/watchlist_enhanced_properties_records_inner_associate_inner.rb new file mode 100644 index 0000000..f040472 --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties_records_inner_associate_inner.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.6.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedPropertiesRecordsInnerAssociateInner + attr_accessor :entity_name + + attr_accessor :relationship_direction + + attr_accessor :relationship_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'entity_name' => :'entity_name', + :'relationship_direction' => :'relationship_direction', + :'relationship_type' => :'relationship_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 + { + :'entity_name' => :'String', + :'relationship_direction' => :'String', + :'relationship_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::WatchlistEnhancedPropertiesRecordsInnerAssociateInner` 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::WatchlistEnhancedPropertiesRecordsInnerAssociateInner`. 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?(:'entity_name') + self.entity_name = attributes[:'entity_name'] + end + + if attributes.key?(:'relationship_direction') + self.relationship_direction = attributes[:'relationship_direction'] + end + + if attributes.key?(:'relationship_type') + self.relationship_type = attributes[:'relationship_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 && + entity_name == o.entity_name && + relationship_direction == o.relationship_direction && + relationship_type == o.relationship_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 + [entity_name, relationship_direction, relationship_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/watchlist_enhanced_properties_records_inner_attribute_inner.rb b/lib/onfido/models/watchlist_enhanced_properties_records_inner_attribute_inner.rb new file mode 100644 index 0000000..4083393 --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties_records_inner_attribute_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.6.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedPropertiesRecordsInnerAttributeInner + attr_accessor :attribute_type + + attr_accessor :attribute_value + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'attribute_type' => :'attribute_type', + :'attribute_value' => :'attribute_value' + } + 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 + { + :'attribute_type' => :'String', + :'attribute_value' => :'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::WatchlistEnhancedPropertiesRecordsInnerAttributeInner` 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::WatchlistEnhancedPropertiesRecordsInnerAttributeInner`. 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?(:'attribute_type') + self.attribute_type = attributes[:'attribute_type'] + end + + if attributes.key?(:'attribute_value') + self.attribute_value = attributes[:'attribute_value'] + 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 && + attribute_type == o.attribute_type && + attribute_value == o.attribute_value + 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 + [attribute_type, attribute_value].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_records_inner_event_inner.rb b/lib/onfido/models/watchlist_enhanced_properties_records_inner_event_inner.rb new file mode 100644 index 0000000..1745b9b --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties_records_inner_event_inner.rb @@ -0,0 +1,250 @@ +=begin +#Onfido API v3.6 + +#The Onfido API (v3.6) + +The version of the OpenAPI document: v3.6 + +Generated by: https://openapi-generator.tech +Generator version: 7.6.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedPropertiesRecordsInnerEventInner + attr_accessor :category + + attr_accessor :event_date + + attr_accessor :event_description + + attr_accessor :source + + attr_accessor :sub_category + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category' => :'category', + :'event_date' => :'event_date', + :'event_description' => :'event_description', + :'source' => :'source', + :'sub_category' => :'sub_category' + } + 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', + :'event_date' => :'Date', + :'event_description' => :'String', + :'source' => :'WatchlistEnhancedPropertiesRecordsInnerEventInnerSource', + :'sub_category' => :'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::WatchlistEnhancedPropertiesRecordsInnerEventInner` 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::WatchlistEnhancedPropertiesRecordsInnerEventInner`. 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?(:'event_date') + self.event_date = attributes[:'event_date'] + end + + if attributes.key?(:'event_description') + self.event_description = attributes[:'event_description'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'sub_category') + self.sub_category = attributes[:'sub_category'] + 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 && + event_date == o.event_date && + event_description == o.event_description && + source == o.source && + sub_category == o.sub_category + 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, event_date, event_description, source, sub_category].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_records_inner_event_inner_source.rb b/lib/onfido/models/watchlist_enhanced_properties_records_inner_event_inner_source.rb new file mode 100644 index 0000000..a1f0a06 --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties_records_inner_event_inner_source.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.6.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedPropertiesRecordsInnerEventInnerSource + attr_accessor :source_date + + attr_accessor :source_format + + attr_accessor :source_name + + attr_accessor :source_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'source_date' => :'source_date', + :'source_format' => :'source_format', + :'source_name' => :'source_name', + :'source_url' => :'source_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 + { + :'source_date' => :'Date', + :'source_format' => :'String', + :'source_name' => :'String', + :'source_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::WatchlistEnhancedPropertiesRecordsInnerEventInnerSource` 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::WatchlistEnhancedPropertiesRecordsInnerEventInnerSource`. 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?(:'source_date') + self.source_date = attributes[:'source_date'] + end + + if attributes.key?(:'source_format') + self.source_format = attributes[:'source_format'] + end + + if attributes.key?(:'source_name') + self.source_name = attributes[:'source_name'] + end + + if attributes.key?(:'source_url') + self.source_url = attributes[:'source_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 && + source_date == o.source_date && + source_format == o.source_format && + source_name == o.source_name && + source_url == o.source_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 + [source_date, source_format, source_name, source_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/watchlist_enhanced_properties_records_inner_source_inner.rb b/lib/onfido/models/watchlist_enhanced_properties_records_inner_source_inner.rb new file mode 100644 index 0000000..21f126a --- /dev/null +++ b/lib/onfido/models/watchlist_enhanced_properties_records_inner_source_inner.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.6.0 + +=end + +require 'date' +require 'time' + +module Onfido + class WatchlistEnhancedPropertiesRecordsInnerSourceInner + attr_accessor :source_headline + + attr_accessor :source_name + + attr_accessor :source_url + + attr_accessor :source_format + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'source_headline' => :'source_headline', + :'source_name' => :'source_name', + :'source_url' => :'source_url', + :'source_format' => :'source_format' + } + 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 + { + :'source_headline' => :'String', + :'source_name' => :'String', + :'source_url' => :'String', + :'source_format' => :'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::WatchlistEnhancedPropertiesRecordsInnerSourceInner` 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::WatchlistEnhancedPropertiesRecordsInnerSourceInner`. 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?(:'source_headline') + self.source_headline = attributes[:'source_headline'] + end + + if attributes.key?(:'source_name') + self.source_name = attributes[:'source_name'] + end + + if attributes.key?(:'source_url') + self.source_url = attributes[:'source_url'] + end + + if attributes.key?(:'source_format') + self.source_format = attributes[:'source_format'] + 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 && + source_headline == o.source_headline && + source_name == o.source_name && + source_url == o.source_url && + source_format == o.source_format + 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 + [source_headline, source_name, source_url, source_format].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/version.rb b/lib/onfido/version.rb index deaaa3c..5d12db2 100644 --- a/lib/onfido/version.rb +++ b/lib/onfido/version.rb @@ -11,5 +11,5 @@ =end module Onfido - VERSION = '3.3.1' + VERSION = '3.4.0' end