facebook-google-calendar-sync 0.2.1 → 0.2.2

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.
@@ -17,8 +17,16 @@ module FacebookGoogleCalendarSync
17
17
 
18
18
  def self.find_or_create_calendar calendar_name
19
19
  google_calendar_details = find_or_create_calendar_details calendar_name
20
- calendar = get_calendar google_calendar_details.id
21
- GoogleCalendar.new(google_calendar_details, calendar)
20
+ calendar_with_events(google_calendar_details)
21
+ end
22
+
23
+ def self.find_calendar calendar_name
24
+ google_calendar_details = find_calendar_details_by_summary calendar_name
25
+ if google_calendar_details != nil
26
+ calendar_with_events(google_calendar_details)
27
+ else
28
+ nil
29
+ end
22
30
  end
23
31
 
24
32
  def id
@@ -49,14 +57,33 @@ module FacebookGoogleCalendarSync
49
57
  events.find{ | event | event.i_cal_uid == uid }
50
58
  end
51
59
 
60
+ def find_calendar_details calendar_name
61
+ google_calendar_details = find_calendar_details_by_summary calendar_name
62
+ if google_calendar_details == nil
63
+ return nil
64
+ else
65
+ logger.info "Found existing Google calendar #{calendar_name}"
66
+ end
67
+ google_calendar_details
68
+ end
69
+
52
70
  private
53
71
 
72
+ def self.calendar_with_events google_calendar_details
73
+ calendar = get_calendar google_calendar_details.id
74
+ GoogleCalendar.new(google_calendar_details, calendar)
75
+ end
76
+
77
+ def self.create_calendar_details calendar_name
78
+ timezone = find_primary_calendar_details.timeZone
79
+ create_calendar 'summary' => calendar_name, 'timeZone' => timezone
80
+ end
81
+
54
82
  def self.find_or_create_calendar_details calendar_name
55
83
  google_calendar_details = find_calendar_details_by_summary calendar_name
56
84
  if google_calendar_details == nil
57
- timezone = find_primary_calendar_details.timeZone
58
85
  logger.info "Creating Google calendar #{calendar_name} with timezone #{timezone}"
59
- google_calendar_details = create_calendar 'summary' => calendar_name, 'timeZone' => timezone
86
+ google_calendar_details = create_calendar_details calendar_name
60
87
  else
61
88
  logger.info "Found existing Google calendar #{calendar_name}"
62
89
  end
@@ -1,3 +1,3 @@
1
1
  module FacebookGoogleCalendarSync
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook-google-calendar-sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-14 00:00:00.000000000 Z
12
+ date: 2013-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-api-client
@@ -186,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  segments:
188
188
  - 0
189
- hash: 2896404305834103829
189
+ hash: 840453209475343473
190
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  none: false
192
192
  requirements:
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  version: '0'
196
196
  segments:
197
197
  - 0
198
- hash: 2896404305834103829
198
+ hash: 840453209475343473
199
199
  requirements: []
200
200
  rubyforge_project:
201
201
  rubygems_version: 1.8.23