Module: Omdb::Api::PublicApi

Included in:
Client
Defined in:
lib/omdb/api/public_api.rb

Instance Method Summary collapse

Instance Method Details

#search(value, options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/omdb/api/public_api.rb', line 19

def search(value, options = {})
  Omdb::Api::Request.call(self, 'search', value, options) do |response|
    begin
      Omdb::Api::Collection.new(
        response.fetch('Search').map do |movie_data|
          response = format_response(movie_data)

          Omdb::Api::Movie.new(response)
        end
      )
    rescue StandardError
      Omdb::Api::Error.new(response)
    end
  end
end