Skip to content

Commit 6d6f911

Browse files
committed
update readme to show how to use oauth authentication
1 parent 45585d1 commit 6d6f911

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,22 @@ GCal4Ruby has three major components: the service, calendar and event objects. E
3333
##Examples
3434
Below are some common usage examples. For more examples, check the documentation.
3535
###Service
36-
1. Authenticate
36+
1. Authenticate using client login (currently disabled)
3737
service # Service.new
38-
service.authenticate("[email protected]", "password")
38+
service.authenticate({ :username => "[email protected]", :password => "password" })
3939

40-
2. Get Calendar List
40+
41+
2. Authenticate using OAuth
42+
require 'oauth'
43+
consumer = OAuth::Consumer.new(auth[:consumer_key],
44+
auth[:consumer_secret],
45+
{:site => 'https://wwww.google.com'})
46+
access_token = OAuth::AccessToken.new(consumer, auth[:token], auth[:secret])
47+
48+
service = Service.new
49+
service.authenticate({ :access_token => access_token })
50+
51+
3. Get Calendar List
4152
calendars # service.calendars
4253

4354
###Calendar

0 commit comments

Comments
 (0)