indication
v0.1.1
Published
indication makes handling
Downloads
1
Readme
indication
indication makes handling
Installation
Add this line to your application's Gemfile:
gem 'indication'
And then execute:
$ bundle
Or install it yourself as:
$ gem install indication
Configuration
indication.config do |config|
config.default_polling_interval = 5.seconds
end
Usage
class SearchJob < ApplicationJob
include Indication::Resolutions
# Usage:
#
def perform(from, to, date, promise = Indication::Promise.new)
searches = Airlines.all.map do |airline|
AirlineSearchJob.new(airline, from, to, date, token)
end
indication.await(promises)
end
end
class AirlineSearchJob < ApplicationJob
include Indication::Resolutions
def perform(airline, from, to, date, promise = Indication::Promise.new)
begin
flights = airline.search(from, to, date, token)
resolved(token, )
rescue Airline::SearchError => error
rejected(token, error.message)
end
end
end
import axios from 'axios'
import indication from 'indication';
const indication = new indication();
axios.post('/search', { from: 'SFO', to: 'LAX', date: '2018-12-31', token: indication.token });
try {
const data = await indication;
console.log('resolved', data);
} catch (error) {
console.log('rejected', error);
}
Contributing
Contribution directions go here.
License
The gem is available as open source under the terms of the MIT License.