Class: OStatus::Author
- Inherits:
-
Object
- Object
- OStatus::Author
- Defined in:
- lib/ostatus/author.rb
Overview
Holds information about the author of the Feed.
Instance Method Summary collapse
-
#activity ⇒ Object
Gives an instance of an OStatus::Activity that parses the fields having an activity prefix.
-
#email ⇒ Object
Returns the email of the author, if it exists.
-
#initialize(author_node) ⇒ Author
constructor
Instantiates an Author object either from a given <author></author> root passed as an instance of a Nokogiri::XML::Element or a Hash containing the properties.
-
#name ⇒ Object
Returns the name of the author, if it exists.
-
#portable_contacts ⇒ Object
Returns an instance of a PortableContacts that further describe the author’s contact information, if it exists.
-
#uri ⇒ Object
Returns the uri of the author, if it exists.
Constructor Details
#initialize(author_node) ⇒ Author
Instantiates an Author object either from a given <author></author> root passed as an instance of a Nokogiri::XML::Element or a Hash containing the properties.
12 13 14 15 16 17 18 19 20 |
# File 'lib/ostatus/author.rb', line 12 def initialize() if .class == Hash @author_data = @author = nil else @author = @author_data = nil end end |
Instance Method Details
#activity ⇒ Object
Gives an instance of an OStatus::Activity that parses the fields having an activity prefix.
24 25 26 |
# File 'lib/ostatus/author.rb', line 24 def activity OStatus::Activity.new(@author) end |
#email ⇒ Object
Returns the email of the author, if it exists.
44 45 46 47 |
# File 'lib/ostatus/author.rb', line 44 def email return @author_data[:email] unless @author_data == nil pick_first_node(@author.css('email')) end |
#name ⇒ Object
Returns the name of the author, if it exists.
38 39 40 41 |
# File 'lib/ostatus/author.rb', line 38 def name return @author_data[:name] unless @author_data == nil pick_first_node(@author.css('name')) end |
#portable_contacts ⇒ Object
Returns an instance of a PortableContacts that further describe the author’s contact information, if it exists.
57 58 59 60 |
# File 'lib/ostatus/author.rb', line 57 def portable_contacts return @author_data[:portable_contacts] unless @author_data == nil PortableContacts.new(@author) end |
#uri ⇒ Object
Returns the uri of the author, if it exists.
50 51 52 53 |
# File 'lib/ostatus/author.rb', line 50 def uri return @author_data[:uri] unless @author_data == nil pick_first_node(@author.css('uri')) end |