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

Update README.md files #105

Merged
merged 1 commit into from
Jul 23, 2024
Merged
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ disallowAdditionalPropertiesIfNotPresent: false

## API Documentation

The [openapi-reference/openapi.json](generated/artifacts/openapi-reference/openapi.json) file can be used to explore the OpenAPI definition with tools like [Swagger Editor](https://editor.swagger.io/) or [Postman](https://www.postman.com/).
The [openapi-reference/openapi.json](generated/artifacts/openapi-reference/openapi.json) file can be used to explore the OpenAPI definition with tools like [Swagger Editor](https://editor.swagger.io/?url=https://raw.githubusercontent.com/onfido/onfido-openapi-spec/master/generated/artifacts/openapi-reference/openapi.json).

A pre-compiled Postman collection is also available in the Onfido [documentation portal](https://documentation.onfido.com/#postman).

Expand Down
12 changes: 6 additions & 6 deletions generators/ruby/faraday/templates/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ Documentation and code examples can be found at https://documentation.onfido.com

## Error Handling

All errors are wrapped by `ApiError` coming from [FaradayExpection](https://www.rubydoc.info/github/lostisland/faraday/Faraday/ClientError):
All errors are wrapped by `ApiError` coming from [FaradayException](https://www.rubydoc.info/github/lostisland/faraday/Faraday/ClientError):

- `Connection timed out` is raised in case of `Faraday::TimeoutError`
- `Connection failed` is raised in case of `Faraday::ConnectionFailed`

All errors provide the `response_code`, `response_body`, `json_body`, `type` and `fields` of the error.
All errors provide the `code`, `response_headers`, and `response_body` of the error.

```ruby
def create_applicant
onfido_api.create_applicant(params)
rescue Faraday::ConnectionFailed => e
e.type # => 'validation_error'
e.fields # => { "email": { "messages": ["invalid format"] } }
e.response_code # => '422'
rescue Onfido::ApiError => e
e.message # => 'Unprocessable entity'
e.response_body # => { error: { type: "validation_error", message: "", fields: { "email": [ "invalid format" ] } } }
e.code # => '422'
end
```

Expand Down