Skip to content

Commit

Permalink
changed readme and changelog to reflect need for this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mgornick committed Feb 19, 2010
1 parent e21ab1e commit 30ba5f3
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 85 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#=CHANGELOG
#==version 0.3.1_AuthSub
#* Git repo by mgornick to implement Authsub authentication into the GCal4Ruby gem
#==version 0.3.1
#* Fixed Event.find method to work with secondary calendars and google apps accounts. Fix provided by groesser3.
#* Added max results to Calendar.find.
Expand Down
191 changes: 106 additions & 85 deletions README
Original file line number Diff line number Diff line change
@@ -1,85 +1,106 @@
#=GCal4Ruby
#
#==Introduction
#GCal4Ruby is a full featured wrapper for the google calendar API. GCal4Ruby implements
#all of the functionality available through the Google Calnedar API, including permissions,
#attendees, reminders and event recurrence.
#
#==Author and Contact Information
#GCal4Ruby was created and is maintained by {Mike Reich}[mailto:mike@seabourneconsulting.com]
#and is licenses under the GPL v2. Feel free to use and update, but be sure to contribute your
#code back to the project and attribute as required by the license.
#===Website
#http://rubyforge.org/projects/gcal4ruby/
#
#==Description
#GCal4Ruby has three major components: the service, calendar and event objects. Each service
#has many calendars, which in turn have many events. Each service is the representation of a
#google account, and thus must be successfully authenticated using valid Google Calendar
#account credentials.
#
#==Examples
#Below are some common usage examples. For more examples, check the documentation.
#===Service
#1. Authenticate
# service = Service.new
# service.authenticate("user@gmail.com", "password")
#
#2. Get Calendar List
# calendars = service.calendars
#
#===Calendar
#All usages assume a successfully authenticated Service.
#1. Create a new Calendar
# cal = Calendar.new(service)
#
#2. Find an existing Calendar
# cal = Calendar.find(service, "New Calendar", :first)
#
#3. Find all calendars containing the search term
# cal = Calendar.find(service, "Soccer Team")
#
#4. Find a calendar by ID
# cal = Calendar.find(service, id, :first)
#===Event
#All usages assume a successfully authenticated Service and valid Calendar.
#1. Create a new Event
# event = Event.new(calendar)
# event.title = "Soccer Game"
# event.start = Time.parse("12-06-2009 at 12:30 PM")
# event.end = Time.parse("12-06-2009 at 1:30 PM")
# event.where = "Merry Playfields"
# event.save
#
#2. Find an existing Event
# event = Event.find(cal, "Soccer Game", {:scope => :first})
#
#3. Find all events containing the search term
# event = Event.find(cal, "Soccer Game")
#
#4. Create a recurring event for every saturday
# event = Event.new(calendar)
# event.title = "Baseball Game"
# event.where = "Municipal Stadium"
# event.recurrence = Recurrence.new
# event.recurrence.start = Time.parse("13-06-2009 at 4:30 PM")
# event.recurrence.end = Time.parse("13-06-2009 at 6:30 PM")
# event.recurrence.frequency = {"weekly" => ["SA"]}
# event.save
#
#5. Create an event with a 15 minute email reminder
# event = Event.new(calendar)
# event.title = "Dinner with Kate"
# event.start = Time.parse("20-06-2009 at 5 pm")
# event.end = Time.parse("20-06-209 at 8 pm")
# event.where = "Luigi's"
# event.reminder = {:minutes => 15, :method => 'email'}
# event.save
#
#6. Create an event with attendees
# event = Event.new(calendar)
# event.title = "Dinner with Kate"
# event.start = Time.parse("20-06-2009 at 5 pm")
# event.end = Time.parse("20-06-209 at 8 pm")
# event.attendees => {:name => "Kate", :email => "kate@gmail.com"}
# event.save
=GCal4Ruby
==Introduction
GCal4Ruby is a full featured wrapper for the google calendar API. GCal4Ruby implements
all of the functionality available through the Google Calnedar API, including permissions,
attendees, reminders and event recurrence.

==Author and Contact Information
This branch was made by Matt Gornick (http://github.com/mgornick) to implement Google AuthSub into the original
GCal4Ruby that was created and is maintained by {Mike Reich}[mailto:mike@seabourneconsulting.com]
and is licenses under the GPL v2. Feel free to use and update, but be sure to contribute your
code back to the project and attribute as required by the license.
===Website
http://rubyforge.org/projects/gcal4ruby/

===Example Application
http://github.com/mgornick/studentplanr

==Description
GCal4Ruby has three major components: the service, calendar and event objects. Each service
has many calendars, which in turn have many events. Each service is the representation of a
google account, and thus must be successfully authenticated using valid Google Calendar
account credentials.

==Examples
Below are some common usage examples. For more examples, check the documentation.
===Service
1. Authenticate
service = Service.new
service.authenticate("user@gmail.com", "password")

2. Authenticate with Google AuthSub
# your authentication controller (example is index action in the home controller):
scope = 'http://www.google.com/calendar/feeds/'
next_url = 'http://127.0.0.1:3000/home/authenticated'
secure = false # set secure = true for signed AuthSub requests
session = true
@authsub_link = GData::Auth::AuthSub.get_url(next_url, scope, secure, session)

# in your next_url controller as defined by your AuthSub link (in example would be the authenticated action)
@token = params[:token]
client = GData::Client::Calendar.new
client.authsub_token = params[:token] # extract the single-use token from the URL query params
session[:token] = client.auth_handler.upgrade()
client.authsub_token = session[:token] if session[:token]

service= GCal4Ruby::Service.new
service.authsub_authenticate(session[:token], "user@gmail.com")

3. Get Calendar List
calendars = service.calendars

===Calendar
All usages assume a successfully authenticated Service.
1. Create a new Calendar
cal = Calendar.new(service)

2. Find an existing Calendar
cal = Calendar.find(service, "New Calendar", :first)

3. Find all calendars containing the search term
cal = Calendar.find(service, "Soccer Team")

4. Find a calendar by ID
cal = Calendar.find(service, id, :first)
===Event
All usages assume a successfully authenticated Service and valid Calendar.
1. Create a new Event
event = Event.new(calendar)
event.title = "Soccer Game"
event.start = Time.parse("12-06-2009 at 12:30 PM")
event.end = Time.parse("12-06-2009 at 1:30 PM")
event.where = "Merry Playfields"
event.save

2. Find an existing Event
event = Event.find(cal, "Soccer Game", {:scope => :first})

3. Find all events containing the search term
event = Event.find(cal, "Soccer Game")

4. Create a recurring event for every saturday
event = Event.new(calendar)
event.title = "Baseball Game"
event.where = "Municipal Stadium"
event.recurrence = Recurrence.new
event.recurrence.start = Time.parse("13-06-2009 at 4:30 PM")
event.recurrence.end = Time.parse("13-06-2009 at 6:30 PM")
event.recurrence.frequency = {"weekly" => ["SA"]}
event.save

5. Create an event with a 15 minute email reminder
event = Event.new(calendar)
event.title = "Dinner with Kate"
event.start = Time.parse("20-06-2009 at 5 pm")
event.end = Time.parse("20-06-209 at 8 pm")
event.where = "Luigi's"
event.reminder = {:minutes => 15, :method => 'email'}
event.save

6. Create an event with attendees
event = Event.new(calendar)
event.title = "Dinner with Kate"
event.start = Time.parse("20-06-2009 at 5 pm")
event.end = Time.parse("20-06-209 at 8 pm")
event.attendees => {:name => "Kate", :email => "kate@gmail.com"}
event.save

0 comments on commit 30ba5f3

Please sign in to comment.