Class: GoApiClient::Atom::Author
- Inherits:
-
Object
- Object
- GoApiClient::Atom::Author
- Includes:
- Helpers::SimpleAttributesSupport
- Defined in:
- lib/go_api_client/atom/author.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(root, attributes = {}) ⇒ Author
constructor
A new instance of Author.
- #parse! ⇒ Object
Constructor Details
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/go_api_client/atom/author.rb', line 5 def email @email end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/go_api_client/atom/author.rb', line 5 def name @name end |
#uri ⇒ Object
Returns the value of attribute uri.
5 6 7 |
# File 'lib/go_api_client/atom/author.rb', line 5 def uri @uri end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/go_api_client/atom/author.rb', line 29 def ==(other) other && self.class.equal?(other.class) && name == other.name && email == other.email && uri == other.uri end |
#hash ⇒ Object
36 37 38 |
# File 'lib/go_api_client/atom/author.rb', line 36 def hash self.class.hash ^ name.hash ^ email.hash ^ uri.hash end |
#parse! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/go_api_client/atom/author.rb', line 14 def parse! self.name = @root.xpath('xmlns:name').first.content self.email = @root.xpath('xmlns:email').first.content rescue nil self.uri = @root.xpath('xmlns:uri').first.content rescue nil if email.nil? || email.empty? if name =~ /(.*) <(.+?)>/ self.name, self.email = $1, $2 end end @root = nil self end |