google_calendar 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -2
- data/Gemfile.lock +19 -18
- data/google_calendar.gemspec +3 -4
- data/lib/google/calendar.rb +21 -28
- data/lib/google/calendar_list.rb +1 -6
- data/lib/google/connection.rb +14 -0
- data/lib/google/event.rb +44 -31
- data/lib/google/freebusy.rb +1 -6
- data/test/test_google_calendar.rb +20 -4
- metadata +34 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5765e4af32f165812e2f4c5695d64194d878d8ab
|
4
|
+
data.tar.gz: 8ce7b24934013498cd334712e68e8d8db1657cd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 152af16e310b75cde02e620c59bb5757a953ad2ea2cb19e3b73da372af1ec63dd58b7a6dea85e6dc5963bc57b28c45a96cb46bf186ca9ef89a45b6b2dcf885f0
|
7
|
+
data.tar.gz: 23973dcf20a9a1d86470069a72f9a3d6e1be85aa17528327dfe763bf1052637911b20a39e6b698c0d9284bf0a2bacf39f5bd71be69f98d1ed2331ca0d61e6598
|
data/.travis.yml
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
3
|
- "1.9.3"
|
4
|
-
- "2.0
|
5
|
-
- "2.1
|
4
|
+
- "2.0"
|
5
|
+
- "2.1"
|
6
|
+
- "2.2"
|
7
|
+
- "2.3.0"
|
8
|
+
before_install:
|
9
|
+
- gem install bundler
|
6
10
|
# uncomment this line if your project needs to run something other than `rake`:
|
7
11
|
# script: bundle exec rspec spec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
google_calendar (0.5.
|
4
|
+
google_calendar (0.5.2)
|
5
5
|
TimezoneParser (~> 0.2.0)
|
6
6
|
json (~> 1.8)
|
7
7
|
signet (~> 0.6)
|
@@ -12,47 +12,45 @@ GEM
|
|
12
12
|
TimezoneParser (0.2.0)
|
13
13
|
insensitive_hash
|
14
14
|
tzinfo
|
15
|
-
addressable (2.
|
15
|
+
addressable (2.4.0)
|
16
16
|
ansi (1.5.0)
|
17
17
|
builder (3.2.2)
|
18
|
-
codeclimate-test-reporter (0.
|
18
|
+
codeclimate-test-reporter (0.5.0)
|
19
19
|
simplecov (>= 0.7.1, < 1.0.0)
|
20
20
|
docile (1.1.5)
|
21
|
-
|
22
|
-
faraday (0.9.1)
|
21
|
+
faraday (0.9.2)
|
23
22
|
multipart-post (>= 1.2, < 3)
|
24
23
|
insensitive_hash (0.3.3)
|
25
24
|
json (1.8.3)
|
26
|
-
jwt (1.5.
|
25
|
+
jwt (1.5.4)
|
27
26
|
metaclass (0.0.4)
|
28
|
-
minitest (5.
|
29
|
-
minitest-reporters (1.1.
|
27
|
+
minitest (5.9.0)
|
28
|
+
minitest-reporters (1.1.9)
|
30
29
|
ansi
|
31
30
|
builder
|
32
31
|
minitest (>= 5.0)
|
33
32
|
ruby-progressbar
|
34
33
|
mocha (1.1.0)
|
35
34
|
metaclass (~> 0.0.1)
|
36
|
-
multi_json (1.
|
35
|
+
multi_json (1.12.1)
|
37
36
|
multipart-post (2.0.0)
|
38
|
-
rake (
|
39
|
-
rb-fsevent (0.9.
|
40
|
-
rdoc (4.2.
|
37
|
+
rake (11.2.2)
|
38
|
+
rb-fsevent (0.9.7)
|
39
|
+
rdoc (4.2.2)
|
41
40
|
json (~> 1.4)
|
42
|
-
ruby-progressbar (1.
|
41
|
+
ruby-progressbar (1.8.1)
|
43
42
|
shoulda-context (1.2.1)
|
44
|
-
signet (0.
|
43
|
+
signet (0.7.2)
|
45
44
|
addressable (~> 2.3)
|
46
|
-
extlib (~> 0.9)
|
47
45
|
faraday (~> 0.9)
|
48
46
|
jwt (~> 1.5)
|
49
47
|
multi_json (~> 1.10)
|
50
|
-
simplecov (0.
|
48
|
+
simplecov (0.11.2)
|
51
49
|
docile (~> 1.1.0)
|
52
50
|
json (~> 1.8)
|
53
51
|
simplecov-html (~> 0.10.0)
|
54
52
|
simplecov-html (0.10.0)
|
55
|
-
terminal-notifier-guard (1.
|
53
|
+
terminal-notifier-guard (1.7.0)
|
56
54
|
thread_safe (0.3.5)
|
57
55
|
tzinfo (1.2.2)
|
58
56
|
thread_safe (~> 0.1)
|
@@ -67,8 +65,11 @@ DEPENDENCIES
|
|
67
65
|
minitest (~> 5.1)
|
68
66
|
minitest-reporters (~> 1.0)
|
69
67
|
mocha (~> 1.1)
|
70
|
-
rake (~>
|
68
|
+
rake (~> 11)
|
71
69
|
rb-fsevent (~> 0.9)
|
72
70
|
rdoc (~> 4.1)
|
73
71
|
shoulda-context (~> 1.2)
|
74
72
|
terminal-notifier-guard (~> 1.6)
|
73
|
+
|
74
|
+
BUNDLED WITH
|
75
|
+
1.12.4
|
data/google_calendar.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "google_calendar"
|
5
|
-
s.version = "0.5.
|
6
|
-
s.date = "
|
5
|
+
s.version = "0.5.2"
|
6
|
+
s.date = "2016-06-13"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
|
@@ -32,13 +32,12 @@ Gem::Specification.new do |s|
|
|
32
32
|
|
33
33
|
s.add_development_dependency(%q<terminal-notifier-guard>, ["~> 1.6"])
|
34
34
|
s.add_development_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
35
|
-
# s.add_development_dependency(%q<guard-minitest>, ["~> 2.3"])
|
36
35
|
s.add_development_dependency(%q<minitest>, ["~> 5.1"])
|
37
36
|
s.add_development_dependency(%q<minitest-reporters>, ["~> 1.0"])
|
38
37
|
s.add_development_dependency(%q<shoulda-context>, ["~> 1.2"])
|
39
38
|
s.add_development_dependency(%q<bundler>, [">= 1.2"])
|
40
39
|
s.add_development_dependency(%q<mocha>, ["~> 1.1"])
|
41
|
-
s.add_development_dependency(%q<rake>, ["~>
|
40
|
+
s.add_development_dependency(%q<rake>, ["~> 11"])
|
42
41
|
s.add_development_dependency(%q<rdoc>, ["~> 4.1"])
|
43
42
|
|
44
43
|
end
|
data/lib/google/calendar.rb
CHANGED
@@ -27,16 +27,8 @@ module Google
|
|
27
27
|
# )
|
28
28
|
#
|
29
29
|
def initialize(params={}, connection=nil)
|
30
|
-
@connection = connection || Connection.
|
31
|
-
:client_id => params[:client_id],
|
32
|
-
:client_secret => params[:client_secret],
|
33
|
-
:refresh_token => params[:refresh_token],
|
34
|
-
:redirect_url => params[:redirect_url],
|
35
|
-
:state => params[:state]
|
36
|
-
)
|
37
|
-
|
30
|
+
@connection = connection || Connection.factory(params)
|
38
31
|
@id = params[:calendar]
|
39
|
-
# raise CalendarIDMissing unless @id
|
40
32
|
end
|
41
33
|
|
42
34
|
#
|
@@ -207,15 +199,7 @@ module Google
|
|
207
199
|
# an array of events if many found.
|
208
200
|
#
|
209
201
|
def find_events_by_extended_properties(extended_properties, options = {})
|
210
|
-
|
211
|
-
['shared', 'private'].each do |prop_type|
|
212
|
-
if extended_properties[prop_type]
|
213
|
-
query_parts << extended_properties[prop_type].map do |key, value|
|
214
|
-
(prop_type == "shared" ? "sharedExtendedProperty=" : "privateExtendedProperty=") + "#{key}%3D#{value}"
|
215
|
-
end.join("&")
|
216
|
-
end
|
217
|
-
end
|
218
|
-
query = "?" + query_parts.join('&') + parse_options(options)
|
202
|
+
query = "?" + parse_extended_properties(extended_properties) + parse_options(options)
|
219
203
|
event_lookup(query)
|
220
204
|
end
|
221
205
|
|
@@ -239,17 +223,10 @@ module Google
|
|
239
223
|
# an array of events if many found.
|
240
224
|
#
|
241
225
|
def find_events_by_extended_properties_in_range(extended_properties, start_min, start_max, options = {})
|
242
|
-
query_parts = []
|
243
|
-
['shared', 'private'].each do |prop_type|
|
244
|
-
if extended_properties[prop_type]
|
245
|
-
query_parts << extended_properties[prop_type].map do |key, value|
|
246
|
-
(prop_type == "shared" ? "sharedExtendedProperty=" : "privateExtendedProperty=") + "#{key}%3D#{value}"
|
247
|
-
end.join("&")
|
248
|
-
end
|
249
|
-
end
|
250
226
|
formatted_start_min = encode_time(start_min)
|
251
227
|
formatted_start_max = encode_time(start_max)
|
252
|
-
|
228
|
+
base_query = parse_extended_properties(extended_properties) + parse_options(options)
|
229
|
+
query = "?" + base_query + (base_query.empty? ? '' : '&') + "timeMin=#{formatted_start_min}&timeMax=#{formatted_start_max}"
|
253
230
|
event_lookup(query)
|
254
231
|
end
|
255
232
|
|
@@ -347,7 +324,23 @@ module Google
|
|
347
324
|
options[:max_results] ||= 25
|
348
325
|
options[:order_by] ||= 'startTime' # other option is 'updated'
|
349
326
|
options[:expand_recurring_events] ||= true
|
350
|
-
"&orderBy=#{options[:order_by]}
|
327
|
+
query_string = "&orderBy=#{options[:order_by]}"
|
328
|
+
query_string << "&maxResults=#{options[:max_results]}"
|
329
|
+
query_string << "&singleEvents=#{options[:expand_recurring_events]}"
|
330
|
+
query_string << "&q=#{options[:query]}" unless options[:query].nil?
|
331
|
+
query_string
|
332
|
+
end
|
333
|
+
|
334
|
+
#
|
335
|
+
# Utility method used to centralize the parsing of extended query parameters.
|
336
|
+
#
|
337
|
+
def parse_extended_properties(extended_properties) # :nodoc
|
338
|
+
query_parts = []
|
339
|
+
['shared', 'private'].each do |prop_type|
|
340
|
+
next unless extended_properties[prop_type]
|
341
|
+
query_parts << extended_properties[prop_type].map {|key, value| (prop_type == "shared" ? "sharedExtendedProperty=" : "privateExtendedProperty=") + "#{key}%3D#{value}" }.join("&")
|
342
|
+
end
|
343
|
+
query_parts.join('&')
|
351
344
|
end
|
352
345
|
|
353
346
|
#
|
data/lib/google/calendar_list.rb
CHANGED
@@ -19,12 +19,7 @@ module Google
|
|
19
19
|
# See Readme.rdoc or readme_code.rb for an explication on the OAuth2 authorization process.
|
20
20
|
#
|
21
21
|
def initialize(params={}, connection=nil)
|
22
|
-
@connection = connection || Connection.
|
23
|
-
:client_id => params[:client_id],
|
24
|
-
:client_secret => params[:client_secret],
|
25
|
-
:refresh_token => params[:refresh_token],
|
26
|
-
:redirect_url => params[:redirect_url]
|
27
|
-
)
|
22
|
+
@connection = connection || Connection.factory(params)
|
28
23
|
end
|
29
24
|
|
30
25
|
#
|
data/lib/google/connection.rb
CHANGED
@@ -22,6 +22,20 @@ module Google
|
|
22
22
|
)
|
23
23
|
Connection.new(params, client)
|
24
24
|
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# A utility method used to centralize the creation of connections
|
28
|
+
#
|
29
|
+
def self.factory(params) # :nodoc
|
30
|
+
Connection.new(
|
31
|
+
:client_id => params[:client_id],
|
32
|
+
:client_secret => params[:client_secret],
|
33
|
+
:refresh_token => params[:refresh_token],
|
34
|
+
:redirect_url => params[:redirect_url],
|
35
|
+
:state => params[:state]
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
25
39
|
#
|
26
40
|
# Prepare a connection to google for fetching a calendar events
|
27
41
|
#
|
data/lib/google/event.rb
CHANGED
@@ -18,7 +18,7 @@ module Google
|
|
18
18
|
# * +end_time+ - The end time of the event (Time object, defaults to one hour from now). Read Write.
|
19
19
|
# * +recurrence+ - A hash containing recurrence info for repeating events. Read write.
|
20
20
|
# * +calendar+ - What calendar the event belongs to. Read Write.
|
21
|
-
# * +all_day
|
21
|
+
# * +all_day+ - Does the event run all day. Read Write.
|
22
22
|
# * +quickadd+ - A string that Google parses when setting up a new event. If set and then saved it will take priority over any attributes you have set. Read Write.
|
23
23
|
# * +reminders+ - A hash containing reminders. Read Write.
|
24
24
|
# * +attendees+ - An array of hashes containing information about attendees. Read Write
|
@@ -27,11 +27,14 @@ module Google
|
|
27
27
|
# * +html_link+ - An absolute link to this event in the Google Calendar Web UI. Read only.
|
28
28
|
# * +raw+ - The full google json representation of the event. Read only.
|
29
29
|
# * +visibility+ - The visibility of the event (*'default'*, 'public', 'private', 'confidential'). Read Write.
|
30
|
-
# * +extended_properties - Custom properties which may be shared or private. Read Write
|
30
|
+
# * +extended_properties+ - Custom properties which may be shared or private. Read Write
|
31
|
+
# * +guests_can_invite_others+ - Whether attendees other than the organizer can invite others to the event (*true*, false). Read Write.
|
32
|
+
# * +guests_can_see_other_guests+ - Whether attendees other than the organizer can see who the event's attendees are (*true*, false). Read Write.
|
31
33
|
#
|
32
34
|
class Event
|
33
|
-
attr_reader :raw, :html_link, :status
|
34
|
-
|
35
|
+
attr_reader :id, :raw, :html_link, :status, :transparency, :visibility
|
36
|
+
attr_writer :reminders, :recurrence, :extended_properties
|
37
|
+
attr_accessor :title, :location, :calendar, :quickadd, :attendees, :description, :creator_name, :color_id, :guests_can_invite_others, :guests_can_see_other_guests
|
35
38
|
|
36
39
|
#
|
37
40
|
# Create a new event, and optionally set it's attributes.
|
@@ -55,9 +58,11 @@ module Google
|
|
55
58
|
# {'email' => 'some.b.one@gmail.com', 'displayName' => 'Some B One', 'responseStatus' => 'tentative'}
|
56
59
|
# ]
|
57
60
|
# event.extendedProperties = {'shared' => {'custom_str' => 'some custom string'}}
|
61
|
+
# event.guests_can_invite_others = false
|
62
|
+
# event.guests_can_see_other_guests = false
|
58
63
|
#
|
59
64
|
def initialize(params = {})
|
60
|
-
[:id, :status, :raw, :html_link, :title, :location, :calendar, :quickadd, :attendees, :description, :reminders, :recurrence, :start_time, :end_time, :color_id, :extended_properties].each do |attribute|
|
65
|
+
[:id, :status, :raw, :html_link, :title, :location, :calendar, :quickadd, :attendees, :description, :reminders, :recurrence, :start_time, :end_time, :color_id, :extended_properties, :guests_can_invite_others, :guests_can_see_other_guests].each do |attribute|
|
61
66
|
instance_variable_set("@#{attribute}", params[attribute])
|
62
67
|
end
|
63
68
|
|
@@ -106,8 +111,6 @@ module Google
|
|
106
111
|
#
|
107
112
|
def end_time=(time)
|
108
113
|
@end_time = Event.parse_time(time)
|
109
|
-
raise ArgumentError, "End Time must be either Time or String" unless (time.is_a?(String) || time.is_a?(Time))
|
110
|
-
@end_time = (time.is_a? String) ? Time.parse(time) : time.dup.utc
|
111
114
|
end
|
112
115
|
|
113
116
|
#
|
@@ -275,7 +278,9 @@ module Google
|
|
275
278
|
#{extended_properties_json}
|
276
279
|
\"reminders\": {
|
277
280
|
#{reminders_json}
|
278
|
-
}
|
281
|
+
},
|
282
|
+
\"guestsCanInviteOthers\": #{guests_can_invite_others.to_json},
|
283
|
+
\"guestsCanSeeOtherGuests\": #{guests_can_see_other_guests.to_json}
|
279
284
|
}"
|
280
285
|
end
|
281
286
|
|
@@ -321,7 +326,7 @@ module Google
|
|
321
326
|
# Timezone info is needed only at recurring events
|
322
327
|
#
|
323
328
|
def timezone_needed?
|
324
|
-
|
329
|
+
is_recurring_event?
|
325
330
|
end
|
326
331
|
|
327
332
|
#
|
@@ -337,7 +342,7 @@ module Google
|
|
337
342
|
# JSON representation of recurrence rules for repeating events
|
338
343
|
#
|
339
344
|
def recurrence_json
|
340
|
-
return unless
|
345
|
+
return unless is_recurring_event?
|
341
346
|
|
342
347
|
@recurrence[:until] = @recurrence[:until].strftime('%Y%m%dT%H%M%SZ') if @recurrence[:until]
|
343
348
|
rrule = "RRULE:" + @recurrence.collect { |k,v| "#{k}=#{v}" }.join(';').upcase
|
@@ -413,26 +418,24 @@ module Google
|
|
413
418
|
# Create a new event from a google 'entry'
|
414
419
|
#
|
415
420
|
def self.new_from_feed(e, calendar) #:nodoc:
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
:visibility => e['visibility'],
|
433
|
-
:color_id => e['colorId'],
|
434
|
-
:extended_properties => e['extendedProperties'])
|
421
|
+
params = {}
|
422
|
+
%w(id status description location creator transparency updated reminders attendees visibility).each do |p|
|
423
|
+
params[p.to_sym] = e[p]
|
424
|
+
end
|
425
|
+
|
426
|
+
params[:raw] = e
|
427
|
+
params[:calendar] = calendar
|
428
|
+
params[:title] = e['summary']
|
429
|
+
params[:color_id] = e['colorId']
|
430
|
+
params[:extended_properties] = e['extendedProperties']
|
431
|
+
params[:guests_can_invite_others] = e['guestsCanInviteOthers']
|
432
|
+
params[:guests_can_see_other_guests] = e['guestsCanSeeOtherGuests']
|
433
|
+
params[:html_link] = e['htmlLink']
|
434
|
+
params[:start_time] = Event.parse_json_time(e['start'])
|
435
|
+
params[:end_time] = Event.parse_json_time(e['end'])
|
436
|
+
params[:recurrence] = Event.parse_recurrence_rule(e['recurrence'])
|
435
437
|
|
438
|
+
Event.new(params)
|
436
439
|
end
|
437
440
|
|
438
441
|
#
|
@@ -442,7 +445,7 @@ module Google
|
|
442
445
|
def self.parse_recurrence_rule(recurrence_entry)
|
443
446
|
return {} unless recurrence_entry && recurrence_entry != []
|
444
447
|
|
445
|
-
rrule =
|
448
|
+
rrule = /(?<=RRULE:)(.*)(?="\])/.match(recurrence_entry.to_s).to_s
|
446
449
|
rhash = Hash[*rrule.downcase.split(/[=;]/)]
|
447
450
|
|
448
451
|
rhash[:until] = Time.parse(rhash[:until]) if rhash[:until]
|
@@ -459,7 +462,10 @@ module Google
|
|
459
462
|
@html_link = @raw['htmlLink']
|
460
463
|
end
|
461
464
|
|
462
|
-
|
465
|
+
#
|
466
|
+
# A utility method used to centralize parsing of time in json format
|
467
|
+
#
|
468
|
+
def self.parse_json_time(time_hash) #:nodoc
|
463
469
|
return nil unless time_hash
|
464
470
|
|
465
471
|
if time_hash['date']
|
@@ -471,6 +477,13 @@ module Google
|
|
471
477
|
end
|
472
478
|
end
|
473
479
|
|
480
|
+
#
|
481
|
+
# A utility method used to centralize checking for recurring events
|
482
|
+
#
|
483
|
+
def is_recurring_event? #:nodoc
|
484
|
+
@recurrence && (@recurrence[:freq] || @recurrence['FREQ'] || @recurrence['freq'])
|
485
|
+
end
|
486
|
+
|
474
487
|
#
|
475
488
|
# A utility method used centralize time parsing.
|
476
489
|
#
|
data/lib/google/freebusy.rb
CHANGED
@@ -22,12 +22,7 @@ module Google
|
|
22
22
|
# See Readme.rdoc or readme_code.rb for an explication on the OAuth2 authorization process.
|
23
23
|
#
|
24
24
|
def initialize(params={}, connection=nil)
|
25
|
-
@connection = connection || Connection.
|
26
|
-
:client_id => params[:client_id],
|
27
|
-
:client_secret => params[:client_secret],
|
28
|
-
:refresh_token => params[:refresh_token],
|
29
|
-
:redirect_url => params[:redirect_url]
|
30
|
-
)
|
25
|
+
@connection = connection || Connection.factory(params)
|
31
26
|
end
|
32
27
|
|
33
28
|
#
|
@@ -102,7 +102,7 @@ class TestGoogleCalendar < Minitest::Test
|
|
102
102
|
Time.stubs(:now).returns(now)
|
103
103
|
start_min = now
|
104
104
|
start_max = (now + 60*60*24)
|
105
|
-
@calendar.expects(:event_lookup).with("?sharedExtendedProperty=p%3Dv&timeMin=#{start_min.strftime("%FT%TZ")}&timeMax=#{start_max.strftime("%FT%TZ")}
|
105
|
+
@calendar.expects(:event_lookup).with("?sharedExtendedProperty=p%3Dv&orderBy=startTime&maxResults=25&singleEvents=true&timeMin=#{start_min.strftime("%FT%TZ")}&timeMax=#{start_max.strftime("%FT%TZ")}")
|
106
106
|
@calendar.find_events_by_extended_properties_in_range({'shared' => {'p' => 'v'}}, start_min, start_max)
|
107
107
|
end
|
108
108
|
|
@@ -114,6 +114,14 @@ class TestGoogleCalendar < Minitest::Test
|
|
114
114
|
@calendar.find_future_events()
|
115
115
|
end
|
116
116
|
|
117
|
+
should "find future events with query" do
|
118
|
+
now = Time.now.utc
|
119
|
+
Time.stubs(:now).returns(now)
|
120
|
+
formatted_time = now.strftime("%FT%TZ")
|
121
|
+
@calendar.expects(:event_lookup).with("?timeMin=#{formatted_time}&orderBy=startTime&maxResults=25&singleEvents=true&q=Test")
|
122
|
+
@calendar.find_future_events({max_results: 25, order_by: :startTime, query: 'Test'})
|
123
|
+
end
|
124
|
+
|
117
125
|
should "return multiple events in range as array" do
|
118
126
|
@client_mock.stubs(:body).returns( get_mock_body("events.json") )
|
119
127
|
events = @calendar.events
|
@@ -351,6 +359,8 @@ class TestGoogleCalendar < Minitest::Test
|
|
351
359
|
{'email' => 'some.b.one@gmail.com', 'displayName' => 'Some B One', 'responseStatus' => 'tentative'}
|
352
360
|
]
|
353
361
|
@event.extended_properties = { 'shared' => { 'key' => 'value' }}
|
362
|
+
@event.guests_can_invite_others = false
|
363
|
+
@event.guests_can_see_other_guests = false
|
354
364
|
|
355
365
|
expected_structure = {
|
356
366
|
"summary" => "Go Swimming",
|
@@ -364,7 +374,9 @@ class TestGoogleCalendar < Minitest::Test
|
|
364
374
|
{"displayName" => "Some B One", "email" => "some.b.one@gmail.com", "responseStatus" => "tentative"}
|
365
375
|
],
|
366
376
|
"reminders" => {"useDefault" => false, "overrides" => [{"method" => "popup", "minutes" => 10}]},
|
367
|
-
"extendedProperties" => {"shared" => {'key' => 'value'}}
|
377
|
+
"extendedProperties" => {"shared" => {'key' => 'value'}},
|
378
|
+
"guestsCanInviteOthers" => false,
|
379
|
+
"guestsCanSeeOtherGuests" => false
|
368
380
|
}
|
369
381
|
assert_equal JSON.parse(@event.to_json), expected_structure
|
370
382
|
end
|
@@ -407,6 +419,8 @@ class TestGoogleCalendar < Minitest::Test
|
|
407
419
|
]
|
408
420
|
@event.recurrence = {freq: "monthly", count: "5", interval: "2"}
|
409
421
|
@event.extended_properties = {'shared' => {'key' => 'value'}}
|
422
|
+
@event.guests_can_invite_others = false
|
423
|
+
@event.guests_can_see_other_guests = false
|
410
424
|
require 'timezone_parser'
|
411
425
|
expected_structure = {
|
412
426
|
"summary" => "Go Swimming",
|
@@ -421,7 +435,9 @@ class TestGoogleCalendar < Minitest::Test
|
|
421
435
|
{"displayName" => "Some B One", "email" => "some.b.one@gmail.com", "responseStatus" => "tentative"}
|
422
436
|
],
|
423
437
|
"reminders" => {"useDefault" => false, "overrides" => [{"method" => "popup", "minutes"=>10}]},
|
424
|
-
"extendedProperties" => {"shared" => {'key' => 'value'}}
|
438
|
+
"extendedProperties" => {"shared" => {'key' => 'value'}},
|
439
|
+
"guestsCanInviteOthers" => false,
|
440
|
+
"guestsCanSeeOtherGuests" => false
|
425
441
|
}
|
426
442
|
assert_equal JSON.parse(@event.to_json), expected_structure
|
427
443
|
end
|
@@ -542,7 +558,7 @@ class TestGoogleCalendar < Minitest::Test
|
|
542
558
|
client = mock('Faraday::Response')
|
543
559
|
client.stubs(:finish).returns('')
|
544
560
|
client.stubs(:status).returns(200)
|
545
|
-
client.stubs(:headers).returns({'
|
561
|
+
client.stubs(:headers).returns({'Content-type' => 'application/json; charset=utf-8'})
|
546
562
|
client.stubs(:body).returns(get_mock_body('successful_login.json'))
|
547
563
|
Faraday::Response.stubs(:new).returns(client)
|
548
564
|
client
|
metadata
CHANGED
@@ -1,181 +1,181 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Zich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: signet
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: TimezoneParser
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: terminal-notifier-guard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.6'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.6'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rb-fsevent
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0.9'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.9'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '5.1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '5.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: minitest-reporters
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: shoulda-context
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '1.2'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1.2'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: bundler
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '1.2'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '1.2'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: mocha
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '1.1'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '1.1'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rake
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - ~>
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
159
|
+
version: '11'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - ~>
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
166
|
+
version: '11'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rdoc
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - ~>
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '4.1'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - ~>
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '4.1'
|
181
181
|
description: A minimal wrapper around the google calendar API
|
@@ -186,9 +186,9 @@ extra_rdoc_files:
|
|
186
186
|
- LICENSE.txt
|
187
187
|
- README.rdoc
|
188
188
|
files:
|
189
|
-
- .document
|
190
|
-
- .gitignore
|
191
|
-
- .travis.yml
|
189
|
+
- ".document"
|
190
|
+
- ".gitignore"
|
191
|
+
- ".travis.yml"
|
192
192
|
- Gemfile
|
193
193
|
- Gemfile.lock
|
194
194
|
- Guardfile
|
@@ -237,17 +237,17 @@ require_paths:
|
|
237
237
|
- lib
|
238
238
|
required_ruby_version: !ruby/object:Gem::Requirement
|
239
239
|
requirements:
|
240
|
-
- -
|
240
|
+
- - ">="
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '0'
|
243
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
244
|
requirements:
|
245
|
-
- -
|
245
|
+
- - ">="
|
246
246
|
- !ruby/object:Gem::Version
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
249
|
rubyforge_project:
|
250
|
-
rubygems_version: 2.
|
250
|
+
rubygems_version: 2.4.8
|
251
251
|
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: A lightweight Google Calendar API wrapper
|