lib-giphy
lib-giphy
A library that makes it easy to interact with the GIPHY API.
Requirements
To get the API key that is required to create a new Giphy::Client you need to create a GIPHY app.
"We require all apps that use GIPHY API to conspicuously display "Powered By GIPHY" attribution marks where the API is utilized (see SDK attribution guide here). You can find approved official logo marks here." - GIPHY API
Installation
-
Add the dependency to your
shard.yml:dependencies: lib-giphy: github: henrikac/lib-giphy -
Run
shards install
Usage
require "lib-giphy"
giphy = Giphy::Client.new <api_key>
gifs = giphy.search("cats") # => returns 25 gifs
trend_gifs = giphy.trending() # => returns 25 gifs
translated = giphy.translate("cats") # => returns 1 gif
random_gif = giphy.random() # => returns 1 gif
gifs.data.each do |gif|
puts gif.title
end
The Giphy::Client methods in the example above can also take a Param object as a second argument.
Different types of Param:
SearchParamTrendingParamTranslateParamRandomParam
Supported endpoints
- Trending
- Search
- Translate
- Random
- Action Register
- Random ID
- Get GIF by ID
- Get GIFs by ID
- Upload
- Categories
- Autocomplete
- Channel Search
- Search Suggestions
- Trending Search Terms
Contributing
- Fork it (https://github.com/henrikac/lib-giphy/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Henrik Christensen - creator and maintainer
Repository
lib-giphy
Owner
Statistic
- 6
- 0
- 3
- 0
- 2
- over 4 years ago
- April 19, 2021
License
MIT License
Links
Synced at
Tue, 23 Dec 2025 03:24:09 GMT
Languages