class Calendav::Requests::MakeCalendar

Attributes

attributes[R]

Public Class Methods

call(...) click to toggle source
# File lib/calendav/requests/make_calendar.rb, line 10
def self.call(...)
  new(...).call
end
new(attributes) click to toggle source
# File lib/calendav/requests/make_calendar.rb, line 14
def initialize(attributes)
  @attributes = attributes
end

Public Instance Methods

call() click to toggle source
# File lib/calendav/requests/make_calendar.rb, line 18
def call
  Nokogiri::XML::Builder.new do |xml|
    xml["caldav"].mkcalendar(NAMESPACES) do
      xml["dav"].set do
        xml["dav"].prop do
          xml["dav"].displayname display_name

          if description
            xml["caldav"].public_send(
              :"calendar-description", description
            )
          end

          if time_zone
            xml["caldav"].public_send(:"calendar-timezone", time_zone)
          end

          xml["apple"].public_send(:"calendar-color", color) if color

          xml["caldav"].public_send(
            :"supported-calendar-component-set"
          ) do
            xml["caldav"].comp name: "VEVENT"
          end
        end
      end
    end
  end
end

Private Instance Methods

color() click to toggle source
# File lib/calendav/requests/make_calendar.rb, line 52
def color
  attributes[:color]
end
description() click to toggle source
# File lib/calendav/requests/make_calendar.rb, line 60
def description
  attributes[:description]
end
display_name() click to toggle source
# File lib/calendav/requests/make_calendar.rb, line 56
def display_name
  attributes[:display_name]
end
time_zone() click to toggle source
# File lib/calendav/requests/make_calendar.rb, line 64
def time_zone
  attributes[:time_zone]
end