Sha256: 420b11ba3dfe40b3b96995c0d07734b6b70eb6d5746255ff3fda15c04a44e3b8
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
$:.unshift(File.dirname(__FILE__) + '/../lib') require "parameters" require 'test/unit' require "googlecalendar/calendar" module CalendarTest include GoogleCalendar def get_service srv = Service.new(MAIL, PASS) assert_instance_of(Service, srv) srv.send("auth") assert_not_nil(srv.instance_eval("@auth")) srv end def event(title, desc, st, en) ret = <<XML <entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'></category> <title type='text'>#{title}</title> <content type='text'>#{desc}</content> <gd:transparency value='http://schemas.google.com/g/2005#event.opaque'></gd:transparency> <gd:eventStatus value='http://schemas.google.com/g/2005#event.confirmed'></gd:eventStatus> <gd:where valueString=''></gd:where> <gd:when startTime='#{st.iso8601}' endTime='#{en.iso8601}'></gd:when> </entry> XML ret end def clear_all(srv, feed) ret = srv.query(feed, {}) ens = get_entry_from_query(ret) ens.each do |entry| entry.elements.each("link") do |link| if link.attributes["rel"] == "edit" @srv.delete(link.attributes["href"]) end end end end def get_entry_from_query(ret) assert_equal("200", ret.code) xml = nil assert_nothing_raised { xml = REXML::Document.new(ret.body) } entries = xml.root.elements.each("entry"){} end def get_feed_from_entry(xmldoc) xmldoc.root.elements.each("link"){}.map{|e| e.attributes["href"] if e.attributes["rel"] == "edit"}.compact[0] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gcalapi-0.0.4 | test/base_unit.rb |
gcalapi-0.0.3 | test/base_unit.rb |