class Gfycat::Client
Public Class Methods
new(options = {})
click to toggle source
# File lib/gfycat/client.rb, line 5 def initialize(options = {}) @client = JsonClient.new(api_url, **options) end
Public Instance Methods
exists?(url)
click to toggle source
# File lib/gfycat/client.rb, line 19 def exists?(url) response = @client.get("checkUrl/#{CGI::escape(url)}") !!response["url_known"] end
get(name)
click to toggle source
# File lib/gfycat/client.rb, line 14 def get(name) response = @client.get("get/#{name}") Resources::Item.new(response["gfy_item"]) end
transcode!(source)
click to toggle source
# File lib/gfycat/client.rb, line 9 def transcode!(source) response = @client.get(transcode_url, fetchUrl: source) response["gfy_name"] end
Protected Instance Methods
api_url()
click to toggle source
# File lib/gfycat/client.rb, line 25 def api_url "http://gfycat.com/cajax" end
transcode_url()
click to toggle source
# File lib/gfycat/client.rb, line 29 def transcode_url "http://upload.gfycat.com/transcode/#{SecureRandom.hex(5)}" end