Class: RatingsAggregator::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/ratings_aggregator/api.rb

Constant Summary collapse

API_URL =
"http://www.omdbapi.com/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#responseObject

Returns the value of attribute response.



10
11
12
# File 'lib/ratings_aggregator/api.rb', line 10

def response
  @response
end

Instance Method Details

#call(params) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/ratings_aggregator/api.rb', line 11

def call(params)
  response = RestClient.get API_URL, params: params
    {
      code: response.code,
      data: JSON.parse(response.body)
    }
end