Class: Google::CustomSearch::Query
- Inherits:
-
Object
- Object
- Google::CustomSearch::Query
- Defined in:
- lib/google/custom_search/query.rb
Instance Method Summary collapse
-
#initialize(query_string, start_index, config = Google::CustomSearch.config) ⇒ Query
constructor
A new instance of Query.
- #results ⇒ Object
Constructor Details
#initialize(query_string, start_index, config = Google::CustomSearch.config) ⇒ Query
Returns a new instance of Query.
16 17 18 19 20 |
# File 'lib/google/custom_search/query.rb', line 16 def initialize(query_string, start_index, config = Google::CustomSearch.config) @query_string = query_string @start_index = start_index @service = config.service_type.new(config) end |
Instance Method Details
#results ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/google/custom_search/query.rb', line 22 def results attempts = 5 begin @service.request(@query_string, @start_index) rescue BadRequestError attempts -= 1 retry if attempts > 0 raise end end |