Module: Tumblr::Client::Blog
- Included in:
- Tumblr::Client
- Defined in:
- lib/tumblr/client/blog.rb
Instance Method Summary collapse
- #audio(base_hostname, external_url = nil, data = [], params = {}) ⇒ Object
- #avatar(base_hostname, params = {}) ⇒ Object
- #blog_info(base_hostname, params = {}) ⇒ Object
- #chat(base_hostname, conversation, params = {}) ⇒ Object
- #delete_post(base_hostname, id, params = {}) ⇒ Object
- #drafts(base_hostname, params = {}) ⇒ Object
- #edit(base_hostname, id, params = {}) ⇒ Object
- #followers(base_hostname, params = {}) ⇒ Object
- #link(base_hostname, url, params = {}) ⇒ Object
- #photo(base_hostname, source = nil, data = [], params = {}) ⇒ Object
- #posts(base_hostname, params = {}) ⇒ Object
- #queue(base_hostname, params = {}) ⇒ Object
- #quote(base_hostname, quote, params = {}) ⇒ Object
- #reblog(base_hostname, id, reblog_key, params = {}) ⇒ Object
- #submissions(base_hostname, params = {}) ⇒ Object
- #text(base_hostname, body, params = {}) ⇒ Object
- #video(base_hostname, embed = nil, data = [], params = {}) ⇒ Object
Instance Method Details
#audio(base_hostname, external_url = nil, data = [], params = {}) ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# 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 = {}) ⇒ Object
11 12 13 |
# 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 = {}) ⇒ Object
7 8 9 |
# 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 = {}) ⇒ Object
56 57 58 |
# 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 = {}) ⇒ Object
88 89 90 |
# 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 = {}) ⇒ Object
27 28 29 |
# 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 = {}) ⇒ Object
80 81 82 |
# 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 = {}) ⇒ Object
15 16 17 |
# 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 = {}) ⇒ Object
52 53 54 |
# 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 = {}) ⇒ Object
39 40 41 42 43 44 45 46 |
# 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 = {}) ⇒ Object
19 20 21 |
# 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 = {}) ⇒ Object
23 24 25 |
# 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 = {}) ⇒ Object
48 49 50 |
# 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 = {}) ⇒ Object
84 85 86 |
# 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 = {}) ⇒ Object
31 32 33 |
# 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 = {}) ⇒ Object
35 36 37 |
# 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 = {}) ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/tumblr/client/blog.rb', line 71 def video(base_hostname, = nil, data = [], params={}) params["type"] = "video" params["embed"] = if 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 |