class Wykop::Operations::Search
Public Class Methods
new(client)
click to toggle source
Documentation: www.wykop.pl/dla-programistow/dokumentacja/#info6_6_1
# File lib/wykop/operations/search.rb, line 5 def initialize(client) @client = client @request = Wykop::Operations::Request.new(@client) end
Public Instance Methods
replace_url( p = {} )
click to toggle source
# File lib/wykop/operations/search.rb, line 31 def replace_url( p = {} ) standard_url = "#{@client.configuration.api_host}/banana/potato/appkey,#{@client.configuration.app_user_key}/userkey,#{@client.user_info['userkey']}/paged" if ! p.has_key?(:page) standard_url = standard_url.gsub(/\/paged/, '') else standard_url = standard_url.gsub(/paged/, "page,#{p[:page]}") end return standard_url.gsub(/banana/, p[:banana]).gsub(/potato/, p[:potato]) end
search_entries( p = {} )
click to toggle source
# File lib/wykop/operations/search.rb, line 15 def search_entries( p = {} ) if ! p.has_key?(:page); p[:page] = 0; end return @request.execute(replace_url( { :banana => 'search', :potato => 'entries', :page => p[:page] } ), { 'q' => p[:q] }) end
search_index( p = {} )
click to toggle source
# File lib/wykop/operations/search.rb, line 10 def search_index( p = {} ) if ! p.has_key?(:page); p[:page] = 0; end return @request.execute(replace_url( { :banana => 'search', :potato => 'index', :page => p[:page] } ), { 'q' => p[:q] }) end
search_links( p = {} )
click to toggle source
# File lib/wykop/operations/search.rb, line 25 def search_links( p = {} ) if ! p.has_key?(:page); p[:page] = 0; end p.delete(:page) return @request.execute(replace_url( { :banana => 'search', :potato => 'links', :page => p[:page] } ), p) end
search_profiles( p = {} )
click to toggle source
# File lib/wykop/operations/search.rb, line 20 def search_profiles( p = {} ) if ! p.has_key?(:page); p[:page] = 0; end return @request.execute(replace_url( { :banana => 'search', :potato => 'profiles', :page => p[:page] } ), { 'q' => p[:q] }) end