google_calendar 0.2.9 → 0.3.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.
data/.travis.yml CHANGED
@@ -3,5 +3,6 @@ rvm:
3
3
  - "1.8.7"
4
4
  - "1.9.2"
5
5
  - "1.9.3"
6
+ - "2.0.0"
6
7
  # uncomment this line if your project needs to run something other than `rake`:
7
8
  # script: bundle exec rspec spec
data/Gemfile.lock CHANGED
@@ -1,29 +1,29 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (3.2.12)
5
- i18n (~> 0.6)
4
+ activesupport (3.2.13)
5
+ i18n (= 0.6.1)
6
6
  multi_json (~> 1.0)
7
- addressable (2.3.2)
8
- bourne (1.1.2)
9
- mocha (= 0.10.5)
7
+ addressable (2.3.3)
8
+ bourne (1.4.0)
9
+ mocha (~> 0.13.2)
10
10
  i18n (0.6.1)
11
11
  json (1.7.7)
12
12
  metaclass (0.0.1)
13
- mocha (0.10.5)
13
+ mocha (0.13.3)
14
14
  metaclass (~> 0.0.1)
15
- multi_json (1.6.1)
16
- nokogiri (1.5.6)
17
- rake (10.0.3)
18
- rdoc (3.12.1)
15
+ multi_json (1.7.2)
16
+ nokogiri (1.5.9)
17
+ rake (10.0.4)
18
+ rdoc (4.0.1)
19
19
  json (~> 1.4)
20
- shoulda (3.3.2)
21
- shoulda-context (~> 1.0.1)
22
- shoulda-matchers (~> 1.4.1)
23
- shoulda-context (1.0.2)
24
- shoulda-matchers (1.4.2)
20
+ shoulda (3.4.0)
21
+ shoulda-context (~> 1.0, >= 1.0.1)
22
+ shoulda-matchers (~> 1.0, >= 1.4.1)
23
+ shoulda-context (1.1.1)
24
+ shoulda-matchers (1.5.6)
25
25
  activesupport (>= 3.0.0)
26
- bourne (~> 1.1.2)
26
+ bourne (~> 1.3)
27
27
 
28
28
  PLATFORMS
29
29
  ruby
data/README.rdoc CHANGED
@@ -1,11 +1,10 @@
1
- [![Build Status](https://travis-ci.org/northworld/google_calendar.png?branch=master)](https://travis-ci.org/northworld/google_calendar)
2
-
3
- [![Code Climate](https://codeclimate.com/github/northworld/google_calendar.png)](https://codeclimate.com/github/northworld/google_calendar)
4
1
 
5
2
  = Google Calendar
6
3
 
7
4
  A fast lightweight and minimalist wrapper around the google calendar api.
8
5
 
6
+ {<img src="https://travis-ci.org/northworld/google_calendar.png?branch=master" alt="Build Status" />}[https://travis-ci.org/northworld/google_calendar] {<img src="https://gemnasium.com/northworld/google_calendar.png" alt="Dependency Status" />}[https://gemnasium.com/northworld/google_calendar] {<img src="https://codeclimate.com/github/northworld/google_calendar.png" />}[https://codeclimate.com/github/northworld/google_calendar]
7
+
9
8
  == Install
10
9
  [sudo] gem install 'google_calendar'
11
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.9
1
+ 0.3.0
@@ -2,8 +2,8 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "google_calendar"
5
- s.version = "0.2.9"
6
- s.date = "2013-02-15"
5
+ s.version = "0.3.0"
6
+ s.date = "2013-04-15"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
 
data/lib/google/event.rb CHANGED
@@ -15,9 +15,11 @@ module Google
15
15
  # * +calendar+ - What calendar the event belongs to, read/write.
16
16
  # * +raw_xml+ - The full google xml representation of the event.
17
17
  # * +html_link+ - An absolute link to this event in the Google Calendar Web UI. Read-only.
18
+ # * +published_time+ - The time of the event creation. Read-only.
19
+ # * +updated_time+ - The last update time of the event. Read-only.
18
20
  #
19
21
  class Event
20
- attr_reader :id, :raw_xml, :html_link
22
+ attr_reader :id, :raw_xml, :html_link, :updated_time, :published_time
21
23
  attr_accessor :title, :content, :where, :calendar, :quickadd, :transparency
22
24
 
23
25
  # Create a new event, and optionally set it's attributes.
@@ -31,20 +33,20 @@ module Google
31
33
  # :calendar => calendar_object)
32
34
  #
33
35
  def initialize(params = {})
34
-
35
- @id = params[:id]
36
- @title = params[:title]
37
- @content = params[:content]
38
- @where = params[:where]
39
- @start_time = params[:start_time]
40
- @end_time = params[:end_time]
41
- self.all_day= params[:all_day] if params[:all_day]
42
- @calendar = params[:calendar]
43
- @raw_xml = params[:raw_xml]
44
- @quickadd = params[:quickadd]
45
- @transparency = params[:transparency]
46
- @html_link = params[:html_link]
47
-
36
+ @id = params[:id]
37
+ @title = params[:title]
38
+ @where = params[:where]
39
+ @raw_xml = params[:raw_xml]
40
+ @content = params[:content]
41
+ @calendar = params[:calendar]
42
+ @end_time = params[:end_time]
43
+ @quickadd = params[:quickadd]
44
+ @html_link = params[:html_link]
45
+ @start_time = params[:start_time]
46
+ self.all_day = params[:all_day] if params[:all_day]
47
+ @updated_time = params[:updated]
48
+ @transparency = params[:transparency]
49
+ @published_time = params[:published]
48
50
  end
49
51
 
50
52
  # Sets the start time of the Event. Must be a Time object or a parsable string representation of a time.
@@ -78,14 +80,14 @@ module Google
78
80
  raise ArgumentError, "End Time must be either Time or String" unless (time.is_a?(String) || time.is_a?(Time))
79
81
  @end_time = (time.is_a? String) ? Time.parse(time) : time.dup.utc
80
82
  end
81
-
83
+
82
84
  # 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
85
  #
84
86
  def all_day?
85
87
  time = Time.parse(@start_time)
86
88
  duration % (24 * 60 * 60) == 0 && time == Time.local(time.year,time.month,time.day)
87
89
  end
88
-
90
+
89
91
  def all_day=(time)
90
92
  if time.class == String
91
93
  time = Time.parse(time)
@@ -93,7 +95,7 @@ module Google
93
95
  @start_time = time.strftime("%Y-%m-%d")
94
96
  @end_time = (time + 24*60*60).strftime("%Y-%m-%d")
95
97
  end
96
-
98
+
97
99
  # Duration in seconds
98
100
  def duration
99
101
  Time.parse(end_time) - Time.parse(start_time)
@@ -173,7 +175,9 @@ module Google
173
175
  :end_time => xml.at_xpath("gd:when")['endTime'],
174
176
  :transparency => xml.at_xpath("gd:transparency")['value'].split('.').last,
175
177
  :quickadd => (xml.at_xpath("gCal:quickadd") ? (xml.at_xpath("gCal:quickadd")['quickadd']) : nil),
176
- :html_link => xml.at_xpath('//xmlns:link[@title="alternate" and @rel="alternate" and @type="text/html"]')['href'])
178
+ :html_link => xml.at_xpath('//xmlns:link[@title="alternate" and @rel="alternate" and @type="text/html"]')['href'],
179
+ :published => xml.at_xpath("xmlns:published").content,
180
+ :updated => xml.at_xpath("xmlns:updated").content )
177
181
  end
178
182
 
179
183
  # Set the ID after google assigns it (only necessary when we are creating a new event)
data/test/helper.rb CHANGED
@@ -9,7 +9,7 @@ rescue Bundler::BundlerError => e
9
9
  end
10
10
  require 'test/unit'
11
11
  require 'shoulda'
12
- require 'mocha'
12
+ require 'mocha/setup'
13
13
 
14
14
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
15
  $LOAD_PATH.unshift(File.dirname(__FILE__))
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.9
4
+ version: 0.3.0
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-02-15 00:00:00.000000000 Z
12
+ date: 2013-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri