Sha256: 304103a3492c5112eb5028b4845caafc52bc942272fb51d1632d1c94c9cdbba5

Contents?: true

Size: 853 Bytes

Versions: 1

Compression:

Stored size: 853 Bytes

Contents

module TMDB
  class Search
    include HTTParty

    attr_accessor :api_key

    base_uri 'http://api.themoviedb.org'

    def initialize(api_key='')
      @api_key = api_key
    end

    def configuration
      options = {api_key: self.api_key}
      self.class.get("/3/configuration", query: options).parsed_response
      # configuration['images']['base_url'] => "http://image.tmdb.org/t/p/" 
    end

    def movie_search(options = {})
      # Accepted parameters:
      # :page, :include_adult, :year
      options.merge!(api_key: self.api_key)
      self.class.get("/3/search/movie", query: options)['results']
    end

    def movie(movie_id)
      options = {api_key: self.api_key}
      self.class.get("/3/movie/#{movie_id}", query: options)
      # movie['title'] = "Fight Club"
    end

    # TODO: tv_search(query, page), tv(id)

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tmdb-0.1.0 lib/tmdb/search.rb