Class: Calendav::Requests::ListEvents

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from:, to:) ⇒ ListEvents

Returns a new instance of ListEvents.



14
15
16
17
# File 'lib/calendav/requests/list_events.rb', line 14

def initialize(from:, to:)
  @from = from
  @to = to
end

Class Method Details

.callObject



10
11
12
# File 'lib/calendav/requests/list_events.rb', line 10

def self.call(...)
  new(...).call
end

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/calendav/requests/list_events.rb', line 19

def call
  Nokogiri::XML::Builder.new do |xml|
    xml["caldav"].public_send("calendar-query", NAMESPACES) do
      xml["dav"].prop do
        xml["dav"].getetag
        xml["caldav"].public_send(:"calendar-data")
      end
      xml["caldav"].filter do
        xml["caldav"].public_send(:"comp-filter", name: "VCALENDAR") do
          xml["caldav"].public_send(:"comp-filter", name: "VEVENT") do
            if range?
              xml["caldav"].public_send(
                :"time-range", start: from, end: to
              )
            end
          end
        end
      end
    end
  end
end