Add a very simple example for Google Buzz API
authorYaniv Inbar <yanivi@google.com>
Thu, 6 Jan 2011 14:49:58 +0000 (14:49 +0000)
committerYaniv Inbar <yanivi@google.com>
Thu, 6 Jan 2011 14:49:58 +0000 (14:49 +0000)
git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@109 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef

examples/buzz.rb [new file with mode: 0644]
examples/sinatra/explorer.rb

diff --git a/examples/buzz.rb b/examples/buzz.rb
new file mode 100644 (file)
index 0000000..4e1dabf
--- /dev/null
@@ -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)
index cf98bdda82fec49b1c863190bc33dc5bbc2332c6..c1f03d94dc3c64e5b44d396b731da90afed72efa 100644 (file)
@@ -1,9 +1,8 @@
 #!/usr/bin/env ruby
 
-# INSTALL
-#   sudo gem install sinatra liquid
 # 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__)
 lib_dir = File.expand_path("./lib", root_dir)