apiverve_crossword 1.2.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +453 -0
- data/lib/apiverve/client.rb +184 -0
- data/lib/apiverve_crossword/client.rb +188 -0
- data/lib/apiverve_crossword.rb +9 -0
- metadata +98 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5cdd2362ec64b08bade0433e3873c3f14743c56d69411eca55de3a8099681310
|
|
4
|
+
data.tar.gz: 7a037b95a6a36d0de3c48911a83d9205f35e11db60dc207350d8c221050561cc
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1414de5f1f6a734ac44f7f78149e841c39e81e324f1050d11f7727a0528f07032a8d9a760285e69eec0967ec2829adfabc6bdc7322fcbb1497c7b6f957b40f48
|
|
7
|
+
data.tar.gz: 5af7ace5bb72b8f6bf58b54cd03d8b1037004704a7151e5dca28d051022ce47c3c33345619610709c66f0e5831fba0d31ab21cf54433f7d43a89c14713fa10c6
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) {{year}} APIVerve
|
|
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/README.md
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
# Crossword Generator API - Ruby Gem
|
|
2
|
+
|
|
3
|
+
Crossword Generator creates crossword puzzles with intersecting words, numbered clues, and themed word selection.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'apiverve_crossword'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
$ gem install apiverve_crossword
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Getting Started
|
|
26
|
+
|
|
27
|
+
Get your API key at [APIVerve](https://apiverve.com)
|
|
28
|
+
|
|
29
|
+
### Basic Usage
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
require 'apiverve_crossword'
|
|
33
|
+
|
|
34
|
+
# Initialize the client
|
|
35
|
+
client = APIVerve::Crossword::Client.new(api_key: "YOUR_API_KEY")
|
|
36
|
+
|
|
37
|
+
# Make a request
|
|
38
|
+
response = client.execute({
|
|
39
|
+
size: "medium",
|
|
40
|
+
theme: "random",
|
|
41
|
+
difficulty: "medium",
|
|
42
|
+
image: true,
|
|
43
|
+
solutionImage: true
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
# Print the response
|
|
47
|
+
puts response
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Error Handling
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
begin
|
|
55
|
+
response = client.execute({ size: "medium", theme: "random", difficulty: "medium", image: true, solutionImage: true })
|
|
56
|
+
puts response["data"]
|
|
57
|
+
rescue APIVerve::Crossword::ValidationError => e
|
|
58
|
+
puts "Validation error: #{e.errors.join(', ')}"
|
|
59
|
+
rescue APIVerve::Crossword::APIError => e
|
|
60
|
+
puts "API error: #{e.message}"
|
|
61
|
+
puts "Status code: #{e.status_code}"
|
|
62
|
+
end
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Debug Mode
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
# Enable debug logging
|
|
69
|
+
client = APIVerve::Crossword::Client.new(
|
|
70
|
+
api_key: "YOUR_API_KEY",
|
|
71
|
+
debug: true
|
|
72
|
+
)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Example Response
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"status": "ok",
|
|
80
|
+
"error": null,
|
|
81
|
+
"data": {
|
|
82
|
+
"size": 15,
|
|
83
|
+
"difficulty": "medium",
|
|
84
|
+
"theme": "animals",
|
|
85
|
+
"grid": [
|
|
86
|
+
[
|
|
87
|
+
null,
|
|
88
|
+
null,
|
|
89
|
+
null,
|
|
90
|
+
null,
|
|
91
|
+
null,
|
|
92
|
+
null,
|
|
93
|
+
null,
|
|
94
|
+
null,
|
|
95
|
+
null,
|
|
96
|
+
null,
|
|
97
|
+
null,
|
|
98
|
+
null,
|
|
99
|
+
null,
|
|
100
|
+
null,
|
|
101
|
+
null
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
null,
|
|
105
|
+
"T",
|
|
106
|
+
"I",
|
|
107
|
+
"G",
|
|
108
|
+
"E",
|
|
109
|
+
"R",
|
|
110
|
+
null,
|
|
111
|
+
null,
|
|
112
|
+
null,
|
|
113
|
+
null,
|
|
114
|
+
null,
|
|
115
|
+
null,
|
|
116
|
+
null,
|
|
117
|
+
"D",
|
|
118
|
+
null
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
null,
|
|
122
|
+
null,
|
|
123
|
+
null,
|
|
124
|
+
"I",
|
|
125
|
+
null,
|
|
126
|
+
null,
|
|
127
|
+
null,
|
|
128
|
+
null,
|
|
129
|
+
null,
|
|
130
|
+
null,
|
|
131
|
+
"R",
|
|
132
|
+
null,
|
|
133
|
+
null,
|
|
134
|
+
"E",
|
|
135
|
+
null
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
"Z",
|
|
139
|
+
"E",
|
|
140
|
+
"B",
|
|
141
|
+
"R",
|
|
142
|
+
"A",
|
|
143
|
+
null,
|
|
144
|
+
null,
|
|
145
|
+
"D",
|
|
146
|
+
null,
|
|
147
|
+
null,
|
|
148
|
+
"A",
|
|
149
|
+
null,
|
|
150
|
+
null,
|
|
151
|
+
"E",
|
|
152
|
+
null
|
|
153
|
+
],
|
|
154
|
+
[
|
|
155
|
+
null,
|
|
156
|
+
null,
|
|
157
|
+
null,
|
|
158
|
+
"A",
|
|
159
|
+
null,
|
|
160
|
+
"L",
|
|
161
|
+
"I",
|
|
162
|
+
"O",
|
|
163
|
+
"N",
|
|
164
|
+
null,
|
|
165
|
+
"B",
|
|
166
|
+
"E",
|
|
167
|
+
"A",
|
|
168
|
+
"R",
|
|
169
|
+
null
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
"W",
|
|
173
|
+
"O",
|
|
174
|
+
"L",
|
|
175
|
+
"F",
|
|
176
|
+
null,
|
|
177
|
+
null,
|
|
178
|
+
null,
|
|
179
|
+
"L",
|
|
180
|
+
null,
|
|
181
|
+
null,
|
|
182
|
+
"B",
|
|
183
|
+
null,
|
|
184
|
+
null,
|
|
185
|
+
null,
|
|
186
|
+
null
|
|
187
|
+
],
|
|
188
|
+
[
|
|
189
|
+
null,
|
|
190
|
+
"W",
|
|
191
|
+
null,
|
|
192
|
+
"F",
|
|
193
|
+
null,
|
|
194
|
+
"P",
|
|
195
|
+
null,
|
|
196
|
+
"P",
|
|
197
|
+
null,
|
|
198
|
+
null,
|
|
199
|
+
"I",
|
|
200
|
+
null,
|
|
201
|
+
null,
|
|
202
|
+
null,
|
|
203
|
+
null
|
|
204
|
+
],
|
|
205
|
+
[
|
|
206
|
+
null,
|
|
207
|
+
"L",
|
|
208
|
+
null,
|
|
209
|
+
"E",
|
|
210
|
+
"L",
|
|
211
|
+
"E",
|
|
212
|
+
"P",
|
|
213
|
+
"H",
|
|
214
|
+
"A",
|
|
215
|
+
"N",
|
|
216
|
+
"T",
|
|
217
|
+
null,
|
|
218
|
+
null,
|
|
219
|
+
null,
|
|
220
|
+
null
|
|
221
|
+
],
|
|
222
|
+
[
|
|
223
|
+
null,
|
|
224
|
+
null,
|
|
225
|
+
null,
|
|
226
|
+
null,
|
|
227
|
+
null,
|
|
228
|
+
"N",
|
|
229
|
+
null,
|
|
230
|
+
"I",
|
|
231
|
+
null,
|
|
232
|
+
null,
|
|
233
|
+
null,
|
|
234
|
+
null,
|
|
235
|
+
null,
|
|
236
|
+
null,
|
|
237
|
+
null
|
|
238
|
+
],
|
|
239
|
+
[
|
|
240
|
+
null,
|
|
241
|
+
null,
|
|
242
|
+
null,
|
|
243
|
+
null,
|
|
244
|
+
null,
|
|
245
|
+
"G",
|
|
246
|
+
null,
|
|
247
|
+
"N",
|
|
248
|
+
null,
|
|
249
|
+
null,
|
|
250
|
+
null,
|
|
251
|
+
null,
|
|
252
|
+
null,
|
|
253
|
+
null,
|
|
254
|
+
null
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
null,
|
|
258
|
+
null,
|
|
259
|
+
null,
|
|
260
|
+
null,
|
|
261
|
+
null,
|
|
262
|
+
"U",
|
|
263
|
+
null,
|
|
264
|
+
null,
|
|
265
|
+
null,
|
|
266
|
+
null,
|
|
267
|
+
null,
|
|
268
|
+
null,
|
|
269
|
+
null,
|
|
270
|
+
null,
|
|
271
|
+
null
|
|
272
|
+
],
|
|
273
|
+
[
|
|
274
|
+
null,
|
|
275
|
+
null,
|
|
276
|
+
null,
|
|
277
|
+
null,
|
|
278
|
+
null,
|
|
279
|
+
"I",
|
|
280
|
+
null,
|
|
281
|
+
null,
|
|
282
|
+
null,
|
|
283
|
+
null,
|
|
284
|
+
null,
|
|
285
|
+
null,
|
|
286
|
+
null,
|
|
287
|
+
null,
|
|
288
|
+
null
|
|
289
|
+
],
|
|
290
|
+
[
|
|
291
|
+
null,
|
|
292
|
+
null,
|
|
293
|
+
null,
|
|
294
|
+
"P",
|
|
295
|
+
"A",
|
|
296
|
+
"N",
|
|
297
|
+
"D",
|
|
298
|
+
"A",
|
|
299
|
+
null,
|
|
300
|
+
null,
|
|
301
|
+
null,
|
|
302
|
+
null,
|
|
303
|
+
null,
|
|
304
|
+
null,
|
|
305
|
+
null
|
|
306
|
+
],
|
|
307
|
+
[
|
|
308
|
+
null,
|
|
309
|
+
null,
|
|
310
|
+
null,
|
|
311
|
+
null,
|
|
312
|
+
null,
|
|
313
|
+
null,
|
|
314
|
+
null,
|
|
315
|
+
null,
|
|
316
|
+
null,
|
|
317
|
+
null,
|
|
318
|
+
null,
|
|
319
|
+
null,
|
|
320
|
+
null,
|
|
321
|
+
null,
|
|
322
|
+
null
|
|
323
|
+
],
|
|
324
|
+
[
|
|
325
|
+
null,
|
|
326
|
+
null,
|
|
327
|
+
null,
|
|
328
|
+
null,
|
|
329
|
+
null,
|
|
330
|
+
null,
|
|
331
|
+
null,
|
|
332
|
+
null,
|
|
333
|
+
null,
|
|
334
|
+
null,
|
|
335
|
+
null,
|
|
336
|
+
null,
|
|
337
|
+
null,
|
|
338
|
+
null,
|
|
339
|
+
null
|
|
340
|
+
]
|
|
341
|
+
],
|
|
342
|
+
"across": [
|
|
343
|
+
{
|
|
344
|
+
"number": 1,
|
|
345
|
+
"clue": "Striped big cat",
|
|
346
|
+
"answer": "TIGER",
|
|
347
|
+
"length": 5
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"number": 5,
|
|
351
|
+
"clue": "Striped horse-like animal",
|
|
352
|
+
"answer": "ZEBRA",
|
|
353
|
+
"length": 5
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"number": 7,
|
|
357
|
+
"clue": "King of the jungle",
|
|
358
|
+
"answer": "LION",
|
|
359
|
+
"length": 4
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"number": 8,
|
|
363
|
+
"clue": "Large furry mammal",
|
|
364
|
+
"answer": "BEAR",
|
|
365
|
+
"length": 4
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"number": 9,
|
|
369
|
+
"clue": "Wild canine that howls",
|
|
370
|
+
"answer": "WOLF",
|
|
371
|
+
"length": 4
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"number": 12,
|
|
375
|
+
"clue": "Large gray mammal with trunk",
|
|
376
|
+
"answer": "ELEPHANT",
|
|
377
|
+
"length": 8
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"number": 13,
|
|
381
|
+
"clue": "Black and white bear from China",
|
|
382
|
+
"answer": "PANDA",
|
|
383
|
+
"length": 5
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
"down": [
|
|
387
|
+
{
|
|
388
|
+
"number": 2,
|
|
389
|
+
"clue": "Tallest land animal",
|
|
390
|
+
"answer": "GIRAFFE",
|
|
391
|
+
"length": 7
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"number": 3,
|
|
395
|
+
"clue": "Forest animal with antlers",
|
|
396
|
+
"answer": "DEER",
|
|
397
|
+
"length": 4
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"number": 4,
|
|
401
|
+
"clue": "Hopping animal with long ears",
|
|
402
|
+
"answer": "RABBIT",
|
|
403
|
+
"length": 6
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"number": 6,
|
|
407
|
+
"clue": "Intelligent marine mammal",
|
|
408
|
+
"answer": "DOLPHIN",
|
|
409
|
+
"length": 7
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"number": 10,
|
|
413
|
+
"clue": "Nocturnal bird of prey",
|
|
414
|
+
"answer": "OWL",
|
|
415
|
+
"length": 3
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"number": 11,
|
|
419
|
+
"clue": "Flightless bird from Antarctica",
|
|
420
|
+
"answer": "PENGUIN",
|
|
421
|
+
"length": 7
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"wordCount": 13,
|
|
425
|
+
"html": "<html><head><title>Crossword Puzzle</title><style>body {font-family: Arial, sans-serif; padding: 20px;}h1 {text-align: center; color: #333;}.container {display: flex; gap: 30px; flex-wrap: wrap; justify-content: center;}.grid {display: grid; grid-template-columns: repeat(15, 30px); gap: 1px; background: #333; border: 2px solid #333;}.cell {width: 30px; height: 30px; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: bold; position: relative;}.cell.black {background: #333;}.cell-number {position: absolute; top: 1px; left: 2px; font-size: 8px; font-weight: normal;}.clues {max-width: 300px;}.clue-section h3 {margin-bottom: 10px; color: #333;}.clue {margin: 5px 0; font-size: 14px;}.clue-number {font-weight: bold; margin-right: 5px;}</style></head><body><h1>Crossword</h1><div class='container'><div class='grid'><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>1</span></div><div class='cell'></div><div class='cell'><span class='cell-number'>2</span></div><div class='cell'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>3</span></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>4</span></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>5</span></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>6</span></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>7</span></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>8</span></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>9</span></div><div class='cell'><span class='cell-number'>10</span></div><div class='cell'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>11</span></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>12</span></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell'><span class='cell-number'>13</span></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div><div class='cell black'></div></div><div class='clues'><div class='clue-section'><h3>Across</h3><div class='clue'><span class='clue-number'>1.</span>Striped big cat (5)</div><div class='clue'><span class='clue-number'>5.</span>Striped horse-like animal (5)</div><div class='clue'><span class='clue-number'>7.</span>King of the jungle (4)</div><div class='clue'><span class='clue-number'>8.</span>Large furry mammal (4)</div><div class='clue'><span class='clue-number'>9.</span>Wild canine that howls (4)</div><div class='clue'><span class='clue-number'>12.</span>Large gray mammal with trunk (8)</div><div class='clue'><span class='clue-number'>13.</span>Black and white bear from China (5)</div></div><div class='clue-section'><h3>Down</h3><div class='clue'><span class='clue-number'>2.</span>Tallest land animal (7)</div><div class='clue'><span class='clue-number'>3.</span>Forest animal with antlers (4)</div><div class='clue'><span class='clue-number'>4.</span>Hopping animal with long ears (6)</div><div class='clue'><span class='clue-number'>6.</span>Intelligent marine mammal (7)</div><div class='clue'><span class='clue-number'>10.</span>Nocturnal bird of prey (3)</div><div class='clue'><span class='clue-number'>11.</span>Flightless bird from Antarctica (7)</div></div></div></div></body></html>",
|
|
426
|
+
"image": {
|
|
427
|
+
"imageName": "1838121c-9f76-44f8-b197-02e1db5987d5_puzzle.png",
|
|
428
|
+
"format": ".png",
|
|
429
|
+
"downloadURL": "https://storage.googleapis.com/apiverve/APIData/crossword/1838121c-9f76-44f8-b197-02e1db5987d5_puzzle.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766010128&Signature=OYZsWA9QiINhqgC%2BSZSZpict%2B93ryyxvzUSIohJF%2BMGZ7SLGLA2Q47aVnwzLFzr8ZOK7IUQN4DZrAMh%2B0T8VqTMCLf76tj8BKLB1Qwo4IbMkkat1cbG6AFb44ungHGmCpwjwjwDYMwrDgI8%2Bg8dyKzwMZZmQHf5Q1hYNsy084Q%2BBTLAx6KUL%2FIZdw5pp0Rnxiq8aHdPrm%2Fbq2NU1UuMUDg8uBc8TR%2FHYN%2FOljXeyhv6Nbf4FXJCPLTMDdLDqblecNKhfQ67Dc4FdPD%2BF1IPN2A5G9VfkPb5v5KA5iiM8RF4zr8kHW%2FMlncbKSynvLp7QjtL9qZlSHn3%2Bn0pJpf%2FEUA%3D%3D",
|
|
430
|
+
"expires": 1766010128609
|
|
431
|
+
},
|
|
432
|
+
"solutionImage": {
|
|
433
|
+
"imageName": "3ec675cd-0e16-4e50-87f4-8f4192abea5b_solution.png",
|
|
434
|
+
"format": ".png",
|
|
435
|
+
"downloadURL": "https://storage.googleapis.com/apiverve/APIData/crossword/3ec675cd-0e16-4e50-87f4-8f4192abea5b_solution.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766010129&Signature=L07115whFCEM3yuFDBILq7r4v26RoSYQzv81S7bwL8yJFcHRjHcKsqUhI6UWaDo4LPKfAjmk%2Fs1gN3z33ma12GE2fJYkp4mxD40EhyY%2BDjR3ja7m%2Fj20Zenu%2FdcOukkS9DCfGiYEa%2BxQDT4I2gjDVORhe7JeDuLeKCFtbsiLZFIlWNZoq6K7YbNc4BWDnwcqviJXSB%2FvWa1FMhXpQFoTIeJVvUCcdOGGVR6Vdl%2BPxwWN%2FAjXcsvNYbIhtyEZHaXQuXxI3zmCMg0eI770cVuhs7rm8JVdN7gYtojprJxTYl9nRx793SRuLcFfJD%2BRhx2dBmpMtXkcZFmv4%2Bz74oZY8Q%3D%3D",
|
|
436
|
+
"expires": 1766010129033
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Documentation
|
|
443
|
+
|
|
444
|
+
For more information, visit the [API Documentation](https://docs.apiverve.com/ref/crossword?utm_source=rubygems&utm_medium=readme).
|
|
445
|
+
|
|
446
|
+
## Support
|
|
447
|
+
|
|
448
|
+
- Website: [https://apiverve.com/marketplace/crossword?utm_source=ruby&utm_medium=readme](https://apiverve.com/marketplace/crossword?utm_source=ruby&utm_medium=readme)
|
|
449
|
+
- Email: hello@apiverve.com
|
|
450
|
+
|
|
451
|
+
## License
|
|
452
|
+
|
|
453
|
+
This gem is available under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faraday"
|
|
4
|
+
require "faraday/multipart"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module APIVerve
|
|
8
|
+
module Crossword
|
|
9
|
+
# Client for the Crossword Generator API
|
|
10
|
+
#
|
|
11
|
+
# @example Basic usage
|
|
12
|
+
# client = APIVerve::Crossword::Client.new(api_key: "your_api_key")
|
|
13
|
+
# response = client.execute({ size: "medium", theme: "random", difficulty: "medium", image: true, solutionImage: true })
|
|
14
|
+
# puts response
|
|
15
|
+
#
|
|
16
|
+
# @see https://apiverve.com/marketplace/crossword?utm_source=ruby&utm_medium=readme
|
|
17
|
+
class Client
|
|
18
|
+
BASE_URL = "https://api.apiverve.com/v1/crossword"
|
|
19
|
+
DEFAULT_TIMEOUT = 30
|
|
20
|
+
|
|
21
|
+
# Validation rules for parameters
|
|
22
|
+
VALIDATION_RULES = { 'size' => { type: 'string', required: false }, 'theme' => { type: 'string', required: false }, 'difficulty' => { type: 'string', required: false }, 'image' => { type: 'boolean', required: false }, 'solutionImage' => { type: 'boolean', required: false } }
|
|
23
|
+
|
|
24
|
+
# Format validation patterns
|
|
25
|
+
FORMAT_PATTERNS = {
|
|
26
|
+
'email' => /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
27
|
+
'url' => /^https?:\/\/.+/,
|
|
28
|
+
'ip' => /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,
|
|
29
|
+
'date' => /^\d{4}-\d{2}-\d{2}$/,
|
|
30
|
+
'hexColor' => /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
|
31
|
+
}.freeze
|
|
32
|
+
|
|
33
|
+
# Initialize the client
|
|
34
|
+
#
|
|
35
|
+
# @param api_key [String] Your APIVerve API key
|
|
36
|
+
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
37
|
+
# @param debug [Boolean] Enable debug logging (default: false)
|
|
38
|
+
# @raise [ArgumentError] If API key is invalid
|
|
39
|
+
def initialize(api_key:, timeout: DEFAULT_TIMEOUT, debug: false)
|
|
40
|
+
validate_api_key!(api_key)
|
|
41
|
+
|
|
42
|
+
@api_key = api_key
|
|
43
|
+
@timeout = timeout
|
|
44
|
+
@debug = debug
|
|
45
|
+
|
|
46
|
+
@connection = Faraday.new(url: BASE_URL) do |conn|
|
|
47
|
+
conn.request :multipart
|
|
48
|
+
conn.request :url_encoded
|
|
49
|
+
conn.adapter Faraday.default_adapter
|
|
50
|
+
conn.options.timeout = @timeout
|
|
51
|
+
conn.headers["x-api-key"] = @api_key
|
|
52
|
+
conn.headers["auth-mode"] = "rubygems-package"
|
|
53
|
+
conn.headers["Content-Type"] = "application/json"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Execute the API request
|
|
58
|
+
#
|
|
59
|
+
# @param params [Hash] Query parameters or request body
|
|
60
|
+
# @return [Hash] API response
|
|
61
|
+
# @raise [APIError] If the request fails
|
|
62
|
+
# @raise [ValidationError] If parameter validation fails
|
|
63
|
+
def execute(params = {})
|
|
64
|
+
validate_params!(params)
|
|
65
|
+
|
|
66
|
+
log("Making GET request to #{BASE_URL}")
|
|
67
|
+
log("Parameters: #{params.inspect}") if params.any?
|
|
68
|
+
|
|
69
|
+
response = @connection.get do |req|
|
|
70
|
+
params.each { |k, v| req.params[k.to_s] = v }
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
handle_response(response)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def validate_api_key!(api_key)
|
|
79
|
+
raise ArgumentError, "API key is required. Get your API key at: https://apiverve.com" if api_key.nil? || api_key.strip.empty?
|
|
80
|
+
|
|
81
|
+
unless api_key.match?(/^[a-zA-Z0-9_-]+$/)
|
|
82
|
+
raise ArgumentError, "Invalid API key format. API key should only contain letters, numbers, hyphens, and underscores."
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def validate_params!(params)
|
|
87
|
+
return if VALIDATION_RULES.empty?
|
|
88
|
+
|
|
89
|
+
errors = []
|
|
90
|
+
|
|
91
|
+
VALIDATION_RULES.each do |param_name, rules|
|
|
92
|
+
value = params[param_name.to_sym] || params[param_name]
|
|
93
|
+
|
|
94
|
+
# Check required
|
|
95
|
+
if rules[:required] && (value.nil? || value.to_s.empty?)
|
|
96
|
+
errors << "Required parameter [#{param_name}] is missing."
|
|
97
|
+
next
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
next if value.nil?
|
|
101
|
+
|
|
102
|
+
case rules[:type]
|
|
103
|
+
when "integer", "number"
|
|
104
|
+
begin
|
|
105
|
+
num_value = rules[:type] == "number" ? Float(value) : Integer(value)
|
|
106
|
+
errors << "Parameter [#{param_name}] must be at least #{rules[:min]}." if rules[:min] && num_value < rules[:min]
|
|
107
|
+
errors << "Parameter [#{param_name}] must be at most #{rules[:max]}." if rules[:max] && num_value > rules[:max]
|
|
108
|
+
rescue ArgumentError, TypeError
|
|
109
|
+
errors << "Parameter [#{param_name}] must be a valid #{rules[:type]}."
|
|
110
|
+
end
|
|
111
|
+
when "string"
|
|
112
|
+
unless value.is_a?(String)
|
|
113
|
+
errors << "Parameter [#{param_name}] must be a string."
|
|
114
|
+
next
|
|
115
|
+
end
|
|
116
|
+
errors << "Parameter [#{param_name}] must be at least #{rules[:min_length]} characters." if rules[:min_length] && value.length < rules[:min_length]
|
|
117
|
+
errors << "Parameter [#{param_name}] must be at most #{rules[:max_length]} characters." if rules[:max_length] && value.length > rules[:max_length]
|
|
118
|
+
|
|
119
|
+
if rules[:format] && FORMAT_PATTERNS[rules[:format]]
|
|
120
|
+
unless value.match?(FORMAT_PATTERNS[rules[:format]])
|
|
121
|
+
errors << "Parameter [#{param_name}] must be a valid #{rules[:format]}."
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
when "boolean"
|
|
125
|
+
unless [true, false, "true", "false"].include?(value)
|
|
126
|
+
errors << "Parameter [#{param_name}] must be a boolean."
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Enum validation
|
|
131
|
+
if rules[:enum] && !rules[:enum].include?(value)
|
|
132
|
+
errors << "Parameter [#{param_name}] must be one of: #{rules[:enum].join(', ')}."
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
raise ValidationError, errors unless errors.empty?
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def handle_response(response)
|
|
140
|
+
log("Response status: #{response.status}")
|
|
141
|
+
|
|
142
|
+
data = JSON.parse(response.body)
|
|
143
|
+
|
|
144
|
+
if data["status"] == "error"
|
|
145
|
+
raise APIError.new(data["error"] || "Unknown API error", response.status, data)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
unless response.success?
|
|
149
|
+
raise APIError.new(data["error"] || "HTTP #{response.status} error", response.status, data)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
log("Request successful")
|
|
153
|
+
data
|
|
154
|
+
rescue JSON::ParserError => e
|
|
155
|
+
raise APIError.new("Invalid JSON response: #{e.message}", response.status)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def log(message)
|
|
159
|
+
puts "[APIVerve::Crossword] #{message}" if @debug
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Custom error class for API errors
|
|
164
|
+
class APIError < StandardError
|
|
165
|
+
attr_reader :status_code, :response
|
|
166
|
+
|
|
167
|
+
def initialize(message, status_code = nil, response = nil)
|
|
168
|
+
@status_code = status_code
|
|
169
|
+
@response = response
|
|
170
|
+
super(message)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Custom error class for validation errors
|
|
175
|
+
class ValidationError < StandardError
|
|
176
|
+
attr_reader :errors
|
|
177
|
+
|
|
178
|
+
def initialize(errors)
|
|
179
|
+
@errors = errors
|
|
180
|
+
super("Validation failed: #{errors.join(' ')}")
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faraday"
|
|
4
|
+
require "faraday/multipart"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module APIVerve
|
|
8
|
+
module Crossword
|
|
9
|
+
# Client for the Crossword Generator API
|
|
10
|
+
#
|
|
11
|
+
# @example Basic usage
|
|
12
|
+
# client = APIVerve::Crossword::Client.new(api_key: "your_api_key")
|
|
13
|
+
# response = client.execute({ size: "medium", theme: "random", difficulty: "medium" })
|
|
14
|
+
# puts response
|
|
15
|
+
#
|
|
16
|
+
# @see https://apiverve.com/marketplace/crossword?utm_source=ruby&utm_medium=readme
|
|
17
|
+
class Client
|
|
18
|
+
BASE_URL = "https://api.apiverve.com/v1/crossword"
|
|
19
|
+
DEFAULT_TIMEOUT = 30
|
|
20
|
+
|
|
21
|
+
# Validation rules for parameters
|
|
22
|
+
VALIDATION_RULES = {
|
|
23
|
+
'size' => { type: 'string', required: false },
|
|
24
|
+
'theme' => { type: 'string', required: false },
|
|
25
|
+
'difficulty' => { type: 'string', required: false }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Format validation patterns
|
|
29
|
+
FORMAT_PATTERNS = {
|
|
30
|
+
'email' => /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
31
|
+
'url' => /^https?:\/\/.+/,
|
|
32
|
+
'ip' => /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,
|
|
33
|
+
'date' => /^\d{4}-\d{2}-\d{2}$/,
|
|
34
|
+
'hexColor' => /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
|
35
|
+
}.freeze
|
|
36
|
+
|
|
37
|
+
# Initialize the client
|
|
38
|
+
#
|
|
39
|
+
# @param api_key [String] Your APIVerve API key
|
|
40
|
+
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
41
|
+
# @param debug [Boolean] Enable debug logging (default: false)
|
|
42
|
+
# @raise [ArgumentError] If API key is invalid
|
|
43
|
+
def initialize(api_key:, timeout: DEFAULT_TIMEOUT, debug: false)
|
|
44
|
+
validate_api_key!(api_key)
|
|
45
|
+
|
|
46
|
+
@api_key = api_key
|
|
47
|
+
@timeout = timeout
|
|
48
|
+
@debug = debug
|
|
49
|
+
|
|
50
|
+
@connection = Faraday.new(url: BASE_URL) do |conn|
|
|
51
|
+
conn.request :multipart
|
|
52
|
+
conn.request :url_encoded
|
|
53
|
+
conn.adapter Faraday.default_adapter
|
|
54
|
+
conn.options.timeout = @timeout
|
|
55
|
+
conn.headers["x-api-key"] = @api_key
|
|
56
|
+
conn.headers["auth-mode"] = "rubygems-package"
|
|
57
|
+
conn.headers["Content-Type"] = "application/json"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Execute the API request
|
|
62
|
+
#
|
|
63
|
+
# @param params [Hash] Query parameters or request body
|
|
64
|
+
# @return [Hash] API response
|
|
65
|
+
# @raise [APIError] If the request fails
|
|
66
|
+
# @raise [ValidationError] If parameter validation fails
|
|
67
|
+
def execute(params = {})
|
|
68
|
+
validate_params!(params)
|
|
69
|
+
|
|
70
|
+
log("Making GET request to #{BASE_URL}")
|
|
71
|
+
log("Parameters: #{params.inspect}") if params.any?
|
|
72
|
+
|
|
73
|
+
response = @connection.get do |req|
|
|
74
|
+
params.each { |k, v| req.params[k.to_s] = v }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
handle_response(response)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
private
|
|
81
|
+
|
|
82
|
+
def validate_api_key!(api_key)
|
|
83
|
+
raise ArgumentError, "API key is required. Get your API key at: https://apiverve.com" if api_key.nil? || api_key.strip.empty?
|
|
84
|
+
|
|
85
|
+
unless api_key.match?(/^[a-zA-Z0-9_-]+$/)
|
|
86
|
+
raise ArgumentError, "Invalid API key format. API key should only contain letters, numbers, hyphens, and underscores."
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def validate_params!(params)
|
|
91
|
+
return if VALIDATION_RULES.empty?
|
|
92
|
+
|
|
93
|
+
errors = []
|
|
94
|
+
|
|
95
|
+
VALIDATION_RULES.each do |param_name, rules|
|
|
96
|
+
value = params[param_name.to_sym] || params[param_name]
|
|
97
|
+
|
|
98
|
+
# Check required
|
|
99
|
+
if rules[:required] && (value.nil? || value.to_s.empty?)
|
|
100
|
+
errors << "Required parameter [#{param_name}] is missing."
|
|
101
|
+
next
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
next if value.nil?
|
|
105
|
+
|
|
106
|
+
case rules[:type]
|
|
107
|
+
when "integer", "number"
|
|
108
|
+
begin
|
|
109
|
+
num_value = rules[:type] == "number" ? Float(value) : Integer(value)
|
|
110
|
+
errors << "Parameter [#{param_name}] must be at least #{rules[:min]}." if rules[:min] && num_value < rules[:min]
|
|
111
|
+
errors << "Parameter [#{param_name}] must be at most #{rules[:max]}." if rules[:max] && num_value > rules[:max]
|
|
112
|
+
rescue ArgumentError, TypeError
|
|
113
|
+
errors << "Parameter [#{param_name}] must be a valid #{rules[:type]}."
|
|
114
|
+
end
|
|
115
|
+
when "string"
|
|
116
|
+
unless value.is_a?(String)
|
|
117
|
+
errors << "Parameter [#{param_name}] must be a string."
|
|
118
|
+
next
|
|
119
|
+
end
|
|
120
|
+
errors << "Parameter [#{param_name}] must be at least #{rules[:min_length]} characters." if rules[:min_length] && value.length < rules[:min_length]
|
|
121
|
+
errors << "Parameter [#{param_name}] must be at most #{rules[:max_length]} characters." if rules[:max_length] && value.length > rules[:max_length]
|
|
122
|
+
|
|
123
|
+
if rules[:format] && FORMAT_PATTERNS[rules[:format]]
|
|
124
|
+
unless value.match?(FORMAT_PATTERNS[rules[:format]])
|
|
125
|
+
errors << "Parameter [#{param_name}] must be a valid #{rules[:format]}."
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
when "boolean"
|
|
129
|
+
unless [true, false, "true", "false"].include?(value)
|
|
130
|
+
errors << "Parameter [#{param_name}] must be a boolean."
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Enum validation
|
|
135
|
+
if rules[:enum] && !rules[:enum].include?(value)
|
|
136
|
+
errors << "Parameter [#{param_name}] must be one of: #{rules[:enum].join(', ')}."
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
raise ValidationError, errors unless errors.empty?
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def handle_response(response)
|
|
144
|
+
log("Response status: #{response.status}")
|
|
145
|
+
|
|
146
|
+
data = JSON.parse(response.body)
|
|
147
|
+
|
|
148
|
+
if data["status"] == "error"
|
|
149
|
+
raise APIError.new(data["error"] || "Unknown API error", response.status, data)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
unless response.success?
|
|
153
|
+
raise APIError.new(data["error"] || "HTTP #{response.status} error", response.status, data)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
log("Request successful")
|
|
157
|
+
data
|
|
158
|
+
rescue JSON::ParserError => e
|
|
159
|
+
raise APIError.new("Invalid JSON response: #{e.message}", response.status)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def log(message)
|
|
163
|
+
puts "[APIVerve::Crossword] #{message}" if @debug
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Custom error class for API errors
|
|
168
|
+
class APIError < StandardError
|
|
169
|
+
attr_reader :status_code, :response
|
|
170
|
+
|
|
171
|
+
def initialize(message, status_code = nil, response = nil)
|
|
172
|
+
@status_code = status_code
|
|
173
|
+
@response = response
|
|
174
|
+
super(message)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Custom error class for validation errors
|
|
179
|
+
class ValidationError < StandardError
|
|
180
|
+
attr_reader :errors
|
|
181
|
+
|
|
182
|
+
def initialize(errors)
|
|
183
|
+
@errors = errors
|
|
184
|
+
super("Validation failed: #{errors.join(' ')}")
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: apiverve_crossword
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.2.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- APIVerve
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: faraday
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.0'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '3.0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '1.0'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '3.0'
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: faraday-multipart
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - "~>"
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '1.0'
|
|
39
|
+
type: :runtime
|
|
40
|
+
prerelease: false
|
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - "~>"
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '1.0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: json
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - "~>"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '2.0'
|
|
53
|
+
type: :runtime
|
|
54
|
+
prerelease: false
|
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - "~>"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '2.0'
|
|
60
|
+
description: Crossword Generator creates crossword puzzles with intersecting words,
|
|
61
|
+
numbered clues, and themed word selection.
|
|
62
|
+
email:
|
|
63
|
+
- hello@apiverve.com
|
|
64
|
+
executables: []
|
|
65
|
+
extensions: []
|
|
66
|
+
extra_rdoc_files: []
|
|
67
|
+
files:
|
|
68
|
+
- LICENSE
|
|
69
|
+
- README.md
|
|
70
|
+
- lib/apiverve/client.rb
|
|
71
|
+
- lib/apiverve_crossword.rb
|
|
72
|
+
- lib/apiverve_crossword/client.rb
|
|
73
|
+
homepage: https://apiverve.com/marketplace/crossword?utm_source=ruby&utm_medium=homepage
|
|
74
|
+
licenses:
|
|
75
|
+
- MIT
|
|
76
|
+
metadata:
|
|
77
|
+
homepage_uri: https://apiverve.com/marketplace/crossword?utm_source=ruby&utm_medium=homepage
|
|
78
|
+
source_code_uri: https://github.com/apiverve/crossword-API/tree/main/ruby
|
|
79
|
+
changelog_uri: https://apiverve.com/changelog
|
|
80
|
+
documentation_uri: https://docs.apiverve.com/ref/crossword
|
|
81
|
+
rdoc_options: []
|
|
82
|
+
require_paths:
|
|
83
|
+
- lib
|
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: 2.7.0
|
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
|
+
requirements:
|
|
91
|
+
- - ">="
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
requirements: []
|
|
95
|
+
rubygems_version: 3.6.9
|
|
96
|
+
specification_version: 4
|
|
97
|
+
summary: Crossword Generator API - Ruby Client
|
|
98
|
+
test_files: []
|