Browse files

Support descriptions in post body for links and videos

  • Loading branch information...
1 parent edc08f2 commit 22122afeba0fd89978008efdfb6b9c0f8839caa4 @pengwynn committed Aug 7, 2010
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 lib/tumblr/post/link.rb
@@ -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
4 lib/tumblr/post/video.rb
@@ -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
2 test/test_tumblr.rb
@@ -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 22122af

Please sign in to comment.