Class: KpApi::FilmSearch
Instance Attribute Summary collapse
-
#keyword ⇒ Object
Returns the value of attribute keyword.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #films_count ⇒ Object
- #found? ⇒ Boolean
-
#initialize(keyword) ⇒ FilmSearch
constructor
A new instance of FilmSearch.
- #view ⇒ Object
Methods inherited from Agent
#arr_data, #bool_data, #current_page, #data, #data2, #dn, #film_hash, #int_data, #json, #json2, #min_data, #next_page, #page_count, #people_hash, #s2a, #status, #status2, #str_data, #time_data, #url_data, #year_data
Constructor Details
#initialize(keyword) ⇒ FilmSearch
Returns a new instance of FilmSearch.
5 6 7 8 9 10 11 |
# File 'lib/kp_api/film_search.rb', line 5 def initialize(keyword) @keyword = URI.encode(keyword) @page = 1 gen_url @json = json @page_count = @json['pagesCount'] end |
Instance Attribute Details
#keyword ⇒ Object
Returns the value of attribute keyword.
3 4 5 |
# File 'lib/kp_api/film_search.rb', line 3 def keyword @keyword end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/kp_api/film_search.rb', line 3 def url @url end |
Instance Method Details
#films_count ⇒ Object
17 18 19 |
# File 'lib/kp_api/film_search.rb', line 17 def films_count @json['searchFilmsCountResult'] end |
#found? ⇒ Boolean
13 14 15 |
# File 'lib/kp_api/film_search.rb', line 13 def found? @page_count != 0 end |
#view ⇒ Object
21 22 23 24 25 |
# File 'lib/kp_api/film_search.rb', line 21 def view @json['searchFilms'].map do |film| film_hash(film, 'id') end end |