gcalapi 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/Rakefile +1 -1
  2. data/VERSION +1 -1
  3. data/html/classes/GoogleCalendar.html +149 -149
  4. data/html/classes/GoogleCalendar/AuthSubFailed.html +162 -162
  5. data/html/classes/GoogleCalendar/AuthSubUtil.html +352 -352
  6. data/html/classes/GoogleCalendar/AuthenticationFailed.html +110 -110
  7. data/html/classes/GoogleCalendar/Calendar.html +381 -381
  8. data/html/classes/GoogleCalendar/Event.html +699 -699
  9. data/html/classes/GoogleCalendar/EventDeleteFailed.html +110 -110
  10. data/html/classes/GoogleCalendar/EventGetFailed.html +110 -110
  11. data/html/classes/GoogleCalendar/EventInsertFailed.html +110 -110
  12. data/html/classes/GoogleCalendar/EventUpdateFailed.html +110 -110
  13. data/html/classes/GoogleCalendar/InvalidCalendarURL.html +110 -110
  14. data/html/classes/GoogleCalendar/Service.html +245 -305
  15. data/html/classes/GoogleCalendar/ServiceAuthSub.html +176 -176
  16. data/html/classes/GoogleCalendar/ServiceBase.html +752 -693
  17. data/html/created.rid +1 -1
  18. data/html/files/README.html +117 -117
  19. data/html/files/lib/googlecalendar/auth_sub_util_rb.html +110 -110
  20. data/html/files/lib/googlecalendar/calendar_rb.html +109 -109
  21. data/html/files/lib/googlecalendar/event_rb.html +109 -109
  22. data/html/files/lib/googlecalendar/service_auth_sub_rb.html +107 -107
  23. data/html/files/lib/googlecalendar/service_base_rb.html +113 -113
  24. data/html/files/lib/googlecalendar/service_rb.html +107 -107
  25. data/html/fr_class_index.html +39 -39
  26. data/html/fr_file_index.html +32 -32
  27. data/html/fr_method_index.html +75 -75
  28. data/html/index.html +23 -23
  29. data/html/rdoc-style.css +207 -207
  30. data/lib/googlecalendar/service.rb +1 -18
  31. data/lib/googlecalendar/service_base.rb +17 -0
  32. data/test/03_authsub_test.rb +14 -2
  33. data/test/all.bat +1 -0
  34. data/test/all.sh +0 -0
  35. data/test/each.sh +0 -0
  36. metadata +47 -70
  37. data/VERSION.BAK +0 -1
@@ -11,23 +11,6 @@ module GoogleCalendar
11
11
  # Server Path to authenticate
12
12
  AUTH_PATH = "/accounts/ClientLogin"
13
13
 
14
- # URL to get calendar list
15
- CALENDAR_LIST_PATH = "http://www.google.com/calendar/feeds/"
16
-
17
- #
18
- # get the list of user's calendars and returns http response object
19
- #
20
- def calendar_list
21
- logger.info("-- calendar list st --") if logger
22
- auth unless @auth
23
- uri = URI.parse(CALENDAR_LIST_PATH + @email)
24
- res = do_get(uri, {})
25
- logger.info("-- calendar list en(#{res.message}) --") if logger
26
- res
27
- end
28
-
29
- alias :calendars :calendar_list
30
-
31
14
  def initialize(email, pass)
32
15
  @email = email
33
16
  @pass = pass
@@ -44,7 +27,7 @@ module GoogleCalendar
44
27
  head = {'Content-Type' => 'application/x-www-form-urlencoded'}
45
28
  logger.info "-- auth st --" if logger
46
29
  https.start do |w|
47
- res = w.post(AUTH_PATH, "Email=#{@email}&Passwd=#{@pass}&source=company-app-1&service=cl", head)
30
+ res = w.post(AUTH_PATH, "Email=#{@email}&Passwd=#{CGI.escape(@pass)}&source=company-app-1&service=cl", head)
48
31
  logger.debug res if logger
49
32
  if res.body =~ /Auth=(.+)/
50
33
  @auth = $1
@@ -19,6 +19,9 @@ module GoogleCalendar
19
19
  # Server name to Authenticate
20
20
  AUTH_SERVER = "www.google.com"
21
21
 
22
+ # URL to get calendar list
23
+ CALENDAR_LIST_PATH = "http://www.google.com/calendar/feeds/default/allcalendars/full"
24
+
22
25
  # proxy server address
23
26
  @@proxy_addr = nil
24
27
  def self.proxy_addr
@@ -61,6 +64,20 @@ module GoogleCalendar
61
64
 
62
65
  attr_accessor :logger
63
66
 
67
+ #
68
+ # get the list of user's calendars and returns http response object
69
+ #
70
+ def calendar_list
71
+ logger.info("-- calendar list st --") if logger
72
+ auth unless @auth
73
+ uri = URI.parse(CALENDAR_LIST_PATH)
74
+ res = do_get(uri, {})
75
+ logger.info("-- calendar list en(#{res.message}) --") if logger
76
+ res
77
+ end
78
+
79
+ alias :calendars :calendar_list
80
+
64
81
  #
65
82
  # send query for events of a calendar and returns http response object.
66
83
  # available condtions are
@@ -8,7 +8,7 @@ require "googlecalendar/service_auth_sub"
8
8
  require "googlecalendar/auth_sub_util"
9
9
 
10
10
  class TestService3 < Test::Unit::TestCase
11
- SAMPLE_URL = "http://www.example.com/sample.html"
11
+ SAMPLE_URL = "http://zoriolab.info/test.html"
12
12
  attr_accessor :logger
13
13
  # get one-time token
14
14
  def test_get_onetime_token(use_session = false)
@@ -100,11 +100,12 @@ class TestService3 < Test::Unit::TestCase
100
100
  end
101
101
 
102
102
  def test_session_info
103
+ uri = URI.parse(SAMPLE_URL)
103
104
  test_use_session_token do |token, session|
104
105
  ret = GoogleCalendar::AuthSubUtil.token_info(token)
105
106
  expected = {"Secure" => "false",
106
107
  "Scope" => GoogleCalendar::AuthSubUtil::CALENDAR_SCOPE,
107
- "Target" => "www.example.com"}
108
+ "Target" => uri.host}
108
109
  expected.each do |k,v|
109
110
  assert(ret.key?(k))
110
111
  assert_equal(v, ret[k]) if ret.key?(k)
@@ -112,6 +113,17 @@ class TestService3 < Test::Unit::TestCase
112
113
  end
113
114
  end
114
115
 
116
+ def test_calendar_list
117
+ test_use_session_token do |token, srv|
118
+ ret = srv.calendar_list
119
+ assert_equal("200", ret.code, ret.body)
120
+ xml = nil
121
+ assert_nothing_raised { xml = REXML::Document.new(ret.body) }
122
+ list = xml.root.elements.each("entry/link") {}.map {|e| e.attributes["href"] if e.attributes["rel"] == "alternate"}.compact
123
+ assert(list.include?(FEED.gsub(/@/,"%40")))
124
+ end
125
+ end
126
+
115
127
  def test_ensure_revoked
116
128
  10.times do |n|
117
129
  test_use_session_token do |token, srv|
@@ -0,0 +1 @@
1
+ ruby -e "Dir.foreach('.') {|file| require file if file =~ /_test.rb$/}"
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcalapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - zorio
@@ -9,7 +9,7 @@ autorequire: googlecalendar/calendar
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-23 00:00:00 +09:00
12
+ date: 2009-01-11 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,88 +22,65 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README
24
24
  files:
25
- - doc
26
- - doc/classes
27
- - doc/classes/CalendarTest.src
28
- - doc/classes/GoogleCalendar
29
- - doc/classes/GoogleCalendar/AuthSubFailed.src
30
- - doc/classes/GoogleCalendar/AuthSubUtil.src
31
- - doc/classes/GoogleCalendar/Calendar.src
32
- - doc/classes/GoogleCalendar/Event.src
33
- - doc/classes/GoogleCalendar/Service.src
34
- - doc/classes/GoogleCalendar/ServiceAuthSub.src
35
- - doc/classes/GoogleCalendar/ServiceBase.src
36
- - doc/classes/GoogleCalendar.src
37
- - doc/classes/Mail.src
38
- - doc/classes/TestCalendar1.src
39
- - doc/classes/TestCalendar2.src
40
- - doc/classes/TestService0.src
41
- - doc/classes/TestService3.src
42
- - doc/files
43
- - doc/files/example
44
- - doc/files/example/ol2gcal_rb.src
45
- - doc/files/lib
46
- - doc/files/lib/googlecalendar
47
- - doc/files/test
48
- - example
49
- - example/mail2gcal.rb
50
- - example/mixi2gcal.rb
51
- - example/ol2gcal.rb
25
+ - lib
26
+ - lib/gcalapi.rb
27
+ - lib/googlecalendar
28
+ - lib/googlecalendar/event.rb
29
+ - lib/googlecalendar/service.rb
30
+ - lib/googlecalendar/auth_sub_util.rb
31
+ - lib/googlecalendar/service_auth_sub.rb
32
+ - lib/googlecalendar/calendar.rb
33
+ - lib/googlecalendar/service_base.rb
34
+ - test
35
+ - test/all.sh
36
+ - test/02_event_test.rb
37
+ - test/each.sh
38
+ - test/03_authsub_test.rb
39
+ - test/template.parameters.rb
40
+ - test/base_unit.rb
41
+ - test/all.bat
42
+ - test/00_service_test.rb
43
+ - test/01_calendar_test.rb
44
+ - VERSION
52
45
  - html
53
46
  - html/classes
47
+ - html/classes/GoogleCalendar.html
54
48
  - html/classes/GoogleCalendar
55
- - html/classes/GoogleCalendar/AuthenticationFailed.html
56
- - html/classes/GoogleCalendar/AuthSubFailed.html
57
49
  - html/classes/GoogleCalendar/AuthSubUtil.html
58
- - html/classes/GoogleCalendar/Calendar.html
59
- - html/classes/GoogleCalendar/Event.html
60
- - html/classes/GoogleCalendar/EventDeleteFailed.html
50
+ - html/classes/GoogleCalendar/Service.html
61
51
  - html/classes/GoogleCalendar/EventGetFailed.html
52
+ - html/classes/GoogleCalendar/EventDeleteFailed.html
62
53
  - html/classes/GoogleCalendar/EventInsertFailed.html
63
- - html/classes/GoogleCalendar/EventUpdateFailed.html
54
+ - html/classes/GoogleCalendar/ServiceBase.html
64
55
  - html/classes/GoogleCalendar/InvalidCalendarURL.html
65
- - html/classes/GoogleCalendar/Service.html
66
56
  - html/classes/GoogleCalendar/ServiceAuthSub.html
67
- - html/classes/GoogleCalendar/ServiceBase.html
68
- - html/classes/GoogleCalendar.html
69
- - html/created.rid
57
+ - html/classes/GoogleCalendar/EventUpdateFailed.html
58
+ - html/classes/GoogleCalendar/AuthSubFailed.html
59
+ - html/classes/GoogleCalendar/AuthenticationFailed.html
60
+ - html/classes/GoogleCalendar/Calendar.html
61
+ - html/classes/GoogleCalendar/Event.html
70
62
  - html/files
63
+ - html/files/README.html
71
64
  - html/files/lib
72
65
  - html/files/lib/googlecalendar
73
- - html/files/lib/googlecalendar/auth_sub_util_rb.html
74
- - html/files/lib/googlecalendar/calendar_rb.html
75
66
  - html/files/lib/googlecalendar/event_rb.html
76
- - html/files/lib/googlecalendar/service_auth_sub_rb.html
77
- - html/files/lib/googlecalendar/service_base_rb.html
78
67
  - html/files/lib/googlecalendar/service_rb.html
79
- - html/files/README.html
80
- - html/fr_class_index.html
68
+ - html/files/lib/googlecalendar/service_base_rb.html
69
+ - html/files/lib/googlecalendar/calendar_rb.html
70
+ - html/files/lib/googlecalendar/auth_sub_util_rb.html
71
+ - html/files/lib/googlecalendar/service_auth_sub_rb.html
81
72
  - html/fr_file_index.html
73
+ - html/created.rid
74
+ - html/rdoc-style.css
82
75
  - html/fr_method_index.html
83
76
  - html/index.html
84
- - html/rdoc-style.css
85
- - lib
86
- - lib/gcalapi.rb
87
- - lib/googlecalendar
88
- - lib/googlecalendar/auth_sub_util.rb
89
- - lib/googlecalendar/calendar.rb
90
- - lib/googlecalendar/event.rb
91
- - lib/googlecalendar/service.rb
92
- - lib/googlecalendar/service_auth_sub.rb
93
- - lib/googlecalendar/service_base.rb
94
- - Rakefile
77
+ - html/fr_class_index.html
78
+ - example
79
+ - example/ol2gcal.rb
80
+ - example/mail2gcal.rb
81
+ - example/mixi2gcal.rb
95
82
  - README
96
- - test
97
- - test/00_service_test.rb
98
- - test/01_calendar_test.rb
99
- - test/02_event_test.rb
100
- - test/03_authsub_test.rb
101
- - test/all.sh
102
- - test/base_unit.rb
103
- - test/each.sh
104
- - test/template.parameters.rb
105
- - VERSION
106
- - VERSION.BAK
83
+ - Rakefile
107
84
  has_rdoc: true
108
85
  homepage: http://gcalapi.rubyforge.net
109
86
  post_install_message:
@@ -127,12 +104,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
104
  requirements: []
128
105
 
129
106
  rubyforge_project: gcalapi
130
- rubygems_version: 1.0.1
107
+ rubygems_version: 1.3.1
131
108
  signing_key:
132
109
  specification_version: 2
133
110
  summary: Google Calendar API
134
111
  test_files:
135
- - test/00_service_test.rb
136
- - test/01_calendar_test.rb
137
112
  - test/02_event_test.rb
138
113
  - test/03_authsub_test.rb
114
+ - test/00_service_test.rb
115
+ - test/01_calendar_test.rb
@@ -1 +0,0 @@
1
- 0.1.0