lib/googlecalendar/service.rb in gcalapi-0.1.1 vs lib/googlecalendar/service.rb in gcalapi-0.1.2
- old
+ new
@@ -9,27 +9,10 @@
class Service < ServiceBase
# Server Path to authenticate
AUTH_PATH = "/accounts/ClientLogin"
- # URL to get calendar list
- CALENDAR_LIST_PATH = "http://www.google.com/calendar/feeds/"
-
- #
- # get the list of user's calendars and returns http response object
- #
- def calendar_list
- logger.info("-- calendar list st --") if logger
- auth unless @auth
- uri = URI.parse(CALENDAR_LIST_PATH + @email)
- res = do_get(uri, {})
- logger.info("-- calendar list en(#{res.message}) --") if logger
- res
- end
-
- alias :calendars :calendar_list
-
def initialize(email, pass)
@email = email
@pass = pass
@session = nil
@cookie = nil
@@ -42,10 +25,10 @@
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
head = {'Content-Type' => 'application/x-www-form-urlencoded'}
logger.info "-- auth st --" if logger
https.start do |w|
- res = w.post(AUTH_PATH, "Email=#{@email}&Passwd=#{@pass}&source=company-app-1&service=cl", head)
+ res = w.post(AUTH_PATH, "Email=#{@email}&Passwd=#{CGI.escape(@pass)}&source=company-app-1&service=cl", head)
logger.debug res if logger
if res.body =~ /Auth=(.+)/
@auth = $1
else
if logger