Class: MotionGiphy::Client
- Inherits:
-
Object
- Object
- MotionGiphy::Client
- Defined in:
- lib/motion-giphy/client.rb
Class Method Summary collapse
- .gif(id, &block) ⇒ Object
- .request ⇒ Object
- .search(query, options = {}, &block) ⇒ Object
- .trending(options = {}, &block) ⇒ Object
Class Method Details
.gif(id, &block) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/motion-giphy/client.rb', line 12 def self.gif(id, &block) request.get("#{id}") do |response| response.process_data_as_singular if response.success? block.call response end end |
.request ⇒ Object
26 27 28 |
# File 'lib/motion-giphy/client.rb', line 26 def self.request MotionGiphy::Request.new end |
.search(query, options = {}, &block) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/motion-giphy/client.rb', line 3 def self.search(query, = {}, &block) = { q: query }.merge() request.get("search", ) do |response| response.process_data_as_batch if response.success? block.call response end end |
.trending(options = {}, &block) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/motion-giphy/client.rb', line 19 def self.trending( = {}, &block) request.get("trending", ) do |response| response.process_data_as_batch if response.success? block.call response end end |