Class: SabredavClient::XmlRequestBuilder::PostSharing

Inherits:
Base
  • Object
show all
Defined in:
lib/sabredav_client/xml_request_builder/post_sharing.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#xml

Instance Method Summary collapse

Constructor Details

#initialize(adds, summary, common_name, privilege, removes) ⇒ PostSharing

Returns a new instance of PostSharing.



7
8
9
10
11
12
13
14
# 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

Instance Attribute Details

#addsObject

Returns the value of attribute adds.



5
6
7
# File 'lib/sabredav_client/xml_request_builder/post_sharing.rb', line 5

def adds
  @adds
end

#common_nameObject

Returns the value of attribute common_name.



5
6
7
# File 'lib/sabredav_client/xml_request_builder/post_sharing.rb', line 5

def common_name
  @common_name
end

#privilegeObject

Returns the value of attribute privilege.



5
6
7
# File 'lib/sabredav_client/xml_request_builder/post_sharing.rb', line 5

def privilege
  @privilege
end

#removesObject

Returns the value of attribute removes.



5
6
7
# File 'lib/sabredav_client/xml_request_builder/post_sharing.rb', line 5

def removes
  @removes
end

#summaryObject

Returns the value of attribute summary.



5
6
7
# File 'lib/sabredav_client/xml_request_builder/post_sharing.rb', line 5

def summary
  @summary
end

Instance Method Details

#to_xmlObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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