class Calendav::Parsers::SyncXML
Attributes
calendar_url[R]
multi_response[R]
Public Class Methods
call(...)
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 10 def self.call(...) new(...).call end
new(calendar_url, multi_response)
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 14 def initialize(calendar_url, multi_response) @calendar_url = calendar_url @multi_response = multi_response end
Public Instance Methods
call()
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 19 def call SyncCollection.new(events, deleted_urls, token, more?) end
Private Instance Methods
calendar_path()
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 39 def calendar_path @calendar_path ||= URI(calendar_url).path end
calendar_response()
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 43 def calendar_response multi_response .detect { |node| node.xpath("./dav:href").text == calendar_path } end
deleted_urls()
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 27 def deleted_urls individual_responses .select { |node| node.xpath("./dav:status").text["404 Not Found"] } .collect { |node| response_url(node) } end
events()
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 33 def events individual_responses .reject { |node| node.xpath("./dav:status").text["404 Not Found"] } .collect { |node| Event.from_xml(calendar_url, node) } end
individual_responses()
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 48 def individual_responses multi_response .reject { |node| node.xpath("./dav:href").text == calendar_path } end
more?()
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 53 def more? return false if calendar_response.nil? status = calendar_response.xpath("./dav:propstat/dav:status").text !status["507 Insufficient Storage"].nil? end
response_url(response)
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 64 def response_url(response) ContextualURL.call(calendar_url, response.xpath("./dav:href").text) end
token()
click to toggle source
# File lib/calendav/parsers/sync_xml.rb, line 60 def token multi_response.xpath("/dav:multistatus/dav:sync-token").text end