Giphy::Client
Inherits Reference < Object
Giphy::Client is the object that communicates with the GIPHY API.
To create a Giphy::Client
giphy = Giphy::Client.new <api_key>
NOTE: An api_key is required for Giphy::Client to communite with the GIHPY API.
Constants
Constructors
Instance methods
Generates a random id that can be used as random_id 2when sending a request to GIPHY.
NOTE: for more information see https://developers.giphy.com/docs/api/endpoint#random-id
Returns a gif based on the specified gif_id.
An ArgumentError is raised if gif_id is an empty string
Returns gifs based on the specified gif_ids.
An ArgumentError is raised if gif_ids is empty.
Returns a random gif based on the specified tag. If tag == "" the gif will be completely random.
Example: (default search)
g = Giphy::Client.new <api_key>
gif = g.random("oh weeew")
puts gif.data.url
Returns gifs from GIPHY based on search term q
Example: (default search)
g = Giphy::Client.new <api_key>
gifs = g.search("cats") # returns 25 gifs by default
gifs.data.each do |gif|
puts gif.title
end
Example: (search with params)
g = Giphy::Client.new <api_key>
params = Giphy::SearchParam.new 10
gifs = g.search("cats", params) # returns 10 gifs
Returns a single gif based on the search term s. Translate converts words and phrases to gifs using GIPHY's special sauce algorithm.
Example: (default search)
g = Giphy::Client.new <api_key>
gif = g.translate("oh weeew")
puts gif.data.title
Returns the most relevant and engaging gifs
Example: (default search)
g = Giphy::Client.new <api_key>
gifs = g.trending() # returns 25 gifs by default
gifs.data.each do |gif|
puts gif.title
end