A Ruby wrapper for the Browse AI API.
https://www.browse.ai/docs/api/v2
Add this line to your application's Gemfile:
gem 'browse_ai'And then execute:
$ bundle
Or install it yourself as:
$ gem install browse_ai
Set the client API key.
BrowseAi.api_key = <your API key>
Get robots.
robots = BrowseAi.client.get_robots
Get a robot.
robot = BrowseAi.client.get_robot(id: '<robot UUID>')
Get a robot's tasks.
tasks = BrowseAi.client.get_tasks(robot_id: '<robot UUID>')
Get a robot's task.
task = BrowseAi.client.get_tasks(robot_id: '<robot UUID>', id: '<task UUID>')
Run a robot.
# Example JSON payload. The input parameters will vary depending on your robot's configuration.
payload = {'inputParameters' => {'originUrl' => 'Test'}}
task = BrowseAi.client.run_robot(robot_id: '<robot UUID>', payload:)
Get a robot's monitors.
monitors = BrowseAi.client.get_monitors(robot_id: '<robot UUID>')
Get a robot's monitor.
monitor = BrowseAi.client.get_monitors(robot_id: '<robot UUID>', id: '<monitor UUID>')
Get a robot's webhooks.
webhooks = BrowseAi.client.get_webhooks(robot_id: '<robot UUID>')
Get a robot's bulk runs.
bulk_runs = BrowseAi.client.get_bulk_runs(robot_id: '<robot UUID>')
Get a robot's bulk run.
bulk_run = BrowseAi.client.get_bulk_run(robot_id: '<robot UUID>', id: '<task UUID>')
Execute a bulk run of tasks on a robot.
# Example JSON payload. The input parameters will vary depending on your robot's configuration.
payload = {'title' => 'Test Bulk Run', 'inputParameters' => [{'originUrl' => 'Test'}]}
bulk_run = BrowseAi.client.bulk_run_tasks(robot_id: '<robot UUID>', payload:)
Testing uses RSpec, Webmock and VCR.
Tests will make real requests to the API endpoints. Ensure your test and production data is separated.
Tests currently require real data to exist for each resource.
Tests will fail if no data is present in your account for a specific resource.
For example spec/browse_ai/dsl/robots_spec.rb will fail if you have not yet added a robot to your account.
- Copy and rename
config/gem_secret.yml.exampletoconfig/gem_secret.yml. Do not checkconfig/gem_secret.ymlinto version control. - In
config/gem_secret.ymlfill in your test API key.browse_ai_api_key: '<your API key>' - Run rspec
bundle exec rspec
https://www.browse.ai/docs/api/v2
- Fork it ( https://github.com/dior001/browse-ai-ruby/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