Heracles::Wrapper
API Wrapper for Heracles workflow manager.
Installation
Add this line to your application's Gemfile:
gem 'heracles-wrapper'
And then execute:
$ bundle
Or install it yourself as:
$ gem install heracles-wrapper
Get your Heracles API key
Once installed in your application use rails generate:
rails generate heracles:wrapper:install -k <API_KEY_FROM_HERACLES>
Usage
Heracles::Wrapper.service(
:create_job,
:workflow_name => <WORKFLOW_NAME>,
:parameters => {
:notification_url => 'http://google.com'
}
)
Test Usage
require 'heracles-wrapper/test_helper'
describe YourObject do
include Heracles::Wrapper::TestHelper
let(:service) {
Heracles::Wrapper.service(
:create_job,
:workflow_name => <WORKFLOW_NAME>,
:parameters => {
:notification_url => 'http://google.com'
}
)
}
it 'should wrap the API with failing calls' do
with_heracles_service_failure_stub(:create_job, 'Failure') do
lambda {
service.call
}.must_raise(Heracles::Wrapper::RequestFailure, /Failure/)
end
end
it 'should wrap the API' do
with_heracles_service_stub(:create_job) do
service.call.job_id.must_be_kind_of Fixnum
end
end
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request