Class: LinkedIn::Recipients

Inherits:
Object
  • Object
show all
Defined in:
lib/linked_in/recipients.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#recipientsObject

Returns the value of attribute recipients.



4
5
6
# File 'lib/linked_in/recipients.rb', line 4

def recipients
  @recipients
end

Instance Method Details

#to_xmlObject



6
7
8
# File 'lib/linked_in/recipients.rb', line 6

def to_xml
  self.to_xml_nodes(Nokogiri.XML('<root/>', nil, 'UTF-8')).to_xml
end

#to_xml_nodes(doc) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/linked_in/recipients.rb', line 10

def to_xml_nodes(doc)
  recipients.inject(Nokogiri::XML::NodeSet.new(doc)) do |nodes, recipient|
    node = Nokogiri::XML::DocumentFragment.new(doc, '<recipient><person/></recipient>')
    node.at_css('person')['path'] = recipient.person.path
    nodes << node
  end
end