Skip to content

Commit

Permalink
Starting to write documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Harris committed Feb 13, 2009
1 parent 871faf1 commit 6bd1e6b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@ nytimes-articles================

A simple GEM for interacting with the New York Times' Article Search API (http://developer.nytimes.com/docs/article_search_api)

USAGE
=====

require 'rubygems'
require 'nytimes-articles'

include Nytimes::Articles
Base.api_key = 'YOUR API KEY'
Article.search 'ice cream'
Article.search :title => '"ice cream"', :since => 3.weeks.ago, :fields => :all
Article.search :author => 'Sewell Chan', :facets => [Facet::GEOGRAPHIC, Facet::PERSON]

TODO
====

The following functionality is still to be implemented:

* Boolean field searches
* Parsing multimedia and related_multimedia fields
* Parsing smallimage fields
* Searching for articles with small images thumbnails
* Coercion of some facet results into more suitable Ruby types (mostly Dates / Integer fields)
* Next / previous result set pagination (with memoization?)

COPYRIGHT
=========

Copyright (c) 2008 Jacob Harris. See LICENSE for details.
2 changes: 2 additions & 0 deletions lib/nytimes_articles/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Article < Base
attr_reader *ALL_FIELDS
attr_reader *(Facet::ALL_FACETS.map {|f| f.gsub('_facet', '')})

##
# Create a new Article from hash arguments. You really don't need to call this as Article instances are automatically returned from the API
def initialize(params={})
params.each_pair do |k,v|
instance_variable_set("@#{k}", v)
Expand Down

0 comments on commit 6bd1e6b

Please sign in to comment.