Class: Giphy::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/giphy/response.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



7
8
9
# File 'lib/giphy/response.rb', line 7

def initialize(response)
  @response = response
end

Class Method Details

.build(response) ⇒ Object



3
4
5
# File 'lib/giphy/response.rb', line 3

def self.build(response)
  new(response).data
end

Instance Method Details

#dataObject



11
12
13
14
# File 'lib/giphy/response.rb', line 11

def data
  raise Giphy::Errors::Unexpected unless response.body
  response.body['data'] || raise(Giphy::Errors::API.new(error))
end