Class: Kinopoisk::Search
- Inherits:
-
Object
- Object
- Kinopoisk::Search
- Defined in:
- lib/kinopoisk/search.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
Returns the value of attribute query.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(query) ⇒ Search
constructor
A new instance of Search.
-
#movies ⇒ Object
Returns an array containing Kinopoisk::Movie instances.
-
#people ⇒ Object
Returns an array containing Kinopoisk::Person instances.
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
#query ⇒ Object
Returns the value of attribute query.
4 5 6 |
# File 'lib/kinopoisk/search.rb', line 4 def query @query end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/kinopoisk/search.rb', line 4 def url @url end |
Instance Method Details
#movies ⇒ Object
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 |
#people ⇒ Object
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 |