lib/tumblr4r.rb in tumblr4r-0.7.1 vs lib/tumblr4r.rb in tumblr4r-0.7.2
- old
+ new
@@ -3,11 +3,11 @@
require 'rexml/document'
require 'active_support'
require 'logger'
require 'cgi'
module Tumblr4r
- VERSION = '0.7.1'
+ VERSION = '0.7.2'
class TumblrError < StandardError
end
module POST_TYPE
REGULAR = "regular"
@@ -205,11 +205,11 @@
attr_accessor :regular_body, :feed_item, :from_feed_id
# TODO: titleのあるfeed itemってあるのか?
end
class Photo < Post
- attr_accessor :photo_caption, :photo_link_url, :photo_url
+ attr_accessor :photo_caption, :photo_link_url, :photo_url, :photoset
#TODO: photo_url の max-width って何?
attr_accessor :data
# TODO: data をどうやってPOSTするか考える
# 生のデータを持たせるんじゃなく、TumblrPostDataみたいな
@@ -217,10 +217,11 @@
def params
super.merge!(
{"source" => @photo_url,
"caption" => @photo_caption,
"click-through-url" => @photo_link_url,
+ "photoset" => @photoset,
"data" => @data})
end
end
class Quote < Post
@@ -467,9 +468,13 @@
post = self.post(post, rexml_post)
post.type
post.photo_caption = rexml_post.elements["photo-caption"].try(:text) || ""
post.photo_link_url = rexml_post.elements["photo-link-url"].try(:text) || ""
post.photo_url = rexml_post.elements["photo-url"].try(:text) || ""
+ post.photoset = []
+ rexml_post.elements.each("photoset/photo") do |photo|
+ post.photoset.push(photo.elements["photo-url"].try(:text) || "")
+ end
post
end
def quote(post, rexml_post)
post = self.post(post, rexml_post)