Permalink
Browse files

Support descriptions in post body for links and videos

  • Loading branch information...
pengwynn authored and mwunsch committed Aug 7, 2010
1 parent edc08f2 commit b9ebc4680286fb724b6af3e9931520d8bada17f4
Showing with 8 additions and 2 deletions.
  1. +3 −1 lib/tumblr/post/link.rb
  2. +3 −1 lib/tumblr/post/video.rb
  3. +2 −0 test/test_tumblr.rb
View
@@ -4,7 +4,9 @@ class Link < Post
def initialize(url, post_id = nil)
super post_id
- self.url = url
+ url = url.to_a.map
+ self.url = url.shift.strip
+ self.description = url.join
@type = :link
end
View
@@ -6,7 +6,9 @@ class Video < Post
def initialize(video, post_id = nil)
super post_id
- self.embed = video
+ video = video.to_a.map
+ self.embed = video.shift.strip
+ self.caption = video.join
@type = :video
end
View
@@ -63,12 +63,14 @@ class TestTumblr < Test::Unit::TestCase
name: The Something Website
---
http://something.com
+This is the description
link
post = Tumblr.parse(link)
assert_equal :link, post.type
assert_equal 'The Something Website', post.name
assert_equal 'http://something.com', post.url
+ assert_equal 'This is the description', post.description
end
test 'sets up credentials for authentication' do

0 comments on commit b9ebc46

Please sign in to comment.