Skip to content

Commit

Permalink
Merge pull request #64 from onfido/release-upgrade
Browse files Browse the repository at this point in the history
Refresh onfido-ruby after onfido-openapi-spec update (08508b9)
  • Loading branch information
dvacca-onfido committed Sep 20, 2024
2 parents 033932f + 8155929 commit 006e7df
Show file tree
Hide file tree
Showing 14 changed files with 2,018 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .release.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 8 additions & 0 deletions lib/onfido.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/watchlist_enhanced_properties.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def self.acceptable_attributes
# Attribute type mapping.
def self.openapi_types
{
:'records' => :'Array<String>'
:'records' => :'Array<WatchlistEnhancedPropertiesRecordsInner>'
}
end

Expand Down
311 changes: 311 additions & 0 deletions lib/onfido/models/watchlist_enhanced_properties_records_inner.rb
Original file line number Diff line number Diff line change
@@ -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<WatchlistEnhancedPropertiesRecordsInnerAddressInner>',
:'_alias' => :'Array<WatchlistEnhancedPropertiesRecordsInnerAliasInner>',
:'associate' => :'Array<WatchlistEnhancedPropertiesRecordsInnerAssociateInner>',
:'attribute' => :'Array<WatchlistEnhancedPropertiesRecordsInnerAttributeInner>',
:'date_of_birth' => :'Array<String>',
:'event' => :'Array<WatchlistEnhancedPropertiesRecordsInnerEventInner>',
:'full_name' => :'String',
:'position' => :'Array<String>',
:'source' => :'Array<WatchlistEnhancedPropertiesRecordsInnerSourceInner>'
}
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<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
# models (e.g. Pet) or oneOf
klass = Onfido.const_get(type)
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
end
end

# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end

# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end

# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end

hash[param] = _to_hash(value)
end
hash
end

# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end

end

end
Loading

0 comments on commit 006e7df

Please sign in to comment.