Project

hypothesis

0.01
No commit activity in last 3 years
No release in over 3 years
Ruby API for hypothesis
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
>= 3.5.1, ~> 3.5
~> 10.0
~> 0.52.1

Runtime

>= 0.11.0, ~> 0.11.0
 Project Readme

Unofficial ruby gem for the hypothesis API.

Installation

gem install hypothesis

Usage

You'll need to generate an API token on your Hypothesis developer page.

require 'rubygems'
require 'hypothesis'

hypothesis = Hypothesis::API.new('YOUR_HYPOTHESIS_API_KEY')
puts hypothesis.search({ user: 'USERNAME', limit: 10 })

That will output an object with the found items.

Here's how you can print the title, URL, text and highlighted content:

hypothesis = Hypothesis::API.new('YOUR_HYPOTHESIS_API_KEY')
results = hypothesis.search(user: 'USERNAME', limit: 10)

results.rows.each do |row|
  puts row.document.title
  puts row.uri
  puts row.text unless row.text.nil?

  row.target.each do |target|
    puts target.selector[target.selector.length - 1].exact unless target.selector.nil?
  end

  puts "\n"
end

Currently this gem only supports the root, search, and read endpoints.

API reference

The Hypothesis API

License

This work is licensed under the MIT License (MIT) and it is not associated with Hypothes.is in any way.