ParseHub -
Wrapper for ParseHub API
Installation
Add this line to your application's Gemfile:
gem 'parse_hub', github: 'ChuckJHardy/ParseHub'
And then execute:
$ bundle
Configuration
ParseHub.configure do |config|
config.base_url = "https://www.parsehub.com/api/v3"
config.api_key = "pol6BFzsASYw4gQBl02b24nt"
config.clean = true
config.verbose = true
config.log = true
config.logger = Rails.logger
end
base_url
sets the ParseHub API urlhttps://www.parsehub.com/api/v2
api_key
sets the ParseHub API Keynil
clean
removes each run when completefalse
verbose
should all output be printed to STDOUTfalse
log
should log message be loggedfalse
logger
Logger object.Logger
Usage
Find Exchange Rate:
token = ParseHub.run(project_key: "tn42b20lBQg4wYSAszFB6lop", url: 'http://google.com', template: 'google')
# => tn42b20lBQg4wYSAszFB6lop
ph = ParseHub.new(token: token)
ph.answer
# => { ... }
ph.finished?
# => true
ph.delete
# => true
waits = [10, 2, 1, 1, 1] # Each time you can wait for a different period. Defaults to 5
ph.promise(token: token, waits: waits, trys: 5) do |response|
puts response.inspect #=> { ... }
end
Testing
Ensure PARSE_HUB_API_KEY
and PARSE_HUB_PROJECT_KEY
environment variable is set when recording VCR cassettes.
# Includes Rubocop
$ bin/rspec
Development
After checking out the repo, run bin/setup
to install dependencies. Then, 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
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
- Fork it ( https://github.com/[my-github-username]/ParseHub/fork )
- 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 a new Pull Request