Class: Yahoo::SE::Pages

Inherits:
Object
  • Object
show all
Includes:
Paginator
Defined in:
lib/yahoo-se/pages.rb

Constant Summary collapse

SERVICE_PATH =
"#{Yahoo::SE::SERVICE_PATH}/pageData"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Paginator

#last?, #method_missing, #next, #response, #total_results_available

Constructor Details

#initialize(domain, options = {}) ⇒ Pages

Returns a new instance of Pages.



21
22
23
24
25
26
27
# File 'lib/yahoo-se/pages.rb', line 21

def initialize(domain, options={})
  @domain = domain
  @options = options
  @options[:query] = domain
  @options[:results] = @options[:results] ||= 50
  @options[:start] = @options[:start] ||= 1
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Yahoo::SE::Paginator

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



19
20
21
# File 'lib/yahoo-se/pages.rb', line 19

def options
  @options
end

#requestObject (readonly)

Returns the value of attribute request.



18
19
20
# File 'lib/yahoo-se/pages.rb', line 18

def request
  @request
end

Instance Method Details

#resultsObject

Displays the results for pages data



30
31
32
33
34
# File 'lib/yahoo-se/pages.rb', line 30

def results
  raise ApplicationIDNotSet if Yahoo::SE.application_id.nil?
  @request = Yahoo::SE::Request.new(Yahoo::SE::Pages::SERVICE_PATH, @options)
  @results = @request.results
end