onewheel-google 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ad3869163e24212cb7b752c311224bd38a809c7c
4
+ data.tar.gz: 7fca1f5b9916965332015d5b5dedf01f2b84730b
5
+ SHA512:
6
+ metadata.gz: 2ccbeb854292d3e610c835315f9f6b7d0dbade7e8f71b3a501af0817c2906867d1e7c2c6cd690825ff7bccce5d34b1de01d470210fa91d3d7e3d619be0e2651a
7
+ data.tar.gz: fe1978fafffb7dfcc412e7c552342678d4b8e246ed398e2c7ca31c0abd7350437e6ced03efc5eac8833a3294bf22e27769f17e9a1312537be63250b429db4663
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .idea
2
+ coverage
3
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.7
4
+ - 2.2.5
5
+ - 2.3.0
6
+ script: bundle exec rake
7
+ before_install:
8
+ - gem update --system
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Andrew Kreps
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,34 @@
1
+ require 'rest-client'
2
+ require 'addressable'
3
+
4
+ class OnewheelGoogle
5
+ def self.search(query, cse_id, api_key, safe_search = 'high')
6
+ if query.empty?
7
+ puts 'Query blank, cannot continue.'
8
+ return
9
+ end
10
+
11
+ if cse_id.empty?
12
+ puts 'CSE_id blank, cannot continue.'
13
+ return
14
+ end
15
+
16
+ if api_key.empty?
17
+ puts 'api_key blank, cannot continue.'
18
+ return
19
+ end
20
+
21
+ uri = Addressable::URI.new
22
+ uri.query_values = {
23
+ q: query,
24
+ cx: cse_id,
25
+ # searchType: 'image',
26
+ num: 10,
27
+ key: api_key,
28
+ safe: safe_search}
29
+
30
+ response = RestClient.get "https://www.googleapis.com/customsearch/v1?#{uri.query}"
31
+ JSON.parse response
32
+ end
33
+
34
+ end
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'onewheel-google'
3
+ spec.version = '0.0.0'
4
+ spec.authors = ['Andrew Kreps']
5
+ spec.email = ['andrew.kreps@gmail.com']
6
+ spec.description = 'An interface of Google Custom Search Engine for searching.'
7
+ spec.summary = 'An abstracted way to access CSE.'
8
+ spec.homepage = 'https://github.com/onewheelskyward/onewheel-google'
9
+ spec.license = 'MIT'
10
+ spec.metadata = { 'lita_plugin_type' => 'handler' }
11
+
12
+ spec.files = `git ls-files`.split($/)
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ['lib']
16
+
17
+ spec.add_runtime_dependency 'rest-client', '~> 1.8'
18
+ spec.add_runtime_dependency 'addressable', '~> 2.4'
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.3'
21
+ spec.add_development_dependency 'rake', '~> 10.4'
22
+ spec.add_development_dependency 'rspec', '~> 3.3'
23
+ spec.add_development_dependency 'simplecov', '~> 0.10'
24
+ spec.add_development_dependency 'coveralls', '~> 0.8'
25
+ end
@@ -0,0 +1,373 @@
1
+ {
2
+ "kind": "customsearch#search",
3
+ "url": {
4
+ "type": "application/json",
5
+ "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
6
+ },
7
+ "queries": {
8
+ "request": [
9
+ {
10
+ "title": "Google Custom Search - google",
11
+ "totalResults": "586000000",
12
+ "searchTerms": "google",
13
+ "count": 10,
14
+ "startIndex": 1,
15
+ "inputEncoding": "utf8",
16
+ "outputEncoding": "utf8",
17
+ "safe": "medium",
18
+ "cx": "016450909327860943906:3a3e35xbkzu"
19
+ }
20
+ ],
21
+ "nextPage": [
22
+ {
23
+ "title": "Google Custom Search - google",
24
+ "totalResults": "586000000",
25
+ "searchTerms": "google",
26
+ "count": 10,
27
+ "startIndex": 11,
28
+ "inputEncoding": "utf8",
29
+ "outputEncoding": "utf8",
30
+ "safe": "medium",
31
+ "cx": "016450909327860943906:3a3e35xbkzu"
32
+ }
33
+ ]
34
+ },
35
+ "context": {
36
+ "title": "Google"
37
+ },
38
+ "searchInformation": {
39
+ "searchTime": 0.379835,
40
+ "formattedSearchTime": "0.38",
41
+ "totalResults": "586000000",
42
+ "formattedTotalResults": "586,000,000"
43
+ },
44
+ "items": [
45
+ {
46
+ "kind": "customsearch#result",
47
+ "title": "Google",
48
+ "htmlTitle": "<b>Google</b>",
49
+ "link": "https://www.google.com/",
50
+ "displayLink": "www.google.com",
51
+ "snippet": "Search the world's information, including webpages, images, videos and more. \nGoogle has many special features to help you find exactly what you're looking ...",
52
+ "htmlSnippet": "Search the world&#39;s information, including webpages, images, videos and more. <br>\n<b>Google</b> has many special features to help you find exactly what you&#39;re looking&nbsp;...",
53
+ "cacheId": "y14FcUQOGl4J",
54
+ "formattedUrl": "https://www.google.com/",
55
+ "htmlFormattedUrl": "https://www.<b>google</b>.com/",
56
+ "pagemap": {
57
+ "cse_thumbnail": [
58
+ {
59
+ "width": "217",
60
+ "height": "73",
61
+ "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcSDjB4zxWMGFPE5Ufxh9imLrO9Y6hBgfEIW10yzopUjieRByDBCHPOhoRg"
62
+ }
63
+ ],
64
+ "webpage": [
65
+ {
66
+ "image": "/images/branding/googleg/1x/googleg_standard_color_128dp.png"
67
+ }
68
+ ],
69
+ "cse_image": [
70
+ {
71
+ "src": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png"
72
+ }
73
+ ]
74
+ }
75
+ },
76
+ {
77
+ "kind": "customsearch#result",
78
+ "title": "Google News",
79
+ "htmlTitle": "<b>Google</b> News",
80
+ "link": "https://news.google.com/",
81
+ "displayLink": "news.google.com",
82
+ "snippet": "Comprehensive up-to-date news coverage, aggregated from sources all over the \nworld by Google News.",
83
+ "htmlSnippet": "Comprehensive up-to-date news coverage, aggregated from sources all over the <br>\nworld by <b>Google</b> News.",
84
+ "cacheId": "ozdoT-F6oa4J",
85
+ "formattedUrl": "https://news.google.com/",
86
+ "htmlFormattedUrl": "https://news.<b>google</b>.com/",
87
+ "pagemap": {
88
+ "cse_thumbnail": [
89
+ {
90
+ "width": "96",
91
+ "height": "72",
92
+ "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTpo2Q2fCHk43-ryr66t_hh3LvBIabbJKhYe6vbdOezoG0_HtgXKS8i"
93
+ }
94
+ ],
95
+ "metatags": [
96
+ {
97
+ "apple-itunes-app": "app-id=913753848",
98
+ "referrer": "origin"
99
+ }
100
+ ],
101
+ "cse_image": [
102
+ {
103
+ "src": "https://i.ytimg.com/vi/9LE9BFf42dY/default.jpg"
104
+ }
105
+ ]
106
+ }
107
+ },
108
+ {
109
+ "kind": "customsearch#result",
110
+ "title": "Google Drive - Cloud Storage & File Backup for Photos, Docs & More",
111
+ "htmlTitle": "<b>Google</b> Drive - Cloud Storage &amp; File Backup for Photos, Docs &amp; More",
112
+ "link": "https://www.google.com/drive/",
113
+ "displayLink": "www.google.com",
114
+ "snippet": "Get access to files anywhere through secure cloud storage and file backup for \nyour photos, videos, files and more with Google Drive.",
115
+ "htmlSnippet": "Get access to files anywhere through secure cloud storage and file backup for <br>\nyour photos, videos, files and more with <b>Google</b> Drive.",
116
+ "cacheId": "uqmo4lUVIlEJ",
117
+ "formattedUrl": "https://www.google.com/drive/",
118
+ "htmlFormattedUrl": "https://www.<b>google</b>.com/drive/",
119
+ "pagemap": {
120
+ "cse_thumbnail": [
121
+ {
122
+ "width": "143",
123
+ "height": "124",
124
+ "src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcS_lKvopIHhL6rRhr8y1qrRGy2KB48ew42YUVxVdJ7f_g7kuq2jocJyvBU"
125
+ }
126
+ ],
127
+ "metatags": [
128
+ {
129
+ "viewport": "width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no",
130
+ "og:title": "Google Drive - Cloud Storage & File Backup for Photos, Docs & More",
131
+ "og:image": "//www.google.com/drive/images/drive/logo-drive.png",
132
+ "og:description": "Get access to files anywhere through secure cloud storage and file backup for your photos, videos, files and more with Google Drive.",
133
+ "og:type": "website",
134
+ "msvalidate.01": "D93199779C0B5EE436644DE888FCC272",
135
+ "og:url": "https://www.google.com/drive/",
136
+ "twitter:card": "summary",
137
+ "twitter:url": "https://www.google.com/drive/",
138
+ "twitter:title": "Meet Google Drive – One place for all your files",
139
+ "twitter:image": "http://www.google.com/drive/images/drive/logo-drive.png",
140
+ "twitter:description": "Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage – free.",
141
+ "twitter:creator": "@google"
142
+ }
143
+ ],
144
+ "cse_image": [
145
+ {
146
+ "src": "https://www.google.com/drive/images/drive/logo-drive.png"
147
+ }
148
+ ]
149
+ }
150
+ },
151
+ {
152
+ "kind": "customsearch#result",
153
+ "title": "Google Maps",
154
+ "htmlTitle": "<b>Google</b> Maps",
155
+ "link": "https://maps.google.com/",
156
+ "displayLink": "maps.google.com",
157
+ "snippet": "Find local businesses, view maps and get driving directions in Google Maps.",
158
+ "htmlSnippet": "Find local businesses, view maps and get driving directions in <b>Google</b> Maps.",
159
+ "cacheId": "SK7Wkfiy_5IJ",
160
+ "formattedUrl": "https://maps.google.com/",
161
+ "htmlFormattedUrl": "https://maps.<b>google</b>.com/",
162
+ "pagemap": {
163
+ "cse_thumbnail": [
164
+ {
165
+ "width": "79",
166
+ "height": "79",
167
+ "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTTnonf_3aqokUadTh2YgBIuuXOeWCqwITHrCXiT1wkStRX8x1RDnJGJg"
168
+ }
169
+ ],
170
+ "metatags": [
171
+ {
172
+ "viewport": "initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no",
173
+ "google": "notranslate",
174
+ "referrer": "origin",
175
+ "og:title": "Google Maps",
176
+ "og:image": "https://maps.google.com/maps/api/staticmap?sensor=false&center=37.599999999999994%2C-95.665&zoom=4&size=256x256&language=en&client=google-maps-frontend&signature=ZHy6QGfQalhVZH-bZ4_LhChJzpg",
177
+ "og:description": "Find local businesses, view maps and get driving directions in Google Maps.",
178
+ "og:site_name": "Google Maps",
179
+ "twitter:card": "summary"
180
+ }
181
+ ],
182
+ "place": [
183
+ {
184
+ "name": "Google Maps",
185
+ "image": "https://maps.google.com/maps/api/staticmap?sensor=false&center=37.599999999999994%2C-95.665&zoom=4&size=256x256&language=en&client=google-maps-frontend&signature=ZHy6QGfQalhVZH-bZ4_LhChJzpg",
186
+ "description": "Find local businesses, view maps and get driving directions in Google Maps."
187
+ }
188
+ ],
189
+ "cse_image": [
190
+ {
191
+ "src": "https://ssl.gstatic.com/gb/images/silhouette_96.png"
192
+ }
193
+ ]
194
+ }
195
+ },
196
+ {
197
+ "kind": "customsearch#result",
198
+ "title": "Google Translate",
199
+ "htmlTitle": "<b>Google</b> Translate",
200
+ "link": "https://translate.google.com/",
201
+ "displayLink": "translate.google.com",
202
+ "snippet": "Google's free service instantly translates words, phrases, and web pages \nbetween English and over 100 other languages. English, Afrikaans, Albanian, \nAmharic, ...",
203
+ "htmlSnippet": "<b>Google&#39;s</b> free service instantly translates words, phrases, and web pages <br>\nbetween English and over 100 other languages. English, Afrikaans, Albanian, <br>\nAmharic,&nbsp;...",
204
+ "cacheId": "InKXtjHqSVgJ",
205
+ "formattedUrl": "https://translate.google.com/",
206
+ "htmlFormattedUrl": "https://translate.<b>google</b>.com/",
207
+ "pagemap": {
208
+ "metatags": [
209
+ {
210
+ "google": "notranslate"
211
+ }
212
+ ]
213
+ }
214
+ },
215
+ {
216
+ "kind": "customsearch#result",
217
+ "title": "Google Hangouts",
218
+ "htmlTitle": "<b>Google</b> Hangouts",
219
+ "link": "https://hangouts.google.com/",
220
+ "displayLink": "hangouts.google.com",
221
+ "snippet": "Hangouts bring conversations to life with photos, emoji, and even group video \ncalls for free. Connect with friends across computers, Android, and Apple devices\n.",
222
+ "htmlSnippet": "Hangouts bring conversations to life with photos, emoji, and even group video <br>\ncalls for free. Connect with friends across computers, Android, and Apple devices<br>\n.",
223
+ "cacheId": "GWWQi6h3N3kJ",
224
+ "formattedUrl": "https://hangouts.google.com/",
225
+ "htmlFormattedUrl": "https://hangouts.<b>google</b>.com/",
226
+ "pagemap": {
227
+ "cse_thumbnail": [
228
+ {
229
+ "width": "102",
230
+ "height": "102",
231
+ "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTkwbdtJvIpUBOASjoxjzITjsaSe-TC_MVSAwLaYkw-gV3caaQUkZAI"
232
+ }
233
+ ],
234
+ "product": [
235
+ {
236
+ "name": "Google Hangouts",
237
+ "description": "Hangouts bring conversations to life with photos, emoji, and even group video calls for free. Connect with friends across computers, Android, and Apple devices.",
238
+ "image": "https://www.gstatic.com/images/icons/material/product/2x/hangouts_64dp.png"
239
+ }
240
+ ],
241
+ "metatags": [
242
+ {
243
+ "og:description": "Hangouts bring conversations to life with photos, emoji, and even group video calls for free. Connect with friends across computers, Android, and Apple devices.",
244
+ "twitter:description": "Hangouts bring conversations to life with photos, emoji, and even group video calls for free.",
245
+ "og:image": "https://www.gstatic.com/images/icons/material/product/2x/hangouts_64dp.png",
246
+ "og:type": "website",
247
+ "og:title": "Google Hangouts",
248
+ "twitter:card": "product",
249
+ "twitter:site": "@google",
250
+ "twitter:title": "Google Hangouts",
251
+ "twitter:image:src": "https://www.gstatic.com/images/icons/material/product/2x/hangouts_64dp.png",
252
+ "viewport": "width=device-width, initial-scale=1"
253
+ }
254
+ ],
255
+ "cse_image": [
256
+ {
257
+ "src": "https://www.gstatic.com/images/icons/material/product/2x/hangouts_64dp.png"
258
+ }
259
+ ],
260
+ "hproduct": [
261
+ {
262
+ "description": "Hangouts bring conversations to life with photos, emoji, and even group video calls for free. Connect with friends across computers, Android, and Apple devices.",
263
+ "fn": "Google Hangouts",
264
+ "photo": "https://www.gstatic.com/images/icons/material/product/2x/hangouts_64dp.png"
265
+ }
266
+ ]
267
+ }
268
+ },
269
+ {
270
+ "kind": "customsearch#result",
271
+ "title": "Google Images",
272
+ "htmlTitle": "<b>Google</b> Images",
273
+ "link": "https://images.google.com/",
274
+ "displayLink": "images.google.com",
275
+ "snippet": "Google Images. The most comprehensive image search on the web.",
276
+ "htmlSnippet": "<b>Google</b> Images. The most comprehensive image search on the web.",
277
+ "cacheId": "53q8dRS-MysJ",
278
+ "formattedUrl": "https://images.google.com/",
279
+ "htmlFormattedUrl": "https://images.<b>google</b>.com/",
280
+ "pagemap": {
281
+ "webpage": [
282
+ {
283
+ "image": "/images/branding/googleg/1x/googleg_standard_color_128dp.png"
284
+ }
285
+ ]
286
+ }
287
+ },
288
+ {
289
+ "kind": "customsearch#result",
290
+ "title": "Google+",
291
+ "htmlTitle": "Google+",
292
+ "link": "https://plus.google.com/",
293
+ "displayLink": "plus.google.com",
294
+ "snippet": "Enter your email. Need help? Sign in with a different account Create account. \nOne Google Account for everything Google. About Google · Privacy · Terms · \nHelp.",
295
+ "htmlSnippet": "Enter your email. Need help? Sign in with a different account Create account. <br>\nOne <b>Google</b> Account for everything <b>Google</b>. About <b>Google</b> &middot; Privacy &middot; Terms &middot; <br>\nHelp.",
296
+ "cacheId": "INDMkJEFRpcJ",
297
+ "formattedUrl": "https://plus.google.com/",
298
+ "htmlFormattedUrl": "https://plus.<b>google</b>.com/",
299
+ "pagemap": {
300
+ "metatags": [
301
+ {
302
+ "viewport": "width=300, initial-scale=1"
303
+ }
304
+ ]
305
+ }
306
+ },
307
+ {
308
+ "kind": "customsearch#result",
309
+ "title": "Google Groups",
310
+ "htmlTitle": "<b>Google</b> Groups",
311
+ "link": "https://groups.google.com/",
312
+ "displayLink": "groups.google.com",
313
+ "snippet": "Google Groups allows you to create and participate in online forums and email-\nbased groups with a rich experience for community conversations.",
314
+ "htmlSnippet": "<b>Google</b> Groups allows you to create and participate in online forums and email-<br>\nbased groups with a rich experience for community conversations.",
315
+ "cacheId": "NtOoUU9wCTgJ",
316
+ "formattedUrl": "https://groups.google.com/",
317
+ "htmlFormattedUrl": "https://groups.<b>google</b>.com/",
318
+ "pagemap": {
319
+ "cse_thumbnail": [
320
+ {
321
+ "width": "74",
322
+ "height": "74",
323
+ "src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRteZe_WmKE33kZpUf7ysz6GIqCJtk10_1XCjLvP9QHhHkTkMJ3tNDSLA"
324
+ }
325
+ ],
326
+ "metatags": [
327
+ {
328
+ "gwt:property": "locale=en",
329
+ "standalone::gwt:property": "baseUrl=/forum/"
330
+ }
331
+ ],
332
+ "cse_image": [
333
+ {
334
+ "src": "https://groups.google.com/forum/browse-all-color.png"
335
+ }
336
+ ]
337
+ }
338
+ },
339
+ {
340
+ "kind": "customsearch#result",
341
+ "title": "Google Play",
342
+ "htmlTitle": "<b>Google</b> Play",
343
+ "link": "https://play.google.com/store?hl=en",
344
+ "displayLink": "play.google.com",
345
+ "snippet": "Enjoy millions of the latest Android apps, games, music, movies, TV, books, \nmagazines & more. Anytime, anywhere, across your devices.",
346
+ "htmlSnippet": "Enjoy millions of the latest Android apps, games, music, movies, TV, books, <br>\nmagazines &amp; more. Anytime, anywhere, across your devices.",
347
+ "cacheId": "Oje0jITxpTYJ",
348
+ "formattedUrl": "https://play.google.com/store?hl=en",
349
+ "htmlFormattedUrl": "https://play.<b>google</b>.com/store?hl=en",
350
+ "pagemap": {
351
+ "cse_thumbnail": [
352
+ {
353
+ "width": "299",
354
+ "height": "168",
355
+ "src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTNBSFSFUqY-gWxg1s3QhQ4aGezSYh_kQUurRS5llWA8PMmQ8DhSqi_NCM"
356
+ }
357
+ ],
358
+ "metatags": [
359
+ {
360
+ "og:type": "website",
361
+ "og:title": "Google Play",
362
+ "og:url": "https://play.google.com/store"
363
+ }
364
+ ],
365
+ "cse_image": [
366
+ {
367
+ "src": "https://lh3.googleusercontent.com/2y9FbHOcYZ1m_tSIL1SissYzl2QKZ0GhFpdjJxND8XdyO5pKek2tJP6209Pymgvjuds=w515"
368
+ }
369
+ ]
370
+ }
371
+ }
372
+ ]
373
+ }
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe OnewheelGoogle do
4
+ before(:each) do
5
+ mock_result_json = File.open('spec/fixtures/mock_result.json').read
6
+ allow(RestClient).to receive(:get).and_return(mock_result_json)
7
+ end
8
+
9
+ it 'does neat googly things' do
10
+ result = OnewheelGoogle::search('google', 'cse', 'api', 'high')
11
+ expect(result['items'][0]['title']).to eq('Google')
12
+ end
13
+
14
+ it 'does not do neat googly things' do
15
+ result = OnewheelGoogle::search('', 'cse', 'nope', 'high')
16
+ expect(result).to eq(nil)
17
+ end
18
+
19
+ it 'does not do neat googly things' do
20
+ result = OnewheelGoogle::search('google', '', 'nope', 'high')
21
+ expect(result).to eq(nil)
22
+ end
23
+
24
+ it 'does not do neat googly things' do
25
+ result = OnewheelGoogle::search('google', 'xyz', '', 'high')
26
+ expect(result).to eq(nil)
27
+ end
28
+ end
@@ -0,0 +1,16 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ SimpleCov.formatters = [
4
+ SimpleCov::Formatter::HTMLFormatter,
5
+ Coveralls::SimpleCov::Formatter
6
+ ]
7
+ SimpleCov.start { add_filter '/spec/' }
8
+
9
+ require 'onewheel-google'
10
+
11
+ describe 'tests' do
12
+ it 'will call google and get things' do
13
+ mock_result_json = File.open('spec/fixtures/mock_result.json').read
14
+ allow(RestClient).to receive(:get).and_return(mock_result_json)
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: onewheel-google
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kreps
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-08 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: '1.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: addressable
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.10'
97
+ - !ruby/object:Gem::Dependency
98
+ name: coveralls
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.8'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.8'
111
+ description: An interface of Google Custom Search Engine for searching.
112
+ email:
113
+ - andrew.kreps@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".travis.yml"
120
+ - Gemfile
121
+ - LICENSE
122
+ - Rakefile
123
+ - lib/onewheel-google.rb
124
+ - onewheel-google.gemspec
125
+ - spec/fixtures/mock_result.json
126
+ - spec/onewheel_google_spec.rb
127
+ - spec/spec_helper.rb
128
+ homepage: https://github.com/onewheelskyward/onewheel-google
129
+ licenses:
130
+ - MIT
131
+ metadata:
132
+ lita_plugin_type: handler
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.5.1
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: An abstracted way to access CSE.
153
+ test_files:
154
+ - spec/fixtures/mock_result.json
155
+ - spec/onewheel_google_spec.rb
156
+ - spec/spec_helper.rb