Persona is a service which is used to collect, verify, understand and orchestrate customer identities. This API is designed to allow Ruby developers to interact with the Persona API programmatically.
For reference, the Persona API documentation can be found here:
https://docs.withpersona.com/docs
Add to your Gemfile
:
gem 'persona-ruby'
Then bundle install
.
The Persona API client uses an access token to authenticate API requests.
To obtain an access code you must visit the Persona Dashboard (https://app.withpersona.com/dashboard/api-keys).
Then you can create a Persona API client.
client = Persona::Client.new(
access_token: 'access_token', # Access token from authorization flow
timeout: 30, # Optional setting for timeouts of all requests (default 60)
)
For use of each endpoint please consult the Persona API reference.
Example: client.inquiry_list()
Example: client.inquiry_get('abcd1234')
Example: client.inquiry_create(data = {"attribute1": "abc", "attribute2": "vcdf"})
Example: client.inquiry_update('abcd1234', data = {"attribute1": "abc", "attribute2": "vcdf"})
Example: client.inquiry_update('abcd1234')
Any error code returned by the Persona API will result in one of the following expections
Code | Exception |
---|---|
400 | Persona::BadRequest |
401 | Persona::Unauthorized |
403 | Persona::Forbidden |
404 | Persona::NotFound |
429 | Persona::TooManyRequests |
400...499 | Persona::ClientError |
500 | Persona::InternalServerError |
502 | Persona::BadGateway |
503 | Persona::ServiceUnavailable |
500...599 | Persona::ServerError |