Class Rufus::Google::Calendar
In: lib/rufus/gcal.rb
Parent: Object

Methods

Included Modules

CollectionMixin

Public Class methods

Returns a hash calendar_name => calendar

an example :

  calendars = Rufus::Google::Calendar.get_calendars(
    :account => ENV['GUSER'], :password => env['GPASS'])
  calendars.values.each { |c| p [ c.name, c.href ] }

[Source]

     # File lib/rufus/gcal.rb, line 86
 86:     def self.get_calendars (options)
 87: 
 88:       options[:service] = :cl
 89: 
 90:       feed = Rufus::Google.feed_for(
 91:         'https://www.google.com/calendar/feeds/default', options)
 92: 
 93:       feed.update! # fetch the data over the net
 94: 
 95:       feed.entries.inject({}) { |h, e|
 96:         c = Calendar.new(options[:auth], e)
 97:         h[c.name] = c
 98:         h
 99:       }
100:     end

Public Instance methods

Returns all the events in the calendar.

The query hash can be used to ‘query’ those events. It currently accepts :q, :start_min and :start_max as keys.

[Source]

    # File lib/rufus/gcal.rb, line 52
52:     def events (query={})
53: 
54:       q = query.inject([]) { |a, (k, v)|
55:         a << "#{k.to_s.gsub(/\_/, '-')}=#{v}"
56:       }.join("&")
57: 
58:       q = "?#{q}" if q.length > 0
59: 
60:       feed = Rufus::Google.feed_for("#{href}#{q}", @token)
61:       feed.update!
62: 
63:       feed.entries.collect { |e| Event.new(e) }
64:     end

Posts (creates) a QuickAdd event in this calendar.

code.google.com/apis/calendar/developers_guide_protocol.html#CreatingQuickAdd

[Source]

    # File lib/rufus/gcal.rb, line 72
72:     def post_quick! (event_text)
73: 
74:       post!(Event.create_quick(event_text))
75:     end

[Validate]