Skip to content

Commit

Permalink
Merge pull request #67 from onfido/release-upgrade
Browse files Browse the repository at this point in the history
Refresh onfido-ruby after onfido-openapi-spec update (2998dd3)
  • Loading branch information
dvacca-onfido authored Oct 23, 2024
2 parents 9238f39 + 0529f50 commit 6b5c12c
Show file tree
Hide file tree
Showing 299 changed files with 438 additions and 392 deletions.
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
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": "10f8380",
"long_sha": "10f83806efa080edbf022ac48d5eeac90fbceb0c",
"version": ""
"short_sha": "2998dd3",
"long_sha": "2998dd3ad2db49a33e0ecf9b41c7cf873909ef0b",
"version": "v4.0.0"
},
"release": "v3.4.0"
"release": "v4.0.0"
}
30 changes: 30 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Migration Guide

## Upgrading from 3.x to 4.x

### Core Resources

- Applicants
- Replace broken `ConsentsBuilder` object with a list of `ApplicantConsentBuilder` ones
- Workflow Runs
- Rename `WorkflowRunSharedLink` object into `WorkflowRunLink`
- Define `WorkflowRunStatus` enum for storing status information
- Rename `WorkflowRunResponseError` object into `WorkflowRunError`
- Documents
- Reuse already existent `DocumentTypes` enum when uploading documents

### Other Endpoints

- Webhooks
- Define `WebhookEventObjectStatus` enum to collect webhook event object's status
- Define `WebhookEventResourceType` enum to collect webhhok event resource's type
- Define `WebhookEventPayloadResource` object to store webhook payload's contents
- Checks
- Define `CheckStatus` enum for accessing checks status
- Reports
- Remove properties from `DeviceIntelligenceBreakdownPropertiesDevice` object: `true_os`, `os_anomaly`, `rooted` and `remote_software`
- Remove properties from `DeviceIntelligenceBreakdownPropertiesIp` object: `vpn_detection`, `proxy_detection` and `type`

### OpenAPI generator

- Version upgraded from 7.6.0 to 7.9.0
4 changes: 2 additions & 2 deletions 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.4.0'
gem onfido, '~> 4.0.0'
```

Configure with your API token, region and optional timeout (default value is 30):
Expand Down 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.

56 changes: 31 additions & 25 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 @@ -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.4.0"
@user_agent = "onfido-ruby/4.0.0"
@default_headers = {
'Content-Type' => 'application/json',
'User-Agent' => @user_agent
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_consent_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_consent_name.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
2 changes: 1 addition & 1 deletion 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
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
2 changes: 1 addition & 1 deletion lib/onfido/models/check_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/check_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/check_status.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

0 comments on commit 6b5c12c

Please sign in to comment.