Add a very simple example for Google Buzz API

git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@109 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef
This commit is contained in:
Yaniv Inbar 2011-01-06 14:49:58 +00:00
parent b4c37949dc
commit b9dddedc96
2 changed files with 31 additions and 3 deletions

29
examples/buzz.rb Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# RUN
# ruby examples/buzz.rb
root_dir = File.expand_path("../../..", __FILE__)
lib_dir = File.expand_path("./lib", root_dir)
$LOAD_PATH.unshift(lib_dir)
$LOAD_PATH.uniq!
require 'rubygems'
begin
require 'signet/oauth_1/client'
require 'google/api_client'
rescue LoadError
STDERR.puts "Missing dependencies."
STDERR.puts "sudo gem install signet google-api-client"
exit(1)
end
client = Google::APIClient.new(:service => 'buzz')
response = client.execute(
'chili.activities.list',
'userId' => 'googlebuzz', 'scope' => '@public', 'alt' => 'json', 'pp' => '1'
)
status, headers, body = response
puts body
exit(0)

View File

@ -1,9 +1,8 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# INSTALL
# sudo gem install sinatra liquid
# RUN # RUN
# ruby examples/sinatra/buzz_api.rb # ruby examples/sinatra/explorer.rb
# navigate a browser to http://localhost:4567/explore/buzz-v1/
root_dir = File.expand_path("../../..", __FILE__) root_dir = File.expand_path("../../..", __FILE__)
lib_dir = File.expand_path("./lib", root_dir) lib_dir = File.expand_path("./lib", root_dir)