googlecal 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +1 -1
- data/.travis.yml +4 -1
- data/README.md +5 -2
- data/bin/console +1 -0
- data/client_secret.json.enc +2 -0
- data/docs/Gemfile.html +98 -0
- data/docs/Gemfile_lock.html +187 -0
- data/docs/Googlecal.html +384 -0
- data/docs/Googlecal/Base.html +319 -0
- data/docs/Googlecal/GCalendar.html +265 -0
- data/docs/Googlecal/GEvent.html +418 -0
- data/docs/LICENSE.html +115 -0
- data/docs/Object.html +113 -0
- data/docs/README_md.html +161 -0
- data/docs/Rakefile.html +99 -0
- data/docs/bin/setup.html +99 -0
- data/docs/client_secret_json.html +96 -0
- data/docs/created.rid +19 -0
- data/docs/css/fonts.css +167 -0
- data/docs/css/rdoc.css +590 -0
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/googlecal_gemspec.html +126 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +111 -0
- data/docs/js/darkfish.js +161 -0
- data/docs/js/jquery.js +4 -0
- data/docs/js/navigation.js +142 -0
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +109 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +228 -0
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +191 -0
- data/lib/googlecal.rb +2 -157
- data/lib/googlecal/base.rb +191 -0
- data/lib/googlecal/gcalendar.rb +27 -0
- data/lib/googlecal/gevent.rb +97 -0
- data/lib/googlecal/version.rb +1 -1
- metadata +63 -1
@@ -0,0 +1,27 @@
|
|
1
|
+
# A google calendar object
|
2
|
+
module Googlecal
|
3
|
+
class GCalendar < Base
|
4
|
+
|
5
|
+
# initialize
|
6
|
+
def initialize()
|
7
|
+
end
|
8
|
+
|
9
|
+
def delete
|
10
|
+
# delete calendar
|
11
|
+
end
|
12
|
+
|
13
|
+
def update(params)
|
14
|
+
# delta update
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.find(calendar_id)
|
18
|
+
# find by goole calendar id
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def service
|
24
|
+
Base.service
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# A google calendar event object
|
2
|
+
module Googlecal
|
3
|
+
class GEvent < Googlecal::Base
|
4
|
+
attr_accessor :summary, :start_time, :end_time
|
5
|
+
# TODO: make it so that the event is tied to a calendar id and only use that
|
6
|
+
# to update, create, delete
|
7
|
+
# TODO: create a relationship between an instance of GEvent and a GCalendar
|
8
|
+
|
9
|
+
# initialize with a google event instance
|
10
|
+
def initialize(event = nil)
|
11
|
+
@event = event
|
12
|
+
end
|
13
|
+
|
14
|
+
def id
|
15
|
+
@event.id
|
16
|
+
end
|
17
|
+
|
18
|
+
def summary
|
19
|
+
@event.summary
|
20
|
+
end
|
21
|
+
|
22
|
+
def summary=(value)
|
23
|
+
@event.summary = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def start_time
|
27
|
+
@event.start.date_time
|
28
|
+
end
|
29
|
+
|
30
|
+
def start_time=(value)
|
31
|
+
# set it to iso8601
|
32
|
+
@event.start.date_time = value.iso8601
|
33
|
+
end
|
34
|
+
|
35
|
+
def end_time
|
36
|
+
@event.end.date_time
|
37
|
+
end
|
38
|
+
|
39
|
+
def end_time=(value)
|
40
|
+
@event.end.date_time = value.iso8601
|
41
|
+
end
|
42
|
+
|
43
|
+
def status
|
44
|
+
@event.status
|
45
|
+
end
|
46
|
+
|
47
|
+
def save
|
48
|
+
update(start: { date_time: start_time }, end: { date_time: end_time })
|
49
|
+
end
|
50
|
+
|
51
|
+
# create and save a new event through googles api
|
52
|
+
def self.create(event_params, calendar_id = Base.calendar_id)
|
53
|
+
# event creation
|
54
|
+
event = service.insert_event(calendar_id, Google::Apis::CalendarV3::Event.new(event_params))
|
55
|
+
if event
|
56
|
+
return GEvent.new(event)
|
57
|
+
else
|
58
|
+
return false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# delete event by event.id in googles api
|
63
|
+
# DELETES EVENT
|
64
|
+
def delete(calendar_id = Base.calendar_id)
|
65
|
+
# delete instance of event
|
66
|
+
# update event instance
|
67
|
+
@event = service.delete_event(calendar_id, id)
|
68
|
+
return true
|
69
|
+
end
|
70
|
+
|
71
|
+
# update google calendar event by event.id
|
72
|
+
def update(params, calendar_id = Base.calendar_id)
|
73
|
+
# delta update
|
74
|
+
# TODO: update calendar event
|
75
|
+
service.update_event(calendar_id, id, @event)
|
76
|
+
end
|
77
|
+
|
78
|
+
# find google calendar event by event_id
|
79
|
+
# +:event_id:+ - Unique event id given by google cal api
|
80
|
+
def self.find(event_id, calendar_id = Base.calendar_id)
|
81
|
+
# find by google event id
|
82
|
+
begin
|
83
|
+
event = service.get_event(calendar_id, event_id)
|
84
|
+
return event
|
85
|
+
catch e
|
86
|
+
return nil
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
# control access to parent classes static instance to googlapi service
|
93
|
+
def service
|
94
|
+
Googlecal::Base.service
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
data/lib/googlecal/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googlecal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin M Crane
|
@@ -97,8 +97,70 @@ files:
|
|
97
97
|
- Rakefile
|
98
98
|
- bin/console
|
99
99
|
- bin/setup
|
100
|
+
- client_secret.json.enc
|
101
|
+
- docs/Gemfile.html
|
102
|
+
- docs/Gemfile_lock.html
|
103
|
+
- docs/Googlecal.html
|
104
|
+
- docs/Googlecal/Base.html
|
105
|
+
- docs/Googlecal/GCalendar.html
|
106
|
+
- docs/Googlecal/GEvent.html
|
107
|
+
- docs/LICENSE.html
|
108
|
+
- docs/Object.html
|
109
|
+
- docs/README_md.html
|
110
|
+
- docs/Rakefile.html
|
111
|
+
- docs/bin/setup.html
|
112
|
+
- docs/client_secret_json.html
|
113
|
+
- docs/created.rid
|
114
|
+
- docs/css/fonts.css
|
115
|
+
- docs/css/rdoc.css
|
116
|
+
- docs/fonts/Lato-Light.ttf
|
117
|
+
- docs/fonts/Lato-LightItalic.ttf
|
118
|
+
- docs/fonts/Lato-Regular.ttf
|
119
|
+
- docs/fonts/Lato-RegularItalic.ttf
|
120
|
+
- docs/fonts/SourceCodePro-Bold.ttf
|
121
|
+
- docs/fonts/SourceCodePro-Regular.ttf
|
122
|
+
- docs/googlecal_gemspec.html
|
123
|
+
- docs/images/add.png
|
124
|
+
- docs/images/arrow_up.png
|
125
|
+
- docs/images/brick.png
|
126
|
+
- docs/images/brick_link.png
|
127
|
+
- docs/images/bug.png
|
128
|
+
- docs/images/bullet_black.png
|
129
|
+
- docs/images/bullet_toggle_minus.png
|
130
|
+
- docs/images/bullet_toggle_plus.png
|
131
|
+
- docs/images/date.png
|
132
|
+
- docs/images/delete.png
|
133
|
+
- docs/images/find.png
|
134
|
+
- docs/images/loadingAnimation.gif
|
135
|
+
- docs/images/macFFBgHack.png
|
136
|
+
- docs/images/package.png
|
137
|
+
- docs/images/page_green.png
|
138
|
+
- docs/images/page_white_text.png
|
139
|
+
- docs/images/page_white_width.png
|
140
|
+
- docs/images/plugin.png
|
141
|
+
- docs/images/ruby.png
|
142
|
+
- docs/images/tag_blue.png
|
143
|
+
- docs/images/tag_green.png
|
144
|
+
- docs/images/transparent.png
|
145
|
+
- docs/images/wrench.png
|
146
|
+
- docs/images/wrench_orange.png
|
147
|
+
- docs/images/zoom.png
|
148
|
+
- docs/index.html
|
149
|
+
- docs/js/darkfish.js
|
150
|
+
- docs/js/jquery.js
|
151
|
+
- docs/js/navigation.js
|
152
|
+
- docs/js/navigation.js.gz
|
153
|
+
- docs/js/search.js
|
154
|
+
- docs/js/search_index.js
|
155
|
+
- docs/js/search_index.js.gz
|
156
|
+
- docs/js/searcher.js
|
157
|
+
- docs/js/searcher.js.gz
|
158
|
+
- docs/table_of_contents.html
|
100
159
|
- googlecal.gemspec
|
101
160
|
- lib/googlecal.rb
|
161
|
+
- lib/googlecal/base.rb
|
162
|
+
- lib/googlecal/gcalendar.rb
|
163
|
+
- lib/googlecal/gevent.rb
|
102
164
|
- lib/googlecal/version.rb
|
103
165
|
homepage: http://github.com
|
104
166
|
licenses: []
|