Wrapper for ParseHub API
Add this line to your application's Gemfile:
gem 'parse_hub', github: 'ChuckJHardy/ParseHub'
And then execute:
$ bundle
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_urlsets the ParseHub API urlhttps://www.parsehub.com/api/v2api_keysets the ParseHub API Keynilcleanremoves each run when completefalseverboseshould all output be printed to STDOUTfalselogshould log message be loggedfalseloggerLogger object.Logger
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
Ensure PARSE_HUB_API_KEY and PARSE_HUB_PROJECT_KEY environment variable is set when recording VCR cassettes.
# Includes Rubocop
$ bin/rspec
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.
- 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