Class: OStatus::Author
- Inherits:
-
Atom::Person
- Object
- Atom::Person
- OStatus::Author
- Includes:
- Atom::SimpleExtensions
- Defined in:
- lib/ostatus/author.rb
Overview
Holds information about the author of the Feed.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#activity ⇒ Object
Gives an instance of an OStatus::Activity that parses the fields having an activity prefix.
-
#initialize(*args) ⇒ Author
constructor
A new instance of Author.
-
#portable_contacts ⇒ Object
Returns an instance of a PortableContacts that further describe the author’s contact information, if it exists.
- #portable_contacts=(poco) ⇒ Object
- #to_xml(*args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Author
Returns a new instance of Author.
30 31 32 33 |
# File 'lib/ostatus/author.rb', line 30 def initialize *args self.activity_object_type = "http://activitystrea.ms/schema/1.0/person" super(*args) end |
Instance Attribute Details
#name ⇒ Object
39 40 41 |
# File 'lib/ostatus/author.rb', line 39 def name @name or self[Atom::NAMESPACE, 'name'].first end |
#poco_name ⇒ Object
43 44 45 |
# File 'lib/ostatus/author.rb', line 43 def poco_name @poco_name or self[POCO_NS, 'name'].first end |
Instance Method Details
#activity ⇒ Object
Gives an instance of an OStatus::Activity that parses the fields having an activity prefix.
67 68 69 |
# File 'lib/ostatus/author.rb', line 67 def activity OStatus::Activity.new(self) end |
#portable_contacts ⇒ Object
Returns an instance of a PortableContacts that further describe the author’s contact information, if it exists.
73 74 75 |
# File 'lib/ostatus/author.rb', line 73 def portable_contacts PortableContacts.new(self) end |
#portable_contacts=(poco) ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/ostatus/author.rb', line 77 def portable_contacts= poco [ 'id', 'name', 'nickname', 'updated', 'published', 'birthday', 'anniversary', 'gender', 'note', 'connected'].each do |p| v = poco.send(p) self.send("poco_#{p}=", v) if v end self.poco_displayName = poco.display_name if poco.display_name self.poco_preferredUsername = poco.preferred_username if poco.preferred_username end |
#to_xml(*args) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ostatus/author.rb', line 47 def to_xml(*args) x = super(*args) if self.name node = XML::Node.new('name') node << self.name x << node end if self.poco_name node = XML::Node.new('poco:name') node << self.poco_name x << node end x end |