Class: Gfycat::Client
- Inherits:
-
Object
- Object
- Gfycat::Client
- Defined in:
- lib/gfycat/client.rb
Instance Method Summary collapse
- #exists?(url) ⇒ Boolean
- #get(name) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #transcode!(source) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 |
# File 'lib/gfycat/client.rb', line 5 def initialize( = {}) @client = JsonClient.new(api_url, **) end |
Instance Method Details
#exists?(url) ⇒ Boolean
19 20 21 22 |
# File 'lib/gfycat/client.rb', line 19 def exists?(url) response = @client.get("checkUrl/#{CGI::escape(url)}") !!response["url_known"] end |
#get(name) ⇒ Object
14 15 16 17 |
# File 'lib/gfycat/client.rb', line 14 def get(name) response = @client.get("get/#{name}") Resources::Item.new(response["gfy_item"]) end |
#transcode!(source) ⇒ Object
9 10 11 12 |
# File 'lib/gfycat/client.rb', line 9 def transcode!(source) response = @client.get(transcode_url, fetchUrl: source) response["gfy_name"] end |