lib/tumblr/post.rb in tumblr_client-0.7.0 vs lib/tumblr/post.rb in tumblr_client-0.7.1
- old
+ new
@@ -2,19 +2,19 @@
module Post
STANDARD_POST_OPTIONS = [:state, :tags, :tweet, :date, :markdown, :slug, :format]
def edit(blog_name, options = {})
- post("v2/blog/#{blog_name}/post/edit", options)
+ post(blog_path(blog_name, 'post/edit'), options)
end
def reblog(blog_name, options = {})
- post("v2/blog/#{blog_name}/post/reblog", options)
+ post(blog_path(blog_name, 'post/reblog'), options)
end
def delete(blog_name, id)
- post("v2/blog/#{blog_name}/post/delete", :id => id)
+ post(blog_path(blog_name, 'post/delete'), :id => id)
end
def photo(blog_name, options = {})
valid_opts = STANDARD_POST_OPTIONS + [:caption, :link, :data, :data_raw, :source, :photoset_layout]
validate_options(valid_opts, options)
@@ -28,65 +28,69 @@
options.delete(:source)
end
options[:type] = 'photo'
extract_data!(options)
- post("v2/blog/#{blog_name}/post", options)
+ post(post_path(blog_name), options)
end
def quote(blog_name, options = {})
valid_opts = STANDARD_POST_OPTIONS + [:quote, :source]
validate_options(valid_opts, options)
options[:type] = 'quote'
- post("v2/blog/#{blog_name}/post", options)
+ post(post_path(blog_name), options)
end
def text(blog_name, options = {})
valid_opts = STANDARD_POST_OPTIONS + [:title, :body]
validate_options(valid_opts, options)
options[:type] = 'text'
- post("v2/blog/#{blog_name}/post", options)
+ post(post_path(blog_name), options)
end
def link(blog_name, options = {})
valid_opts = STANDARD_POST_OPTIONS + [:title, :url, :description]
validate_options(valid_opts, options)
options[:type] = 'link'
- post("v2/blog/#{blog_name}/post", options)
+ post(post_path(blog_name), options)
end
def chat(blog_name, options = {})
valid_opts = STANDARD_POST_OPTIONS + [:title, :conversation]
validate_options(valid_opts, options)
options[:type] = 'chat'
- post("v2/blog/#{blog_name}/post", options)
+ post(post_path(blog_name), options)
end
def audio(blog_name, options = {})
valid_opts = STANDARD_POST_OPTIONS + [:data, :data_raw, :caption, :external_url]
validate_options(valid_opts, options)
validate_no_collision options, [:data, :external_url]
options[:type] = 'audio'
extract_data!(options)
- post("v2/blog/#{blog_name}/post", options)
+ post(post_path(blog_name), options)
end
def video(blog_name, options = {})
valid_opts = STANDARD_POST_OPTIONS + [:data, :data_raw, :embed, :caption]
validate_options(valid_opts, options)
validate_no_collision options, [:data, :embed]
options[:type] = 'video'
extract_data!(options)
- post("v2/blog/#{blog_name}/post", options)
+ post(post_path(blog_name), options)
end
private
+
+ def post_path(blog_name)
+ blog_path(blog_name, 'post')
+ end
# Look for the various ways that data can be passed, and normalize
# the result in this hash
def extract_data!(options)
validate_no_collision options, [:data, :data_raw]