Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test generator upgrade #65

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.6.0
7.9.0
11 changes: 11 additions & 0 deletions Gemfile-E
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source 'https://rubygems.org'

gemspec

group :development, :test do
gem 'rake', '~> 13.0.1'
gem 'pry-byebug'
gem 'rubocop', '~> 0.66.0'
end

gem "faraday-follow_redirects", "~> 0.3.0"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Webhook events payload needs to be verified before it can be accessed. Library a

## Contributing

This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) (version: 7.6.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.
This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) (version: 7.9.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:

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
132 changes: 66 additions & 66 deletions lib/onfido/api/default_api.rb

Large diffs are not rendered by default.

54 changes: 30 additions & 24 deletions lib/onfido/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down Expand Up @@ -164,35 +164,41 @@ def download_file(request)
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)
body = response.body
encoding = body.encoding

# reconstruct content
content = stream.join
content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'binary'
content = content.force_encoding(encoding)

# return byte stream
return content if @config.return_binary_data == true

# 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
# 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
prefix = 'download-'
end
prefix = prefix + '-' unless prefix.end_with?('-')

tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
tempfile.write(content)
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

def connection(opts)
Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/api_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
12 changes: 11 additions & 1 deletion lib/onfido/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down Expand Up @@ -87,6 +87,14 @@ class Configuration
# @return [true, false]
attr_accessor :debugging

# Set this to ignore operation servers for the API client. This is useful when you need to
# send requests to a different server than the one specified in the OpenAPI document.
# Will default to the base url defined in the spec but can be overridden by setting
# `scheme`, `host`, `base_path` directly.
# Default to false.
# @return [true, false]
attr_accessor :ignore_operation_servers

# Defines the logger used for debugging.
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
#
Expand Down Expand Up @@ -178,6 +186,7 @@ def initialize
@return_binary_data = false
@params_encoder = nil
@debugging = false
@ignore_operation_servers = false
@inject_format = false
@force_ending_format = false
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
Expand Down Expand Up @@ -214,6 +223,7 @@ def base_path=(base_path)

# Returns base URL for specified operation based on server settings
def base_url(operation = nil)
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if ignore_operation_servers
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])
Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/address_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/address_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/addresses_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6
Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicant_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicant_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicant_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicant_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicant_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicant_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicant_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/applicants_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6
Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0
=end

Expand Down
37 changes: 32 additions & 5 deletions lib/onfido/models/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down Expand Up @@ -57,6 +57,12 @@ class Check
# Indicates whether the object was created in the sandbox or not.
attr_accessor :sandbox

attr_accessor :paused

attr_accessor :version

attr_accessor :privacy_notices_read_consent_given

class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
Expand Down Expand Up @@ -95,7 +101,10 @@ def self.attribute_map
:'form_uri' => :'form_uri',
:'results_uri' => :'results_uri',
:'report_ids' => :'report_ids',
:'sandbox' => :'sandbox'
:'sandbox' => :'sandbox',
:'paused' => :'paused',
:'version' => :'version',
:'privacy_notices_read_consent_given' => :'privacy_notices_read_consent_given'
}
end

Expand All @@ -120,7 +129,10 @@ def self.openapi_types
:'form_uri' => :'String',
:'results_uri' => :'String',
:'report_ids' => :'Array<String>',
:'sandbox' => :'Boolean'
:'sandbox' => :'Boolean',
:'paused' => :'Boolean',
:'version' => :'String',
:'privacy_notices_read_consent_given' => :'Boolean'
}
end

Expand Down Expand Up @@ -218,6 +230,18 @@ def initialize(attributes = {})
if attributes.key?(:'sandbox')
self.sandbox = attributes[:'sandbox']
end

if attributes.key?(:'paused')
self.paused = attributes[:'paused']
end

if attributes.key?(:'version')
self.version = attributes[:'version']
end

if attributes.key?(:'privacy_notices_read_consent_given')
self.privacy_notices_read_consent_given = attributes[:'privacy_notices_read_consent_given']
end
end

# Show invalid properties with the reasons. Usually used together with valid?
Expand Down Expand Up @@ -287,7 +311,10 @@ def ==(o)
form_uri == o.form_uri &&
results_uri == o.results_uri &&
report_ids == o.report_ids &&
sandbox == o.sandbox
sandbox == o.sandbox &&
paused == o.paused &&
version == o.version &&
privacy_notices_read_consent_given == o.privacy_notices_read_consent_given
end

# @see the `==` method
Expand All @@ -299,7 +326,7 @@ def eql?(o)
# 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
[webhook_ids, applicant_id, applicant_provides_data, tags, redirect_uri, id, created_at, href, status, result, form_uri, results_uri, report_ids, sandbox, paused, version, privacy_notices_read_consent_given].hash
end

# Builds the object from hash
Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/check_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
2 changes: 1 addition & 1 deletion lib/onfido/models/check_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
The version of the OpenAPI document: v3.6

Generated by: https://openapi-generator.tech
Generator version: 7.6.0
Generator version: 7.9.0

=end

Expand Down
Loading
Loading