Class: Calendav::Client
- Inherits:
-
Object
- Object
- Calendav::Client
- Defined in:
- lib/calendav/client.rb
Instance Method Summary collapse
- #calendars ⇒ Object
- #events ⇒ Object
-
#initialize(credentials, timeout: nil) ⇒ Client
constructor
A new instance of Client.
- #principal_url ⇒ Object
Constructor Details
#initialize(credentials, timeout: nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 |
# File 'lib/calendav/client.rb', line 11 def initialize(credentials, timeout: nil) @credentials = credentials @timeout = timeout end |
Instance Method Details
#calendars ⇒ Object
16 17 18 |
# File 'lib/calendav/client.rb', line 16 def calendars @calendars = Clients::CalendarsClient.new(self, endpoint, credentials) end |
#events ⇒ Object
20 21 22 |
# File 'lib/calendav/client.rb', line 20 def events @events = Clients::EventsClient.new(self, endpoint, credentials) end |
#principal_url ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/calendav/client.rb', line 24 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 |