google_search_engine 0.0.1

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 +7 -0
  2. data/lib/google_search_engine.rb +19 -0
  3. metadata +71 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c50c9f5c621299109f410ac4c42cce6f1a48328453a4a8cee61260c1ee31be0a
4
+ data.tar.gz: 9b84914db1a2dda1a42ecf8edac2d9720aed6bfb3366223a8305b50bf453a68a
5
+ SHA512:
6
+ metadata.gz: 11299ebac491d2be7cb5d1412ae704cade8d04dacb7b7143b276bf7474e155560b8445ac8ae70a77c250bcd9fe223e9995a42e402c810610f22ffe253d7f9509
7
+ data.tar.gz: 32c24b9efc1e29f328e289e5d891e5327100061dd27327e6d7257b5069a362caa983673cee287df838061c827682613047bb48429da4dffcffb3f6179a2296eb
@@ -0,0 +1,19 @@
1
+ require 'rest-client'
2
+ require 'json'
3
+
4
+ module Google
5
+ def self.search(query:, date_restrict: 'd', sort: :date, safe: :active)
6
+ base_url = 'https://www.googleapis.com/customsearch/v1'
7
+ response = RestClient.get base_url, {
8
+ params: {
9
+ key: ENV['GOOGLE_SEARCH_KEY'],
10
+ cx: ENV['GOOGLE_SEARCH_DEFAULT_ENGINE_ID'],
11
+ q: query,
12
+ dateRestrict: date_restrict,
13
+ sort:, safe:
14
+ }
15
+ }
16
+
17
+ JSON.parse(response.body)
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: google_search_engine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gedean Dias
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-11-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2'
41
+ description: Wrapper for Google Search Engine API
42
+ email: gedean.dias@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - lib/google_search_engine.rb
48
+ homepage: https://github.com/gedean/google_search_engine
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '3'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.5.23
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Google Search Engine Wrapper
71
+ test_files: []