lita-onewheel-images 0.2.0 → 0.3.0

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
  SHA1:
3
- metadata.gz: a76b6fcfa5b5becfae3a57e6b9cbbb1b138fa6ba
4
- data.tar.gz: 2d0d7c7c4d4e03d2c4f57c4ba8f80683d702436d
3
+ metadata.gz: a49e13aa573578aafcb8ef5020fe162dfd17e371
4
+ data.tar.gz: 3ee392697a4619673bcff0bbf51c718fb229acc4
5
5
  SHA512:
6
- metadata.gz: 409de8ceec3b5f75808506d79331f52157082f2c35a5fdfed3f8a888937e9e537db6782b0956b935e36c8aaf63159292839a12056b9bae6371fc84acb5e87e3c
7
- data.tar.gz: 20b28fac78f297e6f3175b48ec2871a293c438511955045422f519ff8559e3ded1621f0583a16e6f65c8f3523aff3674fd6d13de099ae4c91ffa71a4251e110b
6
+ metadata.gz: 7dcba255ea4c54209ca56b8f450de2f688b6def62b07be646ed391450ee9a35e570ac6466f0435183eeb80c4b437cb377128d63a0b1352a44ef01fa799880b98
7
+ data.tar.gz: 55477e183b29c2e0aa0aaf2a76eafccfa8eb80fb50b72d1b21878b7ac2f7333d55322a5275e0f2582b18380f63549ee41c3910efda235e6980ab8430e02fa214
@@ -23,6 +23,10 @@ module Lita
23
23
  if result
24
24
  result['items'].each do |r|
25
25
  if r['mime'] == 'image/gif'
26
+ if r['link'][/200_s.gif$/]
27
+ r['link'].gsub! /200_s.gif/, 'giphy.gif'
28
+ end
29
+
26
30
  response.reply r['link']
27
31
  break
28
32
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-images'
3
- spec.version = '0.2.0'
3
+ spec.version = '0.3.0'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = 'An implementation of Google Custom Search Engine for image searches in chat.'
@@ -0,0 +1,243 @@
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 - giphy boop",
11
+ "totalResults": "983000",
12
+ "searchTerms": "giphy boop",
13
+ "count": 10,
14
+ "startIndex": 1,
15
+ "inputEncoding": "utf8",
16
+ "outputEncoding": "utf8",
17
+ "safe": "medium",
18
+ "cx": "016450909327860943906:3a3e35xbkzu",
19
+ "searchType": "image"
20
+ }
21
+ ],
22
+ "nextPage": [
23
+ {
24
+ "title": "Google Custom Search - giphy boop",
25
+ "totalResults": "983000",
26
+ "searchTerms": "giphy boop",
27
+ "count": 10,
28
+ "startIndex": 11,
29
+ "inputEncoding": "utf8",
30
+ "outputEncoding": "utf8",
31
+ "safe": "medium",
32
+ "cx": "016450909327860943906:3a3e35xbkzu",
33
+ "searchType": "image"
34
+ }
35
+ ]
36
+ },
37
+ "context": {
38
+ "title": "Google"
39
+ },
40
+ "searchInformation": {
41
+ "searchTime": 0.257185,
42
+ "formattedSearchTime": "0.26",
43
+ "totalResults": "983000",
44
+ "formattedTotalResults": "983,000"
45
+ },
46
+ "items": [
47
+ {
48
+ "kind": "customsearch#result",
49
+ "title": "Top Hat GIF - Find & Share on GIPHY",
50
+ "htmlTitle": "<b>Top Hat</b> GIF - Find &amp; Share on <b>GIPHY</b>",
51
+ "link": "https://media4.giphy.com/media/7fLGzTYkX3hO8/200_s.gif",
52
+ "displayLink": "giphy.com",
53
+ "snippet": "Download",
54
+ "htmlSnippet": "Download",
55
+ "mime": "image/gif",
56
+ "fileFormat": "Image Document",
57
+ "image": {
58
+ "contextLink": "http://giphy.com/gifs/boop-cat-dog-lcvjDNIJ8CS88",
59
+ "height": 221,
60
+ "width": 327,
61
+ "byteSize": 456668,
62
+ "thumbnailLink": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSW5ZuGyYPjT02SxK0eo74oO8oe-ZjyZ4akCbdjelvYwpMOy9D7aiYycQ",
63
+ "thumbnailHeight": 80,
64
+ "thumbnailWidth": 118
65
+ }
66
+ },
67
+ {
68
+ "kind": "customsearch#result",
69
+ "title": "Boop GIFs - Find & Share on GIPHY",
70
+ "htmlTitle": "<b>Boop</b> GIFs - Find &amp; Share on <b>GIPHY</b>",
71
+ "link": "https://media0.giphy.com/media/13eFBWrZEnJTGM/200_s.gif",
72
+ "displayLink": "giphy.com",
73
+ "snippet": "cat animals dolphin boop",
74
+ "htmlSnippet": "cat animals dolphin <b>boop</b>",
75
+ "mime": "image/gif",
76
+ "fileFormat": "Image Document",
77
+ "image": {
78
+ "contextLink": "http://giphy.com/search/boop",
79
+ "height": 200,
80
+ "width": 267,
81
+ "byteSize": 41044,
82
+ "thumbnailLink": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTQ-VJTyGJre8jiTRNXUd-XYBr3BVQK9N8xhrY3lALE9Ndev3Dtg5ZdwA",
83
+ "thumbnailHeight": 85,
84
+ "thumbnailWidth": 113
85
+ }
86
+ },
87
+ {
88
+ "kind": "customsearch#result",
89
+ "title": "Boop GIFs - Find & Share on GIPHY",
90
+ "htmlTitle": "<b>Boop</b> GIFs - Find &amp; Share on <b>GIPHY</b>",
91
+ "link": "https://media.giphy.com/media/Mf4NqZAknusBq/giphy-facebook_s.jpg",
92
+ "displayLink": "giphy.com",
93
+ "snippet": "cheezburger cat boop",
94
+ "htmlSnippet": "cheezburger cat <b>boop</b>",
95
+ "mime": "image/jpeg",
96
+ "image": {
97
+ "contextLink": "http://giphy.com/search/boop",
98
+ "height": 270,
99
+ "width": 480,
100
+ "byteSize": 69091,
101
+ "thumbnailLink": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRSLVvaau7zPfCgyNWJ3cQzd4tcbxwqB1w6Pn4Voqtn-5gx9EIww6-HXQE",
102
+ "thumbnailHeight": 73,
103
+ "thumbnailWidth": 129
104
+ }
105
+ },
106
+ {
107
+ "kind": "customsearch#result",
108
+ "title": "Boop GIFs - Find & Share on GIPHY",
109
+ "htmlTitle": "<b>Boop</b> GIFs - Find &amp; Share on <b>GIPHY</b>",
110
+ "link": "https://media1.giphy.com/media/34SJjVcQuih1K/200_s.gif",
111
+ "displayLink": "giphy.com",
112
+ "snippet": "archer boop affectionate nose",
113
+ "htmlSnippet": "archer <b>boop</b> affectionate nose",
114
+ "mime": "image/gif",
115
+ "fileFormat": "Image Document",
116
+ "image": {
117
+ "contextLink": "http://giphy.com/search/boop",
118
+ "height": 200,
119
+ "width": 355,
120
+ "byteSize": 42424,
121
+ "thumbnailLink": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ-MJrWoGpSfRP-DSrN94Wi36qfEPn6pQZlyo1DMau6luE1I79Ou74aUg",
122
+ "thumbnailHeight": 68,
123
+ "thumbnailWidth": 121
124
+ }
125
+ },
126
+ {
127
+ "kind": "customsearch#result",
128
+ "title": "Boop Gifs Find Share On Giphy - toublanc.info",
129
+ "htmlTitle": "<b>Boop</b> Gifs Find Share On <b>Giphy</b> - toublanc.info",
130
+ "link": "https://media.giphy.com/media/10MSCF1viNV7zy/giphy-facebook_s.jpg",
131
+ "displayLink": "www.toublanc.info",
132
+ "snippet": "Boop Gifs Find Share On Giphy",
133
+ "htmlSnippet": "<b>Boop</b> Gifs Find Share On <b>Giphy</b>",
134
+ "mime": "image/jpeg",
135
+ "image": {
136
+ "contextLink": "http://www.toublanc.info/boop/boop-gifs-find-share-on-giphy",
137
+ "height": 270,
138
+ "width": 480,
139
+ "byteSize": 25260,
140
+ "thumbnailLink": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRtgNJp-NZsZiq9vrEG-sEs83CTau7AAWZlr25mzU__7Q_zp9FoJiJCodZB",
141
+ "thumbnailHeight": 73,
142
+ "thumbnailWidth": 129
143
+ }
144
+ },
145
+ {
146
+ "kind": "customsearch#result",
147
+ "title": "Kitty Boop Gifs Find Share On Giphy - toublanc.info",
148
+ "htmlTitle": "Kitty <b>Boop</b> Gifs Find Share On <b>Giphy</b> - toublanc.info",
149
+ "link": "https://media2.giphy.com/media/XkRVZy6zREE92/200_s.gif",
150
+ "displayLink": "www.toublanc.info",
151
+ "snippet": "Find Share On Giphy : Boop",
152
+ "htmlSnippet": "Find Share On <b>Giphy</b> : <b>Boop</b>",
153
+ "mime": "image/gif",
154
+ "fileFormat": "Image Document",
155
+ "image": {
156
+ "contextLink": "http://www.toublanc.info/kitty/kitty-boop-gifs-find-share-on-giphy",
157
+ "height": 200,
158
+ "width": 355,
159
+ "byteSize": 47765,
160
+ "thumbnailLink": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTqwyjfUsEinEoDi-f_5-DxDe7Ab3JI0e1JGVNQ8fwdJIefWLYSQ9aWs7Q",
161
+ "thumbnailHeight": 68,
162
+ "thumbnailWidth": 121
163
+ }
164
+ },
165
+ {
166
+ "kind": "customsearch#result",
167
+ "title": "Nose Boops Gifs Find Share On Giphy - toublanc.info",
168
+ "htmlTitle": "Nose Boops Gifs Find Share On <b>Giphy</b> - toublanc.info",
169
+ "link": "https://media.giphy.com/media/3o85xHdmOjqVj4Wp9u/giphy-facebook_s.jpg",
170
+ "displayLink": "www.toublanc.info",
171
+ "snippet": "Find Share On Giphy : Boop",
172
+ "htmlSnippet": "Find Share On <b>Giphy</b> : <b>Boop</b>",
173
+ "mime": "image/jpeg",
174
+ "image": {
175
+ "contextLink": "http://www.toublanc.info/nose/nose-boops-gifs-find-share-on-giphy",
176
+ "height": 270,
177
+ "width": 480,
178
+ "byteSize": 27159,
179
+ "thumbnailLink": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQxOsIZlXWN52BPrIRhAyHZ-6lJSFI5C_6d2-PciURlFVzrSZc-ra8DGAFn",
180
+ "thumbnailHeight": 73,
181
+ "thumbnailWidth": 129
182
+ }
183
+ },
184
+ {
185
+ "kind": "customsearch#result",
186
+ "title": "via GIPHY | Gif | Pinterest | Betty Boop, Gifs and Black And White",
187
+ "htmlTitle": "via <b>GIPHY</b> | Gif | Pinterest | Betty <b>Boop</b>, Gifs and Black And White",
188
+ "link": "https://s-media-cache-ak0.pinimg.com/736x/28/87/30/28873052e78c32db5f29d3f117adefd5.jpg",
189
+ "displayLink": "www.pinterest.com",
190
+ "snippet": "via GIPHY",
191
+ "htmlSnippet": "via <b>GIPHY</b>",
192
+ "mime": "image/jpeg",
193
+ "image": {
194
+ "contextLink": "https://www.pinterest.com/pin/175921929172738300/",
195
+ "height": 240,
196
+ "width": 320,
197
+ "byteSize": 19572,
198
+ "thumbnailLink": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTNWZgIoUYpj3PlrV586GRK9dk_llCgpc_eL3GucYE2YZ_dbxp4b9-5ARM",
199
+ "thumbnailHeight": 89,
200
+ "thumbnailWidth": 118
201
+ }
202
+ },
203
+ {
204
+ "kind": "customsearch#result",
205
+ "title": "Kitty Boop Gifs Find Share On Giphy - toublanc.info",
206
+ "htmlTitle": "Kitty <b>Boop</b> Gifs Find Share On <b>Giphy</b> - toublanc.info",
207
+ "link": "https://media.giphy.com/media/beO6G4MleCWVW/giphy-facebook_s.jpg",
208
+ "displayLink": "www.toublanc.info",
209
+ "snippet": "Find Share On Giphy : Boop",
210
+ "htmlSnippet": "Find Share On <b>Giphy</b> : <b>Boop</b>",
211
+ "mime": "image/jpeg",
212
+ "image": {
213
+ "contextLink": "http://www.toublanc.info/kitty/kitty-boop-gifs-find-share-on-giphy",
214
+ "height": 270,
215
+ "width": 480,
216
+ "byteSize": 82398,
217
+ "thumbnailLink": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTWd_V_Zush_3p0UHFS5A1jMGNNKI5ZIOogzqylBRhOayZX7RVd1rxKii1B",
218
+ "thumbnailHeight": 73,
219
+ "thumbnailWidth": 129
220
+ }
221
+ },
222
+ {
223
+ "kind": "customsearch#result",
224
+ "title": "Boop GIF - Find & Share on GIPHY",
225
+ "htmlTitle": "<b>Boop</b> GIF - Find &amp; Share on <b>GIPHY</b>",
226
+ "link": "https://media.giphy.com/media/ogIiGCBFL6PGE/giphy.gif",
227
+ "displayLink": "giphy.com",
228
+ "snippet": "Download",
229
+ "htmlSnippet": "Download",
230
+ "mime": "image/gif",
231
+ "fileFormat": "Image Document",
232
+ "image": {
233
+ "contextLink": "http://giphy.com/gifs/boop-snoot-ogIiGCBFL6PGE",
234
+ "height": 350,
235
+ "width": 350,
236
+ "byteSize": 2073426,
237
+ "thumbnailLink": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcT3oZIL0CV35gpLDrRYbWL7gNOvH0TIMEfgjSUj3O2LNinJ_OYL1psExTc",
238
+ "thumbnailHeight": 120,
239
+ "thumbnailWidth": 120
240
+ }
241
+ }
242
+ ]
243
+ }
@@ -30,4 +30,10 @@ describe Lita::Handlers::OnewheelImages, lita_handler: true do
30
30
  send_command 'giphy boop'
31
31
  expect(replies.last).to eq('https://media.giphy.com/media/lcvjDNIJ8CS88/giphy.gif')
32
32
  end
33
+
34
+ it 'does neat gif-y things' do
35
+ mock_it_up('giphy_tophat_result')
36
+ send_command 'giphy tophat'
37
+ expect(replies.last).to eq('https://media4.giphy.com/media/7fLGzTYkX3hO8/giphy.gif')
38
+ end
33
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-images
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
@@ -140,6 +140,7 @@ files:
140
140
  - lib/lita/handlers/onewheel_images.rb
141
141
  - lita-onewheel-images.gemspec
142
142
  - spec/fixtures/giphy_result.json
143
+ - spec/fixtures/giphy_tophat_result.json
143
144
  - spec/fixtures/mock_result.json
144
145
  - spec/lita/handlers/onewheel_images_spec.rb
145
146
  - spec/spec_helper.rb
@@ -170,6 +171,7 @@ specification_version: 4
170
171
  summary: CSE Details to follow
171
172
  test_files:
172
173
  - spec/fixtures/giphy_result.json
174
+ - spec/fixtures/giphy_tophat_result.json
173
175
  - spec/fixtures/mock_result.json
174
176
  - spec/lita/handlers/onewheel_images_spec.rb
175
177
  - spec/spec_helper.rb