Class: MotionGiphy::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-giphy/client.rb

Class Method Summary collapse

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

.requestObject



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, options = {}, &block)
  options = { q: query }.merge(options)

  request.get("search", options) do |response|
    response.process_data_as_batch if response.success?
    block.call response
  end
end


19
20
21
22
23
24
# File 'lib/motion-giphy/client.rb', line 19

def self.trending(options = {}, &block)
  request.get("trending", options) do |response|
    response.process_data_as_batch if response.success?
    block.call response
  end
end