Class: KpApi::PeopleSearch
Instance Attribute Summary collapse
-
#keyword ⇒ Object
Returns the value of attribute keyword.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #found? ⇒ Boolean
-
#initialize(keyword) ⇒ PeopleSearch
constructor
A new instance of PeopleSearch.
- #peoples_count ⇒ Object
- #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) ⇒ PeopleSearch
Returns a new instance of PeopleSearch.
5 6 7 8 9 10 11 |
# File 'lib/kp_api/people_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/people_search.rb', line 3 def keyword @keyword end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/kp_api/people_search.rb', line 3 def url @url end |
Instance Method Details
#found? ⇒ Boolean
13 14 15 |
# File 'lib/kp_api/people_search.rb', line 13 def found? @page_count != 0 end |
#peoples_count ⇒ Object
17 18 19 |
# File 'lib/kp_api/people_search.rb', line 17 def peoples_count @json['searchPeoplesCountResult'] end |
#view ⇒ Object
21 22 23 24 25 |
# File 'lib/kp_api/people_search.rb', line 21 def view @json['searchPeople'].map do |film| people_hash(film) end end |