Class: Calendav::Event

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

Constant Summary collapse

ATTRIBUTES =
%i[url calendar_data etag].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Event

Returns a new instance of Event.



20
21
22
# File 'lib/calendav/event.rb', line 20

def initialize(attributes = {})
  @attributes = attributes
end

Class Method Details

.from_xml(host, node) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/calendav/event.rb', line 10

def self.from_xml(host, node)
  new(
    {
      url: ContextualURL.call(host, node.xpath("./dav:href").text)
    }.merge(
      Parsers::EventXML.call(node)
    )
  )
end

Instance Method Details

#dtendObject



44
45
46
# File 'lib/calendav/event.rb', line 44

def dtend
  inner_event.dtend
end

#dtstartObject



40
41
42
# File 'lib/calendav/event.rb', line 40

def dtstart
  inner_event.dtstart
end

#locationObject



36
37
38
# File 'lib/calendav/event.rb', line 36

def location
  inner_event.location
end

#summaryObject



32
33
34
# File 'lib/calendav/event.rb', line 32

def summary
  inner_event.summary
end

#to_hObject



28
29
30
# File 'lib/calendav/event.rb', line 28

def to_h
  attributes.dup
end

#unloaded?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/calendav/event.rb', line 48

def unloaded?
  calendar_data.nil?
end