Skip to main content
The context.dev gem requires Ruby 3.2 or later. SDKs covers the API key and the defaults all SDKs share.

Install

With Bundler, add gem "context.dev" to your Gemfile, run bundle install, and run the examples with bundle exec ruby.

Scrape a page

Save this as scrape.rb and run ruby scrape.rb. It prints the page as Markdown, starting with # Example Domain.
scrape.rb

Look up a brand

Replace the request and the puts line with this lookup. It prints the company name.

Notes

  • Nested parameters are hashes with snake_case symbol keys.
  • brand.retrieve takes the lookup as body:, because the lookup type decides which fields are valid.
  • Set timeout in seconds and max_retries on the client: ContextDev::Client.new(timeout: 120, max_retries: 0).