Class: Googletastic::Calendar
- Defined in:
- lib/googletastic/calendar.rb
Constant Summary
Constants included from Mixins::Namespaces
Mixins::Namespaces::NAMESPACES
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#hidden ⇒ Object
Returns the value of attribute hidden.
-
#role ⇒ Object
Returns the value of attribute role.
-
#selected ⇒ Object
Returns the value of attribute selected.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Attributes inherited from Base
#acl, #attachment_path, #etag, #head, #id, #keep_raw, #raw, #response, #synced_with
Attributes included from Mixins::Attributes
Class Method Summary collapse
Methods inherited from Base
client_class, #initialize, #to_xml
Methods included from Mixins::Pagination
Methods included from Mixins::Finders
Methods included from Mixins::Parsing
Methods included from Mixins::Requesting
Methods included from Mixins::Attributes
#attribute_names, #has_attribute?, #inspect
Methods included from Mixins::Namespaces
Constructor Details
This class inherits a constructor from Googletastic::Base
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
4 5 6 |
# File 'lib/googletastic/calendar.rb', line 4 def color @color end |
#created_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/googletastic/calendar.rb', line 3 def created_at @created_at end |
#hidden ⇒ Object
Returns the value of attribute hidden.
4 5 6 |
# File 'lib/googletastic/calendar.rb', line 4 def hidden @hidden end |
#role ⇒ Object
Returns the value of attribute role.
3 4 5 |
# File 'lib/googletastic/calendar.rb', line 3 def role @role end |
#selected ⇒ Object
Returns the value of attribute selected.
4 5 6 |
# File 'lib/googletastic/calendar.rb', line 4 def selected @selected end |
#timezone ⇒ Object
Returns the value of attribute timezone.
4 5 6 |
# File 'lib/googletastic/calendar.rb', line 4 def timezone @timezone end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/googletastic/calendar.rb', line 3 def title @title end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/googletastic/calendar.rb', line 3 def updated_at @updated_at end |
Class Method Details
.index_url ⇒ Object
8 9 10 |
# File 'lib/googletastic/calendar.rb', line 8 def index_url "http://www.google.com/calendar/feeds/default/allcalendars/full" end |
.marshall(record) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/googletastic/calendar.rb', line 43 def marshall(record) Nokogiri::XML::Builder.new { |xml| xml.entry(ns_xml("atom", "gCal")) { if record.id xml.id { xml.text "#{ID}#{record.id}" } end xml.title { xml.text record.title } } }.to_xml end |
.show_url(id) ⇒ Object
12 13 14 |
# File 'lib/googletastic/calendar.rb', line 12 def show_url(id) "http://www.google.com/calendar/embed?src=#{id}" end |
.unmarshall(xml) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/googletastic/calendar.rb', line 16 def unmarshall(xml) records = xml.xpath("//atom:entry", ns_tag("atom")).collect do |record| id = record.xpath("atom:id", ns_tag("atom")).first.text title = record.xpath("atom:title", ns_tag("atom")).first.text created_at = record.xpath("atom:published", ns_tag("atom")).first.text updated_at = record.xpath("atom:updated", ns_tag("atom")).first.text role = record.xpath("gCal:accesslevel", ns_tag("gCal")).first["value"] color = record.xpath("gCal:color", ns_tag("gCal")).first["value"] hidden = record.xpath("gCal:hidden", ns_tag("gCal")).first["value"] selected = record.xpath("gCal:selected", ns_tag("gCal")).first["value"] timezone = record.xpath("gCal:timezone", ns_tag("gCal")).first["value"] Googletastic::Calendar.new( :id => id, :title => title, :created_at => created_at, :updated_at => updated_at, :role => role, :color => color, :selected => selected, :timezone => timezone ) end records end |