google_search_results 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37245404ba2b79b279c3719ed9b0142aa8914d80564cd6cfd70af9a2dcd4f56d
4
- data.tar.gz: ae3bec079837ac373d4ffa4ff862b32212d914bde417184e5cb3627de38762ea
3
+ metadata.gz: 9cf8b604485ff927dae81c9fd1a5017d92563b339bc77994e0365926a14f6192
4
+ data.tar.gz: 46cca48662a2bfe6d7b7c79e34b92afa931d3be9e8cf38eb139d6d086068d2c7
5
5
  SHA512:
6
- metadata.gz: b4e94b1c4902bc506e03c0b1461564ace6052925cb286a7e135634f76fdc81e9ed62833a440d77d8a32e0699745314f4cd1e4e72e22f14499dffa4fbee9dc935
7
- data.tar.gz: d3199c0440f4f68ae947617c867e5a68ec516b2d60870c763fef538762f93f88d695660f5dad98fe18100b096396941fd5d2e49e59d0c8bec709f22e2ab08078
6
+ metadata.gz: 6d26a044da90201b3c7e77841e7acc5bce8f0534ad7840df78b42120a7549ca79a3b787af90ad25e1062713b47a0fe7ab32b000a9ada008f27a64421ae97370c
7
+ data.tar.gz: 5257a57981176ee85df134f6bc89e1eebf2b16e44d0d3c90ee72a63541359b83e9ac8a69639c41c87d9f8a2eeb6571360bd223bd87b8474f90c3aa0a53b4796d
@@ -10,11 +10,11 @@ require_relative 'serp_api_client'
10
10
  # api_key: "Serp API Key"
11
11
  # }
12
12
  #
13
- # client = BaiduSearchResults.new(parameter)
13
+ # search = BaiduSearchResults.new(parameter)
14
14
  #
15
- # html_results = client.get_html
16
- # hash_results = client.get_hash
17
- # json_results = client.get_json
15
+ # html_results = search.get_html
16
+ # hash_results = search.get_hash
17
+ # json_results = search.get_json
18
18
  #
19
19
  # ```
20
20
  # doc: https://serpapi.com/baidu-search-api
@@ -11,12 +11,12 @@ require_relative '../lib/bing_search_results'
11
11
  # api_key: "Your SERP API Key"
12
12
  # }
13
13
  #
14
- # client = BingSearchResults.new(parameter)
15
- # client.params[:location] = "Portland"
14
+ # search = BingSearchResults.new(parameter)
15
+ # search.params[:location] = "Portland"
16
16
  #
17
- # html_results = client.get_html
18
- # hash_results = client.get_hash
19
- # json_results = client.get_json
17
+ # html_results = search.get_html
18
+ # hash_results = search.get_hash
19
+ # json_results = search.get_json
20
20
  #
21
21
  # ```
22
22
  #
@@ -10,12 +10,12 @@ require_relative 'serp_api_client'
10
10
  # api_key: "Your SERP API Key"
11
11
  # }
12
12
  #
13
- # client = EbaySearchResults.new(parameter)
14
- # client.params[:ebay_domain] = "ebay.com"
13
+ # search = EbaySearchResults.new(parameter)
14
+ # search.params[:ebay_domain] = "ebay.com"
15
15
  #
16
- # html_results = client.get_html
17
- # hash_results = client.get_hash
18
- # json_results = client.get_json
16
+ # html_results = search.get_html
17
+ # hash_results = search.get_hash
18
+ # json_results = search.get_json
19
19
  #
20
20
  # ```
21
21
  #
@@ -20,12 +20,12 @@ require_relative 'serp_api_client'
20
20
  # api_key: "Your SERP API Key"
21
21
  # }
22
22
  #
23
- # client = GoogleSearchResults.new(parameter)
24
- # client.params[:location] = "Portland"
23
+ # search = GoogleSearchResults.new(parameter)
24
+ # search.params[:location] = "Portland"
25
25
  #
26
- # html_results = client.get_html
27
- # hash_results = client.get_hash
28
- # json_results = client.get_json
26
+ # html_results = search.get_html
27
+ # hash_results = search.get_hash
28
+ # json_results = search.get_json
29
29
  # ```
30
30
  #
31
31
  # doc: https://serpapi.com/search-api
@@ -9,12 +9,11 @@ YANDEX_ENGINE = 'yandex'
9
9
  EBAY_ENGINE = 'ebay'
10
10
 
11
11
 
12
- # Generic serpapi.com client
13
- # which allow to custom cutting edge search service
14
- # by setting the engine paremeter.
12
+ # Generic HTTP client for serpapi.com
13
+ #
15
14
  class SerpApiClient
16
15
 
17
- VERSION = "1.3.0"
16
+ VERSION = "1.3.2"
18
17
  BACKEND = "serpapi.com"
19
18
 
20
19
  attr_accessor :params
@@ -26,15 +25,16 @@ class SerpApiClient
26
25
  #
27
26
  # ```ruby
28
27
  # require 'google_search_results'
29
- # client = SerpApiClient.new({q: "coffee", api_key: "secure API key"}, "google")
30
- # result = client.get_json
28
+ # search = SerpApiClient.new({q: "coffee", api_key: "secure API key", engine: "google"})
29
+ # result = search.get_json
31
30
  # ```
32
31
  #
33
32
  # @param [Hash] params contains requested parameter
34
- # @param [String] engine google|baidu|google|bing|ebay|yandex
35
- def initialize(params, engine)
33
+ # @param [String] engine google|baidu|google|bing|ebay|yandex (optional or can be set in params)
34
+ def initialize(params, engine = nil)
36
35
  @params = params
37
36
  @params[:engine] ||= engine
37
+ raise 'engine must be defined in params or a second argument' if @params[:engine].nil?
38
38
  end
39
39
 
40
40
  # get_json
@@ -117,7 +117,7 @@ class SerpApiClient
117
117
  $serp_api_key = api_key
118
118
  end
119
119
 
120
- # @return [String] api_key for this client
120
+ # @return [String] api_key for this search
121
121
  def api_key
122
122
  @params[:api_key] || @params[:serp_api_key] || $serp_api_key
123
123
  end
@@ -10,12 +10,12 @@ require_relative 'serp_api_client'
10
10
  # api_key: "Your SERP API Key"
11
11
  # }
12
12
  #
13
- # client = YahooSearchResults.new(parameter)
14
- # client.params[:yahoo_domain] = "fr"
13
+ # search = YahooSearchResults.new(parameter)
14
+ # search.params[:yahoo_domain] = "fr"
15
15
  #
16
- # html_results = client.get_html
17
- # hash_results = client.get_hash
18
- # json_results = client.get_json
16
+ # html_results = search.get_html
17
+ # hash_results = search.get_hash
18
+ # json_results = search.get_json
19
19
  #
20
20
  # ```
21
21
  #
@@ -10,12 +10,12 @@ require_relative 'serp_api_client'
10
10
  # api_key: "Your SERP API Key"
11
11
  # }
12
12
  #
13
- # client = YandexSearchResults.new(parameter)
14
- # client.params[:yandex_domain] = "yandex.com"
13
+ # search = YandexSearchResults.new(parameter)
14
+ # search.params[:yandex_domain] = "yandex.com"
15
15
  #
16
- # html_results = client.get_html
17
- # hash_results = client.get_hash
18
- # json_results = client.get_json
16
+ # html_results = search.get_html
17
+ # hash_results = search.get_hash
18
+ # json_results = search.get_json
19
19
  #
20
20
  # ```
21
21
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_search_results
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hartator
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-31 00:00:00.000000000 Z
12
+ date: 2020-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 0.39.0
62
+ version: 0.49.1
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 0.39.0
69
+ version: 0.49.1
70
70
  description: Scape localized search results from search engine using SerpApi.com and
71
71
  returns Hash, JSON, raw HTML
72
72
  email: hartator@gmail.com