Class: Tumblr::Data::Post
- Inherits:
-
Object
- Object
- Tumblr::Data::Post
- Defined in:
- lib/tumblr.rb
Instance Attribute Summary collapse
-
#bookmarklet ⇒ Object
readonly
Returns the value of attribute bookmarklet.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#postid ⇒ Object
readonly
Returns the value of attribute postid.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(elt, tz) ⇒ Post
constructor
A new instance of Post.
- #to_xml ⇒ Object
Constructor Details
#initialize(elt, tz) ⇒ Post
Returns a new instance of Post.
96 97 98 99 100 101 102 |
# File 'lib/tumblr.rb', line 96 def initialize(elt, tz) @postid = elt.attributes["id"] @url = elt.attributes["url"] @date = Time.parse(elt.attributes["date"] + tz.strftime("%Z")) @bookmarklet = (elt.attributes["bookmarklet"] == "true") @timezone = tz end |
Instance Attribute Details
#bookmarklet ⇒ Object (readonly)
Returns the value of attribute bookmarklet.
94 95 96 |
# File 'lib/tumblr.rb', line 94 def bookmarklet @bookmarklet end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
94 95 96 |
# File 'lib/tumblr.rb', line 94 def date @date end |
#postid ⇒ Object (readonly)
Returns the value of attribute postid.
94 95 96 |
# File 'lib/tumblr.rb', line 94 def postid @postid end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
94 95 96 |
# File 'lib/tumblr.rb', line 94 def url @url end |
Instance Method Details
#to_xml ⇒ Object
104 105 106 107 108 109 110 111 |
# File 'lib/tumblr.rb', line 104 def to_xml elt = REXML::Element.new("post") elt.attributes["id"] = @postid elt.attributes["date"] = @date.strftime("%a, %d %b %Y %X") elt.attributes["bookmarklet"] = "true" if @bookmarklet elt.attributes["url"] = @url return elt end |