Class: Calendav::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/calendav/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(credentials, timeout: nil) ⇒ Client

Returns a new instance of Client.



12
13
14
15
# File 'lib/calendav/client.rb', line 12

def initialize(credentials, timeout: nil)
  @credentials = credentials
  @timeout = timeout
end

Instance Method Details

#calendarsObject



17
18
19
# File 'lib/calendav/client.rb', line 17

def calendars
  @calendars = Clients::CalendarsClient.new(self, endpoint, credentials)
end

#eventsObject



21
22
23
# File 'lib/calendav/client.rb', line 21

def events
  @events = Clients::EventsClient.new(self, endpoint, credentials)
end

#principal_urlObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/calendav/client.rb', line 29

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

#todosObject



25
26
27
# File 'lib/calendav/client.rb', line 25

def todos
  @todos = Clients::TodosClient.new(self, endpoint, credentials)
end