class Calendav::Client

Attributes

credentials[R]

Public Class Methods

new(credentials) click to toggle source
# File lib/calendav/client.rb, line 11
def initialize(credentials)
  @credentials = credentials
end

Public Instance Methods

calendars() click to toggle source
# File lib/calendav/client.rb, line 15
def calendars
  @calendars = Clients::CalendarsClient.new(self, endpoint, credentials)
end
events() click to toggle source
# File lib/calendav/client.rb, line 19
def events
  @events = Clients::EventsClient.new(self, endpoint, credentials)
end
principal_url() click to toggle source
# File lib/calendav/client.rb, line 23
def principal_url
  @principal_url ||= begin
    request = Requests::CurrentUserPrincipal.call
    response = endpoint.propfind(request.to_xml).first

    ContextualURL.call(
      credentials.host,
      response.xpath(".//dav:current-user-principal/dav:href").text
    )
  end
end

Private Instance Methods

endpoint() click to toggle source
# File lib/calendav/client.rb, line 39
def endpoint
  @endpoint ||= Endpoint.new(credentials)
end