class Loadgif::Client
Public Instance Methods
favorite(id)
click to toggle source
# File lib/loadgif/client.rb, line 16 def favorite(id) post("/#{id}/favorites") end
favorites(username='', options={})
click to toggle source
# File lib/loadgif/client.rb, line 20 def favorites(username='', options={}) options_hash = {username: username}.merge(options) get('/favorites', options_hash) end
gif(id)
click to toggle source
# File lib/loadgif/client.rb, line 33 def gif(id) get("/#{id}") end
gifs(ids)
click to toggle source
# File lib/loadgif/client.rb, line 37 def gifs(ids) get('', ids: ids.join(',')) end
random(tag='')
click to toggle source
# File lib/loadgif/client.rb, line 29 def random(tag='') get('/random', { tag: tag }) end
screensaver(tag)
click to toggle source
# File lib/loadgif/client.rb, line 25 def screensaver(tag) get('/screensaver', tag: tag) end
search(keyword, options={})
click to toggle source
# File lib/loadgif/client.rb, line 11 def search(keyword, options={}) options_hash = {q: keyword}.merge(options) get('/search', options_hash) end
translate(word)
click to toggle source
# File lib/loadgif/client.rb, line 7 def translate(word) get('/translate', s: word) end
trending(options={})
click to toggle source
# File lib/loadgif/client.rb, line 3 def trending(options={}) get('/trending', options) end
Private Instance Methods
get(path, options={})
click to toggle source
# File lib/loadgif/client.rb, line 43 def get(path, options={}) api_response = request.get(path, options) response(api_response) end
post(path, options={})
click to toggle source
# File lib/loadgif/client.rb, line 48 def post(path, options={}) api_response = request.post(path, options) response(api_response) end
request()
click to toggle source
# File lib/loadgif/client.rb, line 53 def request Loadgif::Request end
response(api_response)
click to toggle source
# File lib/loadgif/client.rb, line 57 def response(api_response) Loadgif::Response.build(api_response) end