Module: Google::Search::OrderBy

Included in:
Blog, News, Patent, Video
Defined in:
lib/google-search/search/mixins/order_by.rb

Constant Summary collapse

ORDER_BY =

– Constants ++

:relevance, :date

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#order_byObject

Order by. Defaults to :relevance

- :relevance
- :date

19
20
21
# File 'lib/google-search/search/mixins/order_by.rb', line 19

def order_by
  @order_by
end

Instance Method Details

#get_uri_paramsObject

:nodoc:


30
31
32
33
# File 'lib/google-search/search/mixins/order_by.rb', line 30

def get_uri_params
  validate(:order_by) { |order| order.nil? || ORDER_BY.include?(order) }
  super + [[:scoring, order_by ? 'd' : nil]]
end

#initialize(options = {}, &block) ⇒ Object

:nodoc:


23
24
25
26
# File 'lib/google-search/search/mixins/order_by.rb', line 23

def initialize options = {}, &block
  @order_by = options.delete :order_by
  super
end