Class: Calendav::Calendar

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

Constant Summary collapse

ATTRIBUTES =
%i[
  url display_name description ctag etag time_zone color components reports
  sync_token
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Calendar

Returns a new instance of Calendar.



23
24
25
# File 'lib/calendav/calendar.rb', line 23

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

Class Method Details

.from_xml(host, node) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/calendav/calendar.rb', line 13

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

Instance Method Details

#to_hObject



31
32
33
# File 'lib/calendav/calendar.rb', line 31

def to_h
  attributes.dup
end