googlecalendar 0.0.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ require 'net/http'
2
+ require 'net/https'
3
+
4
+ #
5
+ # Make it east to use some of the convenience methods using https
6
+ #
7
+ module Net
8
+ class HTTPS < HTTP
9
+ def initialize(address, port = nil)
10
+ super(address, port)
11
+ self.use_ssl = true
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module Googlecalendar
2
+ module VERSION #:nodoc:
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ TINY = 0
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ self
9
+ end
10
+ end
@@ -0,0 +1,85 @@
1
+ # require File.dirname(__FILE__) + '/googlecalendar'
2
+
3
+ module Googlecalendar
4
+ class TextBuilder
5
+ attr_accessor :calendar, :filename
6
+
7
+ def export
8
+ begin
9
+ File.delete(@filename)
10
+ rescue
11
+ # if doesn't exist
12
+ end
13
+ File.open(@filename, File::CREAT|File::RDWR) do |file|
14
+ file << calendar.to_s
15
+ end
16
+ end
17
+ end # class TextBuilder
18
+ end # module Googlecalendar
19
+
20
+ module Googlecalendar
21
+ class HtmlBuilder
22
+ attr_accessor :calendar, :filename, :date_format
23
+
24
+ def export
25
+ begin
26
+ File.delete(@filename)
27
+ rescue
28
+ # if doesn't exist
29
+ end
30
+ File.open(@filename, File::CREAT|File::RDWR) do |file|
31
+ file << "<html><head>\n"
32
+ file << "<title>Calendar</tilte>\n"
33
+ IO.foreach("../../html/styles.css") { |line| file << line }
34
+ file << "\n"
35
+ IO.foreach("../../html/scripts.js") { |line| file << line }
36
+ file << "\n</head>\n<body>"
37
+ file << summary
38
+ event_number = 0
39
+ @calendar.events.each do |event|
40
+ file << "<p class=\"event\">"
41
+ file << "<h2>Event [" + event.start_date.to_s + "]</h2>"
42
+ file << "<div><b>From: </b>" + event.start_date.to_s + "<b> -&gt; To:</b> " + event.end_date.to_s + "</div>"
43
+ file << div(event, 'summary')
44
+ file << details(event, event_number)
45
+ file << "</p>\n"
46
+ event_number += 1
47
+ end
48
+ file << "</body></html>"
49
+ end
50
+ end
51
+
52
+ def format(date)
53
+ Date.strptime(date, @date_format)
54
+ end
55
+
56
+ def summary
57
+ data = "<p class=\"calendar\">"
58
+ data << "<h1>Calendar</h1>"
59
+ data << div(@calendar, 'version')
60
+ data << div(@calendar, 'scale')
61
+ data << div(@calendar, 'method')
62
+ data << "<div><b>number of events: </b>" + @calendar.events.size.to_s + "</div>"
63
+ data << "</p>\n"
64
+ return data
65
+ end
66
+
67
+ def details(event, number)
68
+ details = "<a href=\"javascript:displayHideSection('details" + number.to_s + "');\">Display details</a>"
69
+ details << "<div id=\"details" + number.to_s + "\" class=\"details\">"
70
+ details << div(event, 'start_date')
71
+ details << div(event, 'end_date')
72
+ details << div(event, 'time_stamp')
73
+ details << div(event, 'created')
74
+ details << div(event, 'last_modified')
75
+ details << div(event, 'status')
76
+ details << div(event, 'rrule')
77
+ details << div(event, 'class_name')
78
+ details << "</div>"
79
+ end
80
+
81
+ def div(object, field)
82
+ "<div><b>" + field.capitalize + ": </b>" + object.send(field).to_s + "</div>\n"
83
+ end
84
+ end # class HtmlBuilder
85
+ end # module module Googlecalendar
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class EventTest < Test::Unit::TestCase
4
+ def test_rrule_as_hash
5
+ e = Event.new
6
+ e.rrule = 'FREQ=WEEKLY;BYDAY=MO;WKST=MO'
7
+ values = e.rrule_as_hash
8
+ assert_equal 'WEEKLY', values['FREQ']
9
+ assert_equal 'MO', values['BYDAY']
10
+ assert_equal 'MO', values['WKST']
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestGooglecalendar < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/googlecalendar'
3
+ require File.dirname(__FILE__) + '/../lib/googlecalendar_builders'
4
+ include Googlecalendar
data/test/test_ical.rb ADDED
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class ICALParserTest < Test::Unit::TestCase
4
+ def test_parse
5
+ parser = ICALParser.new
6
+ path = File.dirname(__FILE__) + '/ical_sample.ics'
7
+ File.open(path, 'r') do |f|
8
+ calendar = parser.parse(f.read)
9
+ assert_equal '2.0', calendar.version
10
+ assert_equal '', calendar.scale
11
+ assert_equal '', calendar.method
12
+ assert_equal '', calendar.product_id
13
+ # events = calendar.events
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,49 +1,104 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: googlecalendar
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.0.6
7
- date: 2007-12-03 00:00:00 +01:00
8
- summary: Google Calendar api for Ruby
9
- require_paths:
10
- - lib
11
- email: cogito@rubyforge.org
12
- homepage: http://benjamin.francisoud.googlepages.com/googlecalendar
13
- rubyforge_project: googlecalendar
14
- description: "The Google Calendar project provides: Export features (text file, simple html page), Ruby api's to connect to google calendars, A plugin for Ruby On Rails."
15
- autorequire: googlecalendar
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.0.0
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Benjamin Francisoud
31
- files:
32
- - README
33
- - CHANGELOG
34
- - lib/builders.rb
35
- - lib/googlecalendar.rb
36
- test_files: []
37
-
38
- rdoc_options: []
39
-
40
- extra_rdoc_files: []
41
-
42
- executables: []
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
43
11
 
12
+ date: 2009-03-05 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.0
24
+ version:
25
+ description: description of gem
26
+ email:
27
+ - ruby.francisoud@gmail.com
28
+ executables:
29
+ - googlecalendar4ruby
44
30
  extensions: []
45
31
 
32
+ extra_rdoc_files:
33
+ - History.txt
34
+ - Manifest.txt
35
+ - PostInstall.txt
36
+ - README.rdoc
37
+ - README.txt
38
+ files:
39
+ - History.txt
40
+ - Manifest.txt
41
+ - PostInstall.txt
42
+ - README.rdoc
43
+ - README.txt
44
+ - Rakefile
45
+ - bin/googlecalendar4ruby
46
+ - html/scripts.js
47
+ - html/styles.css
48
+ - lib/builders.rb
49
+ - lib/googlecalendar.rb
50
+ - lib/googlecalendar/calendar.rb
51
+ - lib/googlecalendar/dsl.rb
52
+ - lib/googlecalendar/event.rb
53
+ - lib/googlecalendar/gcalendar.rb
54
+ - lib/googlecalendar/gdata.rb
55
+ - lib/googlecalendar/ical.rb
56
+ - lib/googlecalendar/net.rb
57
+ - lib/googlecalendar/version.rb
58
+ - lib/googlecalendar_builders.rb
59
+ has_rdoc: true
60
+ homepage: http://googlecalendar.rubyforge.org
61
+ post_install_message: |+
62
+ Thanks a lot for installing googlecalendar for ruby ;)
63
+
64
+ If you are migrating from version 0.0.x to 1.0.0, you will need to add:
65
+
66
+ require 'googlecalendar'
67
+ ** include Googlecalendar **
68
+
69
+ If you where using the 'builders' with:
70
+ require 'builders' # DEPRECATED
71
+ is replaced by
72
+ require 'googlecalendar_builders'
73
+
74
+ For more information on googlecalendar, see http://googlecalendar.rubyforge.org
75
+
76
+ rdoc_options:
77
+ - --main
78
+ - README.rdoc
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
86
+ version:
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
92
+ version:
46
93
  requirements: []
47
94
 
48
- dependencies: []
49
-
95
+ rubyforge_project: googlecalendar
96
+ rubygems_version: 1.3.1
97
+ signing_key:
98
+ specification_version: 2
99
+ summary: description of gem
100
+ test_files:
101
+ - test/test_helper.rb
102
+ - test/test_googlecalendar.rb
103
+ - test/test_ical.rb
104
+ - test/test_event.rb
data/README DELETED
@@ -1,14 +0,0 @@
1
- == Google Calendar
2
- The Google Calendar project provides
3
- * Export features (text file, simple html page or excel files),
4
- * Ruby api's to connect to google calendars
5
- * A plugin for Ruby On Rails.
6
-
7
- == License
8
- GoogleCalendar for Ruby is released under the Apache license.
9
-
10
- == Support
11
- http://rubyforge.org/projects/googlecalendar/
12
-
13
- == Author
14
- Benjamin Francisoud - http://rubyscube.blogspot.com