gcal4ruby 0.1.3 → 0.1.4

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/CHANGELOG CHANGED
@@ -1,11 +1,13 @@
1
1
  #=CHANGELOG
2
+ #==version 0.1.4
3
+ #* Added additional search criteria for Event.find
2
4
  #==version 0.1.3
3
- #-Added support for authenticating with Google Hosted Apps accounts
4
- #-Added flag to indicate whether a calendar is editable
5
- #-Added handling to gracefully throw error when trying to create event on a non-editable (shared) calendar
5
+ #* Added support for authenticating with Google Hosted Apps accounts
6
+ #* Added flag to indicate whether a calendar is editable
7
+ #* Added handling to gracefully throw error when trying to create event on a non-editable (shared) calendar
6
8
  #==version 0.1.2
7
- #-Fixed to_xml dump problem with hidden and selected attributes
9
+ #* Fixed to_xml dump problem with hidden and selected attributes
8
10
  #==version 0.1.1
9
- #-Added all_day indicator to event to indicate an all day event
11
+ #* Added all_day indicator to event to indicate an all day event
10
12
  #==version 0.1.0
11
- #-Initial Version
13
+ #* Initial Version
@@ -64,6 +64,8 @@ module GCal4Ruby
64
64
  class RecurrenceValueError < StandardError; end
65
65
 
66
66
  class CalendarNotEditable < StandardError; end
67
+
68
+ class QueryParameterError < StandardError; end
67
69
 
68
70
  #The ProxyInfo class contains information for configuring a proxy connection
69
71
 
@@ -345,10 +345,19 @@ module GCal4Ruby
345
345
  end
346
346
  end
347
347
 
348
- #Finds the event that matches search_term in title or description full text search. The scope parameter can
349
- #be either :all to return an array of all matches, or :first to return the first match as an Event.
350
- def self.find(calendar, search_term, scope = :all)
351
- events = calendar.service.send_get("http://www.google.com/calendar/feeds/#{calendar.id}/private/full?q="+CGI.escape(search_term))
348
+ #Finds the event that matches search_term in title or description full text search.
349
+ #* The scope parameter can be either :all to return an array of all matches, or :first to return the first match as an Event.
350
+ #* The range parameter must be a hash containing a :start and :end values as Times specifying the date range to query by. Defaults to all dates.
351
+ def self.find(calendar, search_term = '', scope = :all, range = {})
352
+ if not range.is_a? Hash or (range.size > 0 and (not range[:start].is_a? Time or not range[:end].is_a? Time))
353
+ raise "The date range must be a hash including the :start and :end date values as Times"
354
+ else
355
+ date_range = ''
356
+ if range.size > 0
357
+ date_range = "&start-min=#{range[:start].xmlschema}&start-max=#{range[:end].xmlschema}"
358
+ end
359
+ end
360
+ events = calendar.service.send_get("http://www.google.com/calendar/feeds/#{calendar.id}/private/full?q="+CGI.escape(search_term)+date_range)
352
361
  ret = []
353
362
  REXML::Document.new(events.read_body).root.elements.each("entry"){}.map do |entry|
354
363
  entry.attributes["xmlns:gCal"] = "http://schemas.google.com/gCal/2005"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcal4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Reich