Class: LinkedIn::Message

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



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

def body
  @body
end

#recipientsObject

Returns the value of attribute recipients.



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

def recipients
  @recipients
end

#subjectObject

Returns the value of attribute subject.



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

def subject
  @subject
end

Instance Method Details

#to_xmlObject



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

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

#to_xml_node(doc) ⇒ Object



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

def to_xml_node(doc)
  node = Nokogiri::XML::DocumentFragment.new(doc, '<mailbox-item><recipients/><subject/><body/></mailbox-item>')
  node.at_css('recipients').add_child(self.recipients.to_xml_nodes(doc))
  node.at_css('subject').content = self.subject
  node.at_css('body').content = self.body
  node
end