Class: TmdbEasy::Search

Inherits:
Base
  • Object
show all
Defined in:
lib/tmdb-easy/search.rb

Class Method Summary collapse

Methods inherited from Base

api_key, api_key=, base_api_url

Class Method Details

.company(keyword) ⇒ Object



17
18
19
20
21
22
# File 'lib/tmdb-easy/search.rb', line 17

def self.company(keyword)
  action_request = base_api_url + "search/company?api_key=#{@@api_key}&query=#{keyword}"

  response = api_response(action_request)
  companies = DeepOpenStruct.load(response).results
end

.movie(keyword, lang = 'en', adult = false) ⇒ Object



3
4
5
6
7
8
# File 'lib/tmdb-easy/search.rb', line 3

def self.movie(keyword, lang = 'en', adult = false)
  action_request = base_api_url + "search/movie?api_key=#{@@api_key}&query=#{keyword}&language=#{lang}&include_adult=#{adult}"

  response = api_response(action_request)
  movies = DeepOpenStruct.load(response).results
end

.person(keyword, adult = false) ⇒ Object



10
11
12
13
14
15
# File 'lib/tmdb-easy/search.rb', line 10

def self.person(keyword, adult = false)
  action_request = base_api_url + "search/person?api_key=#{@@api_key}&query=#{keyword}&include_adult=#{adult}"

  response = api_response(action_request)
  people = DeepOpenStruct.load(response).results
end