serpapi / google-search-results-ruby

Google Search Results via SERP API Ruby Gem
https://serpapi.com
MIT License
52 stars 8 forks source link

[Google Related Questions API] Support for Related Questions API #13

Closed aliayar closed 1 year ago

aliayar commented 1 year ago

The Ruby package does not support related_questions_api as it checks the parameters before launching the request and can't find the "q" parameter which related_questions_api does not require.

The problem stems from these lines:

https://github.com/serpapi/google-search-results-ruby/blob/2ac987f67bbad0ed9d5fdcb62301abdc74947576/lib/search/serp_api_search.rb#L154-L180

The error is:

Ruby30-x64/lib/ruby/gems/3.0.0/gems/google_search_results-2.2.0/lib/search/serp_api_search.rb:178:in `check_params': missing required keys in params:  (SerpApiException)
 - q
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/google_search_results-2.2.0/lib/search/google_search.rb:36:in `initialize'
        from ./deneme.rb:23:in `new'
        from ./deneme.rb:23:in `block in <main>'
        from ./deneme.rb:15:in `each'
        from ./deneme.rb:15:in `<main>'
jvmvik commented 1 year ago

correct. This is a bad limitation in the current design. The next iteration of this library doesn't perform any parameters check on the client side. see: https://github.com/serpapi/serpapi-ruby