tumblr: add tumblr api client.

This commit is contained in:
evazion
2017-06-22 23:20:04 -05:00
parent c25ca4c45c
commit d5ce6c98ef
3 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
class TumblrApiClient < Struct.new(:api_key)
include HTTParty
base_uri "https://api.tumblr.com/v2/blog/"
def posts(blog_name, post_id)
response = self.class.get("/#{blog_name}/posts", query: { id: post_id, api_key: api_key })
response.parsed_response.with_indifferent_access[:response]
end
end