Skip to content
Ruby gem to access Factual API - v3 beta
Find file
Pull request Compare This branch is even with shreya:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Sample Usage

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

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

api = => "<YOUR_FACTUAL_API_KEY>")

# get table and its metadata
# table metadata: name, description, title, geo_enabled etc
table = api.get_table("places")
puts, 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

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