lib/tumblr4r.rb in tumblr4r-0.7.0 vs lib/tumblr4r.rb in tumblr4r-0.7.1
- old
+ new
@@ -3,11 +3,11 @@
require 'rexml/document'
require 'active_support'
require 'logger'
require 'cgi'
module Tumblr4r
- VERSION = '0.7.0'
+ VERSION = '0.7.1'
class TumblrError < StandardError
end
module POST_TYPE
REGULAR = "regular"
@@ -76,11 +76,11 @@
params[:start] = options[:offset] || 0
# goal の設定
total = self.count(options)
if options[:limit]
goal = [total - params[:start],
- options[:limit] - params[:start]].min
+ options[:limit]].min
else
goal = total - params[:start]
end
# 取得件数の初期化
if goal < 0
@@ -148,10 +148,15 @@
post_id = @conn.write(post.params)
new_post = self.find(post_id)
return new_post
end
+ # @param [Integer] post_id
+ def delete(post_id)
+ return @conn.delete(post_id)
+ end
+
end
# Postおよびその子クラスは原則として単なるData Transfer Objectとし、
# 何かのロジックをこの中に実装はしない。
class Post
@@ -357,10 +362,10 @@
msg += response.body
raise TumblrError.new(msg)
end
end
- # @params [Integer] post_id
+ # @param [Integer] post_id
def delete(post_id)
raise TumblrError.new("email or password is invalid") unless authenticated
response = nil
http = Net::HTTP.new("www.tumblr.com")
params = {"post-id" => post_id, "email" => @email, "password" => @password, "group" => @group}