DigifiApi

Ruby wrapper for the DigiFi API V2.

API Docs: https://docs.digifi.io/v2/reference#introduction

Installation

Add this line to your application's Gemfile:

gem 'digifi_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install digifi_api

Setup in Rails

  1. Add configuration for each environment in config/secrets.yml or whatever your strategy is for storing sensitive variables.

    development:
      digifi_api:
        client_id: 'yourclientidhere'
        client_app_key: 'yourclientappkeyhere'
        secret: 'yoursecrethere'
        base_uri: 'https://cloud.digifi.io/api/v2'
    test:
      digifi_api:
        client_id: 'yourclientidhere'
        client_app_key: 'yourclientappkeyhere'
        secret: 'yoursecrethere'
        base_uri: 'https://cloud.digifi.io/api/v2'
    production:
      digifi_api:
        client_id: 'yourclientidhere'
        client_app_key: 'yourclientappkeyhere'
        secret: 'yoursecrethere'
        base_uri: 'https://cloud.digifi.io/api/v2'
    
  2. Create an initializer: /config/initializers/digifi_api.rb

  3. Add the configure block to your initializer

    DigifiApi.configure do |config|
      config.client_id = Rails.application.secrets.digifi_api.client_id
      config.client_public_key = Rails.application.secrets.digifi_api.client_app_key
      config.secret = Rails.application.secrets.digifi_api.secret
    end
    

Usage

ML Models

Submit Method:

DigifiApi::MLModel.submit('model_name', inputs_hash, options_hash)

Options:

  • client_transaction_id :string

ML Rules Engine

Submit Method:

DigifiApi::MLRulesEngine.submit('strategy_name', 'strategy_status', variables_hash, options_hash)

Options:

  • return_input_variables:bool
  • return_processing_detail:bool
  • return_data_sources:bool

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.

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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/justinlyman/digifi_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the DigifiApi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.