optimum API wrapper

This is a simple gem to interact with optimum's Instant Decision API.

The API documentation can be found here: https://optimum-core-staging.herokuapp.com/api/v1/instant-decision/docs

Installation

Add this line to your application's Gemfile:

gem 'optimum'

And then execute:

$ bundle

Or install it yourself as:

$ gem install optimum

Usage

You need to have an introducerId to use the API. Every request will be authenticated with that id in the params.

Configuration

You can configure Optimum by providing a configuration block, before you do any call:

Optimum.configure do |config|
  config.introducer_id = YOUR_ID_HERE
  # config.debug = true # This is false by default, keep in mind it will ve VERY verbose
end

Quote

All the available methods are encapsulated in the Decision class. The available methods are:

Optimum::Decision.create(PARAMS)
# => This will return a decision, along with opportunityId, which will be used in subsequent calls.

Optimum::Decision.update(PARAMS)

Every call will return a Optimum::Response instance, that you can use to get all the information you need:

response = Optimum::Decision.update(PARAMS)

response.status     #=> 200
response.success?   #=> true
response.errors     #=> []
response.data       #=> { ... }

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Please refer to optimum's documentation on how to test different states (we do have recorded VCR responses, but if something changes on their side we need to update). The documentation is here: https://optimum-core-staging.herokuapp.com/api/v1/instant-decision/docs

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.