Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
341 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
=== 1.0.0 / 2008-05-19 | ||
=== 0.2.0 / 2009-11-17 | ||
|
||
* 1 major enhancement | ||
* New features: | ||
* results can use [] and []= for lookup and seting | ||
* allows results to be open structs (default) or hash (by requiring 'googleajax/as_hash' instead) | ||
|
||
* Birthday! | ||
* bug fixes: | ||
* Search.web(...).count now returns an int, not a string | ||
* many calls were not passing the args argument to #get | ||
* Feed.load used to return an open struct with only one method called 'feed' that was a hash. It now returns the feed correctly. | ||
|
||
* Behind the scene changes: | ||
* specs | ||
* shorter, cleaner code | ||
* links to google api doc in rdoc | ||
* most classes are now modules | ||
* small optimizations | ||
* All #get now requires arg (see bug fix) | ||
|
||
=== 0.1.0 / 2008-05-19 | ||
|
||
* Initial Release |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,46 @@ | ||
# -*- ruby -*- | ||
|
||
require 'rubygems' | ||
require 'hoe' | ||
$: << File.dirname(__FILE__) + '/lib' | ||
require './lib/googleajax.rb' | ||
require 'rake' | ||
|
||
begin | ||
require 'jeweler' | ||
Jeweler::Tasks.new do |gem| | ||
gem.name = "googleajax" | ||
gem.summary = %Q{Ruby wrapper to the Google AJAX API REST interfaces(Feeds, Language and Search).} | ||
#gem.description = %Q{TODO: longer description of your gem} | ||
gem.email = "monki@geemus.com" | ||
gem.homepage = "http://github.com/geemus/googleajax" | ||
gem.authors = ["monki(Wesley Beary)", "Marc-Andre Lafortune"] | ||
gem.add_development_dependency "rspec", ">= 1.2.9" | ||
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings | ||
gem.add_dependency 'json', '>= 1.0.0' | ||
end | ||
Jeweler::GemcutterTasks.new | ||
rescue LoadError | ||
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" | ||
end | ||
|
||
require 'spec/rake/spectask' | ||
Spec::Rake::SpecTask.new(:spec) do |spec| | ||
spec.libs << 'lib' << 'spec' | ||
spec.spec_files = FileList['spec/**/*_spec.rb'] | ||
end | ||
|
||
Hoe.new('GoogleAjax', GoogleAjax::VERSION::STRING) do |p| | ||
p.rubyforge_name = 'googleajax' | ||
p.developer('monki(Wesley Beary)', 'monki@geemus.com') | ||
p.summary = 'Ruby wrapper to the Google AJAX API REST interfaces(Feeds, Language and Search).' | ||
p.url = 'http://googleajax.rubyforge.com' | ||
p.remote_rdoc_dir = '' | ||
p.extra_deps << ['json', '>= 1.0.0'] | ||
Spec::Rake::SpecTask.new(:rcov) do |spec| | ||
spec.libs << 'lib' << 'spec' | ||
spec.pattern = 'spec/**/*_spec.rb' | ||
spec.rcov = true | ||
end | ||
|
||
# vim: syntax=Ruby | ||
task :spec => :check_dependencies | ||
|
||
task :default => :spec | ||
|
||
require 'rake/rdoctask' | ||
Rake::RDocTask.new do |rdoc| | ||
version = File.exist?('VERSION') ? File.read('VERSION') : "" | ||
|
||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = "googleajax #{version}" | ||
rdoc.rdoc_files.include('README*') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.2.0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Include this file instead of googleajax so that results are simply hashes | ||
|
||
module GoogleAjax | ||
class Base < Hash | ||
def initialize(h) | ||
super() | ||
replace(h) | ||
end | ||
|
||
def self.remap(h) | ||
end | ||
end | ||
end | ||
|
||
require 'googleajax' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module GoogleAjax | ||
class Base < OpenStruct | ||
def [](key) | ||
send(key) | ||
end | ||
|
||
def []=(key, value) | ||
send("#{key}=", value) | ||
end | ||
|
||
def self.remap(h) | ||
define_method(:initialize) do |arg| | ||
super(arg) | ||
h.each do |key, klass| | ||
case self[key] | ||
when Array | ||
self[key] = self[key].map(&klass.method(:new)) | ||
when Hash | ||
self[key] = klass.new(self[key]) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,35 @@ | ||
class GoogleAjax | ||
class Feed | ||
module GoogleAjax | ||
module Feed | ||
FEED_VERSION = 1.0 | ||
def self.get(method, query, args = {}) | ||
args = { :v => FEED_VERSION }.merge!(args) | ||
# Arguments: http://code.google.com/apis/ajaxfeeds/documentation/reference.html#_intro_fonje | ||
def self.get(method, query, args) | ||
args = { :v => FEED_VERSION }.merge(args) | ||
GoogleAjax::get(:feed, method, query, args) | ||
end | ||
|
||
# will return a list of feeds that match the given query | ||
# Arguments: http://code.google.com/apis/ajaxfeeds/documentation/reference.html#_fonje_find | ||
def self.find(query, args = {}) | ||
self.get(:find, query) | ||
self.get(:find, query, args) | ||
end | ||
|
||
# downloads this feed from Google's servers | ||
# Optional: args { :num => number of entries to download(default is 4, maximum is 100) } | ||
def self.load(query, args = {}) | ||
self.get(:load, query, args) | ||
# Arguments: http://code.google.com/apis/ajaxfeeds/documentation/reference.html#_fonje_load | ||
def self.load(url, args = {}) | ||
self.get(:load, url, args) | ||
end | ||
|
||
# will return the associated feed if it exists for a given url | ||
def self.lookup(query, args = {}) | ||
self.get(:lookup, query) | ||
# Arguments: http://code.google.com/apis/ajaxfeeds/documentation/reference.html#_intro_fonje | ||
def self.lookup(url, args = {}) | ||
self.get(:lookup, url, args) | ||
end | ||
|
||
class Entry < OpenStruct | ||
def initialize(data) | ||
super(data) | ||
end | ||
|
||
class Entry < Base | ||
end | ||
|
||
class Feed < OpenStruct | ||
def initialize(data) | ||
super(data) | ||
self.entries = entries.collect {|data| Entry.new(data)} if entries | ||
end | ||
|
||
class Feed < Base | ||
remap :entries => Entry | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.