module Tumblr::Client::Blog
Public Instance Methods
audio(base_hostname, external_url=nil, data=[] , params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 60 def audio(base_hostname, external_url=nil, data=[] , params={}) params["type"] = "audio" params["external_url"] = external_url if external_url unless data.empty? params["data[]"] = data.map{|file| OAuth::Helper.escape(File.open(file).binmode.read) } end post "/#{API_VERSION}/blog/#{base_hostname}/post", params end
avatar(base_hostname, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 11 def avatar(base_hostname, params={}) get "/#{API_VERSION}/blog/#{base_hostname}/avatar/#{params.delete("size")}", params end
blog_info(base_hostname, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 7 def blog_info(base_hostname, params={}) get "/#{API_VERSION}/blog/#{base_hostname}/info", params.merge!("api_key" => consumer_key) end
chat(base_hostname, conversation, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 56 def chat(base_hostname, conversation, params={}) post "/#{API_VERSION}/blog/#{base_hostname}/post", params.merge!({"converstion" => conversation, "type" => "chat"}) end
delete_post(base_hostname, id, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 88 def delete_post(base_hostname, id, params={}) post "/#{API_VERSION}/blog/#{base_hostname}/post/delete", params.merge!({"id" => id}) end
drafts(base_hostname, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 27 def drafts(base_hostname, params={}) get "/#{API_VERSION}/blog/#{base_hostname}/posts/draft", params end
edit(base_hostname,id , params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 80 def edit(base_hostname,id , params={}) post "/#{API_VERSION}/blog/#{base_hostname}/post/edit", params.merge!({"id" => id}) end
followers(base_hostname, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 15 def followers(base_hostname, params={}) get "/#{API_VERSION}/blog/#{base_hostname}/followers", params end
link(base_hostname, url, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 52 def link(base_hostname, url, params={}) post "/#{API_VERSION}/blog/#{base_hostname}/post", params.merge!({"url" => url, "type" => "link"}) end
photo(base_hostname,source = nil, data=[], params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 39 def photo(base_hostname,source = nil, data=[], params={}) params["type"] = "photo" params["source"] = source if source unless data.empty? params["data[]"] = data.map{|file| OAuth::Helper.escape(File.open(file).binmode.read) } end post "/#{API_VERSION}/blog/#{base_hostname}/post", params end
posts(base_hostname, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 19 def posts(base_hostname, params={}) get "/#{API_VERSION}/blog/#{base_hostname}/posts/#{params.delete("type")}", params.merge!("api_key" => consumer_key) end
queue(base_hostname, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 23 def queue(base_hostname, params={}) get "/#{API_VERSION}/blog/#{base_hostname}/posts/queue", params end
quote(base_hostname, quote, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 48 def quote(base_hostname, quote, params={}) post "/#{API_VERSION}/blog/#{base_hostname}/post", params.merge!({"type" => "quote", "quote" => quote}) end
reblog(base_hostname, id, reblog_key, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 84 def reblog(base_hostname, id, reblog_key, params={}) post "/#{API_VERSION}/blog/#{base_hostname}/post/reblog", params.merge!({"id" => id , "reblog_key" => reblog_key}) end
submissions(base_hostname, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 31 def submissions(base_hostname, params={}) get "/#{API_VERSION}/blog/#{base_hostname}/posts/submission", params end
text(base_hostname, body, params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 35 def text(base_hostname, body, params={}) post "/#{API_VERSION}/blog/#{base_hostname}/post", params.merge!({"body" => body, "type" => "text"}) end
video(base_hostname, embed = nil, data = [], params={})
click to toggle source
# File lib/tumblr/client/blog.rb, line 71 def video(base_hostname, embed = nil, data = [], params={}) params["type"] = "video" params["embed"] = embed if embed unless data.empty? params["data[]"] = data.map{|file| OAuth::Helper.escape(File.open(file).binmode.read) } end post "/#{API_VERSION}/blog/#{base_hostname}/post", params end
Private Instance Methods
check_required_params(required_params, params)
click to toggle source
# File lib/tumblr/client/blog.rb, line 94 def check_required_params required_params, params required_params.each do |p| raise Tumblr::Error::MissingRequiredParameterError.new("Missing required parameter: #{p}") unless params.has_key? p end end