google_search_results 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google_search_results.rb +6 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e75dbb1a41dce3064428df1892c5df64303fc834
4
- data.tar.gz: daf75e1ce5b65da69c0e685e887e227f5019dcfe
3
+ metadata.gz: '0899a32cef6abed47a9b920b7ec17ebda201ab81'
4
+ data.tar.gz: 7bd94626b964705d2075c4fe7642c966bbfd68c3
5
5
  SHA512:
6
- metadata.gz: 40536a6fde13196006e48fcd4540122302e68e1d147373bfc56f8b0a07b81930506e2d8b8825b8567dcc4572c3627743301230e538da1b3310a2b6cb5e798215
7
- data.tar.gz: 0d717386a0483ac1da341401c108451db5b65f28c4b773eb82efe1908a00fbbbb57895b002ddc0d3fe062b90c4cb282b51de254cf67b7cf682247c0c72f87002
6
+ metadata.gz: 90a1a22f6a293af5374a129d4c2895e58c4eb5c2b04e1589a270d5ab1aac8dcc5253ac33c372e58dea0af70d0a4ce91cdd0a2afbc0204b536b089726f681eceb
7
+ data.tar.gz: 7783e0c512887a162ed174cc4b846fedfe4d2d97f46ce6e742b3c3069b36377e810e99cd2824cea796b9a5313203ed525f68e3ebe03e0f148ec875e88c9848a2
@@ -6,9 +6,11 @@ require_relative 'google_search_results/hash'
6
6
 
7
7
  class GoogleSearchResults
8
8
 
9
- VERSION = "0.0.2"
9
+ VERSION = "0.1.0"
10
10
  BACKEND = "serpapi.com"
11
11
 
12
+ @@serp_api_key = nil
13
+
12
14
  class << self
13
15
  attr_accessor :serp_api_key
14
16
  end
@@ -21,7 +23,9 @@ class GoogleSearchResults
21
23
 
22
24
  def construct_url
23
25
  @params[:source] = "ruby"
24
- @params[:serp_api_key] = (@params[:serp_api_key] ? @params[:serp_api_key] : @@serp_api_key)
26
+ if @params[:serp_api_key].nil? and GoogleSearchResults.serp_api_key
27
+ @params[:serp_api_key] = GoogleSearchResults.serp_api_key
28
+ end
25
29
  URI::HTTPS.build(host: BACKEND, path: '/search', query: URI.encode_www_form(@params))
26
30
  end
27
31
 
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: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - hartator