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
- #todos ⇒ Object
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
#calendars ⇒ Object
17 18 19 |
# File 'lib/calendav/client.rb', line 17 def calendars @calendars = Clients::CalendarsClient.new(self, endpoint, credentials) end |
#events ⇒ Object
21 22 23 |
# File 'lib/calendav/client.rb', line 21 def events @events = Clients::EventsClient.new(self, endpoint, credentials) end |
#principal_url ⇒ Object
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 |
#todos ⇒ Object
25 26 27 |
# File 'lib/calendav/client.rb', line 25 def todos @todos = Clients::TodosClient.new(self, endpoint, credentials) end |