Permalink
Browse files

Update README

  • Loading branch information...
1 parent 3b383a4 commit c9cd6975a0a286303169ef961c9f768423b95860 @marcandre marcandre committed Jun 24, 2010
View
38 README.txt → README.rdoc
@@ -11,28 +11,16 @@ Ruby wrapper for Google AJAX API REST interfaces(Feeds, Language and Search).
require "googleajax"
- # First, setup referer:
- GoogleAjax.referer = [your domain name here]
+ # First, setup referrer:
+ GoogleAjax.referrer = "your_domain_name_here"
# Optionally, you can set an api_key:
- GoogleAjax.api_key = [your api key here]
+ GoogleAjax.api_key = "your api key here"
=== Now you are set to go, so here are a few examples:
- # Find top 10 feeds for 'ruby'
- GoogleAjax::Feed.find('ruby')
-
- # Load 4 most recent entries from 'http://monki.geemus.com/feed/atom.xml'
- GoogleAjax::Feed.load('http://monki.geemus.com/feed/atom.xml')
-
- # Find feed for 'http://monki.geemus.com'
- GoogleAjax::Feed.lookup('http://monki.geemus.com')
-
- # Find the language of the string 'Ciao mondo'
- GoogleAjax::Language.detect('Ciao mondo')
-
- # Translate 'Hello world' to italian
- GoogleAjax::Language.translate('Hello world', 'en', 'it')
+ # Find top 4 web page results for 'Hello world'
+ GoogleAjax::Search.web('Hello world')
# Find top 4 blogs for 'ruby'
GoogleAjax::Search.blogs('ruby')
@@ -52,13 +40,20 @@ Ruby wrapper for Google AJAX API REST interfaces(Feeds, Language and Search).
# Find top 4 video results for 'ruby'
GoogleAjax::Search.video('ruby')
- # Find top 4 web page results for 'Hello world'
- GoogleAjax::Search.web('Hello world')
-
# Find top 10 feeds for 'ruby'
GoogleAjax::Feed.find('ruby')
+ # Load 4 most recent entries from 'http://monki.geemus.com/feed/atom.xml'
+ GoogleAjax::Feed.load('http://monki.geemus.com/feed/atom.xml')
+ # Find feed for 'http://monki.geemus.com'
+ GoogleAjax::Feed.lookup('http://monki.geemus.com')
+
+ # Find the language of the string 'Ciao mondo'
+ GoogleAjax::Language.detect('Ciao mondo')
+
+ # Translate 'Hello world' to italian
+ GoogleAjax::Language.translate('Hello world', 'en', 'it')
=== Results
@@ -83,6 +78,7 @@ For example:
# }
When possible, the result is simplified:
+
* Feed.find will return an array instead of {:entries => array}
* Feed.load will return the feed instead of {:feed => feed}
@@ -98,7 +94,7 @@ When possible, the result is simplified:
(The MIT License)
-Copyright (c) 2009 {geemus (Wesley Beary)}[http://github.com/geemus]
+Copyright (c) 2009-2010 {geemus (Wesley Beary)}[http://github.com/geemus]
and {Marc-Andre Lafortune}[http://github.com/marcandre]
Permission is hereby granted, free of charge, to any person obtaining
View
2 lib/googleajax/request.rb
@@ -10,7 +10,7 @@ module Request
# Api doc is at http://code.google.com/apis/ajaxsearch/documentation/reference.html#_intro_fonje
# We use one special option (not forwarded to google): :html_method => :post will use a Post instead of a Get.
def get(api, method, query, args = nil)
- raise "You must assign a value to GoogleAjax.referer" unless referer
+ raise "You must assign a value to GoogleAjax.referrer" unless referer
args ||= {}
use_post = args.delete(:http_method) == :post
args = args.merge!('q' => query)
View
2 spec/googleajax_as_open_struct_spec.rb
@@ -7,7 +7,7 @@
it_should_behave_like "GoogleAjax"
it "returns results as an OpenStuct" do
- GoogleAjax.referer = "http://example.com"
+ GoogleAjax.referrer = "http://example.com"
response = GoogleAjax::Search.web("apple", :rsz => :large)
response.is_a? OpenStruct
response.cursor.is_a? OpenStruct
View
2 spec/googleajax_basic_spec.rb
@@ -5,7 +5,7 @@
describe "GoogleAjax (basic)" do
it "returns results as an unaltered hash" do
- GoogleAjax.referer = "http://example.com"
+ GoogleAjax.referrer = "http://example.com"
response = GoogleAjax::Search.web("apple", :rsz => :large)
response.should be_kind_of(Hash)
response['cursor'].should be_an_instance_of(Hash)
View
4 spec/googleajax_common.rb
@@ -1,14 +1,14 @@
# encoding:utf-8
shared_examples_for "GoogleAjax" do
- it "requires a referer" do
+ it "requires a referrer" do
GoogleAjax.referer = nil
lambda{GoogleAjax::Search.web("testing")}.should raise_error
end
describe "::Search" do
describe ".web" do
before :each do
- GoogleAjax.referer = "http://example.com"
+ GoogleAjax.referrer = "http://example.com"
@response = GoogleAjax::Search.web("apple", :rsz => :large)
end

0 comments on commit c9cd697

Please sign in to comment.