Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby gem to access Factual API - v3 beta
Branch: master

This branch is even with shreya:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc
lib
test/unit
CHANGLOG.md
README.md
ruby-factual.gemspec

README.md

Sample Usage

A block of code is worth a thousand words. Supports Factual API v3 beta

require 'rubygems'
gem 'ruby-factual'
require 'factual'

api = Factual::Api.new(:api_key => "<YOUR_FACTUAL_API_KEY>")

# get table and its metadata
# table metadata: name, description, title, geo_enabled etc
table = api.get_table("places")
puts table.name, table.title

# read rows after filtering and sorting
table.filter(:name => "CA").sort(:name => 'asc').page(1, :size => 5).each_row do |state_info|

  fact = state_info["region"]
  puts fact.value, fact.subject_keys
end

# you can also get rows by search
row = table.search("hawaii").find_one
puts row["region"]
Something went wrong with that request. Please try again.