Class: Kinopoisk::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/kinopoisk/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ Search

Returns a new instance of Search.



6
7
8
9
# File 'lib/kinopoisk/search.rb', line 6

def initialize(query)
  @query = query
  @url   = SEARCH_URL + URI.escape(query.to_s)
end

Instance Attribute Details

#queryObject

Returns the value of attribute query.



4
5
6
# File 'lib/kinopoisk/search.rb', line 4

def query
  @query
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/kinopoisk/search.rb', line 4

def url
  @url
end

Instance Method Details

#moviesObject

Returns an array containing Kinopoisk::Movie instances



12
13
14
# File 'lib/kinopoisk/search.rb', line 12

def movies
  find_nodes('film').map{|n| new_movie n }
end

#peopleObject

Returns an array containing Kinopoisk::Person instances



17
18
19
# File 'lib/kinopoisk/search.rb', line 17

def people
  find_nodes('name').map{|n| new_person n }
end