google_calendar 0.2.7 → 0.2.8

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.2.8
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "google_calendar"
8
- s.version = "0.2.7"
8
+ s.version = "0.2.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve Zich"]
12
- s.date = "2012-12-27"
12
+ s.date = "2013-01-10"
13
13
  s.description = "A minimal wrapper around the google calendar API, which uses nokogiri for fast parsing."
14
14
  s.email = "steve.zich@gmail.com"
15
15
  s.extra_rdoc_files = [
data/lib/google/event.rb CHANGED
@@ -82,7 +82,8 @@ module Google
82
82
  # Returns whether the Event is an all-day event, based on whether the event starts at the beginning and ends at the end of the day.
83
83
  #
84
84
  def all_day?
85
- duration == 24 * 60 * 60 # Exactly one day
85
+ time = Time.parse(@start_time)
86
+ duration % (24 * 60 * 60) == 0 && time == Time.new(time.year,time.month,time.day)
86
87
  end
87
88
 
88
89
  def all_day=(time)
@@ -219,12 +219,24 @@ class TestGoogleCalendar < Test::Unit::TestCase
219
219
 
220
220
  context "Event instance methods" do
221
221
  context "#all_day?" do
222
- context "when the event is 24 hours long or more" do
222
+ context "when the event is marked as All Day in google calendar" do
223
223
  should "be true" do
224
224
  @event = Event.new(:start_time => "2012-03-31", :end_time => "2012-04-01")
225
225
  assert @event.all_day?
226
226
  end
227
227
  end
228
+ context "when the event is marked as All Day in google calendar and have more than one day" do
229
+ should "be true" do
230
+ @event = Event.new(:start_time => "2012-03-31", :end_time => "2012-04-03")
231
+ assert @event.all_day?
232
+ end
233
+ end
234
+ context "when the event is not marked as All Day in google calendar and has duration of one whole day" do
235
+ should "be false" do
236
+ @event = Event.new(:start_time => "2012-03-27T10:00:00.000-07:00", :end_time => "2012-03-28T10:00:00.000-07:00")
237
+ assert !@event.all_day?
238
+ end
239
+ end
228
240
  context "when the event is not an all-day event" do
229
241
  should "be false" do
230
242
  @event = Event.new(:start_time => "2012-03-27T10:00:00.000-07:00", :end_time => "2012-03-27T10:30:00.000-07:00")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
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: 2012-12-27 00:00:00.000000000 Z
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -170,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  segments:
172
172
  - 0
173
- hash: -1634053075579293833
173
+ hash: 2763887538730031791
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  none: false
176
176
  requirements: