class SabredavClient::XmlRequestBuilder::PostSharing

Attributes

adds[RW]
common_name[RW]
privilege[RW]
removes[RW]
summary[RW]

Public Class Methods

new(adds, summary, common_name, privilege, removes) click to toggle source
# File lib/sabredav_client/xml_request_builder/post_sharing.rb, line 7
def initialize(adds, summary, common_name, privilege, removes)
  @adds = adds
  @summary = summary
  @privilege = privilege
  @common_name = common_name
  @removes = removes
  super()
end

Public Instance Methods

to_xml() click to toggle source
# File lib/sabredav_client/xml_request_builder/post_sharing.rb, line 16
def to_xml
  xml.cs :share, CS_NAMESPACES do
    unless adds.empty?
      adds.each do |add|
        add = "mailto:#{add}"
        xml.cs :set do
          xml.d :href, add
          xml.cs :summary, summary unless summary.nil?
          xml.tag! "cs:common-name", common_name unless common_name.nil?
          xml.tag! "cs:#{privilege}"
        end
      end
    end
    unless removes.empty?
      removes.each do |remove|
        remove = "mailto:#{remove}"
        xml.cs :remove do
          xml.d :href, remove
        end
      end
    end
  end
end