class KpApi::PeopleSearch

Attributes

keyword[RW]
url[RW]

Public Class Methods

new(keyword) click to toggle source
# 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

Public Instance Methods

found?() click to toggle source
# File lib/kp_api/people_search.rb, line 13
def found?
  @page_count != 0
end
peoples_count() click to toggle source
# File lib/kp_api/people_search.rb, line 17
def peoples_count
  @json['searchPeoplesCountResult']
end
view() click to toggle source
# File lib/kp_api/people_search.rb, line 21
def view
  @json['searchPeople'].map do |film|
    people_hash(film)
  end
end

Private Instance Methods

gen_url() click to toggle source
# File lib/kp_api/people_search.rb, line 29
def gen_url
  @url = [
    "#{DOMAINS[:api]}#{METHODS[:search_people][:method]}",
    "?#{METHODS[:search_people][:keyword]}=#{@keyword}",
    "&#{METHODS[:search_people][:page]}=#{@page}"
  ].join('')
end