exaonruby 1.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 +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +614 -0
- data/exaonruby.gemspec +37 -0
- data/exe/exa +7 -0
- data/lib/exa/cli.rb +458 -0
- data/lib/exa/client.rb +210 -0
- data/lib/exa/configuration.rb +81 -0
- data/lib/exa/endpoints/answer.rb +109 -0
- data/lib/exa/endpoints/contents.rb +141 -0
- data/lib/exa/endpoints/events.rb +71 -0
- data/lib/exa/endpoints/find_similar.rb +154 -0
- data/lib/exa/endpoints/imports.rb +145 -0
- data/lib/exa/endpoints/monitors.rb +193 -0
- data/lib/exa/endpoints/research.rb +158 -0
- data/lib/exa/endpoints/search.rb +195 -0
- data/lib/exa/endpoints/webhooks.rb +161 -0
- data/lib/exa/endpoints/webset_enrichments.rb +162 -0
- data/lib/exa/endpoints/webset_items.rb +90 -0
- data/lib/exa/endpoints/webset_searches.rb +137 -0
- data/lib/exa/endpoints/websets.rb +214 -0
- data/lib/exa/errors.rb +180 -0
- data/lib/exa/resources/answer_response.rb +101 -0
- data/lib/exa/resources/base.rb +56 -0
- data/lib/exa/resources/contents_response.rb +123 -0
- data/lib/exa/resources/event.rb +84 -0
- data/lib/exa/resources/import.rb +137 -0
- data/lib/exa/resources/monitor.rb +205 -0
- data/lib/exa/resources/paginated_response.rb +87 -0
- data/lib/exa/resources/research_task.rb +165 -0
- data/lib/exa/resources/search_response.rb +111 -0
- data/lib/exa/resources/search_result.rb +95 -0
- data/lib/exa/resources/webhook.rb +152 -0
- data/lib/exa/resources/webset.rb +491 -0
- data/lib/exa/resources/webset_item.rb +256 -0
- data/lib/exa/utils/parameter_converter.rb +159 -0
- data/lib/exa/utils/webhook_handler.rb +239 -0
- data/lib/exa/version.rb +7 -0
- data/lib/exa.rb +130 -0
- metadata +146 -0
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# typed: strict
|
|
4
|
+
|
|
5
|
+
module Exa
|
|
6
|
+
module Resources
|
|
7
|
+
class Webset < Base
|
|
8
|
+
# @return [String] Unique identifier
|
|
9
|
+
def id
|
|
10
|
+
get(:id)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# @return [String] Object type (always "webset")
|
|
14
|
+
def object
|
|
15
|
+
get(:object)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# @return [String] Status: idle, pending, running, paused
|
|
19
|
+
def status
|
|
20
|
+
get(:status)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# @return [String, nil] External identifier
|
|
24
|
+
def external_id
|
|
25
|
+
get(:external_id)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @return [String, nil] Title of the webset
|
|
29
|
+
def title
|
|
30
|
+
get(:title)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# @return [Array<WebsetSearch>] Associated searches
|
|
34
|
+
def searches
|
|
35
|
+
@searches ||= (get(:searches, []) || []).map { |data| WebsetSearch.new(data) }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @return [Array<WebsetImport>] Associated imports
|
|
39
|
+
def imports
|
|
40
|
+
@imports ||= (get(:imports, []) || []).map { |data| WebsetImport.new(data) }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# @return [Array<WebsetEnrichment>] Associated enrichments
|
|
44
|
+
def enrichments
|
|
45
|
+
@enrichments ||= (get(:enrichments, []) || []).map { |data| WebsetEnrichment.new(data) }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @return [Array<WebsetMonitor>] Associated monitors
|
|
49
|
+
def monitors
|
|
50
|
+
@monitors ||= (get(:monitors, []) || []).map { |data| WebsetMonitor.new(data) }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# @return [Array<WebsetItem>] Items (when included)
|
|
54
|
+
def items
|
|
55
|
+
@items ||= (get(:items, []) || []).map { |data| WebsetItem.new(data) }
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# @return [Array<Hash>] Exclude configurations
|
|
59
|
+
def excludes
|
|
60
|
+
get(:excludes, [])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# @return [Hash] Custom metadata
|
|
64
|
+
def metadata
|
|
65
|
+
get(:metadata, {})
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# @return [Time, nil] Creation timestamp
|
|
69
|
+
def created_at
|
|
70
|
+
parse_time(get(:created_at))
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# @return [Time, nil] Last update timestamp
|
|
74
|
+
def updated_at
|
|
75
|
+
parse_time(get(:updated_at))
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# @return [Boolean] Whether the webset is idle
|
|
79
|
+
def idle?
|
|
80
|
+
status == "idle"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# @return [Boolean] Whether the webset is running
|
|
84
|
+
def running?
|
|
85
|
+
status == "running"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# @return [Boolean] Whether the webset is pending
|
|
89
|
+
def pending?
|
|
90
|
+
status == "pending"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# @return [Boolean] Whether the webset is paused
|
|
94
|
+
def paused?
|
|
95
|
+
status == "paused"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
private
|
|
99
|
+
|
|
100
|
+
def parse_time(value)
|
|
101
|
+
return nil unless value
|
|
102
|
+
|
|
103
|
+
Time.parse(value)
|
|
104
|
+
rescue ArgumentError
|
|
105
|
+
nil
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def inspectable_attributes
|
|
109
|
+
{ id: id, status: status, title: title }
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
class WebsetSearch < Base
|
|
114
|
+
# @return [String] Unique identifier
|
|
115
|
+
def id
|
|
116
|
+
get(:id)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# @return [String] Object type
|
|
120
|
+
def object
|
|
121
|
+
get(:object)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# @return [String] Status: created, running, completed, canceled
|
|
125
|
+
def status
|
|
126
|
+
get(:status)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# @return [String] Parent webset ID
|
|
130
|
+
def webset_id
|
|
131
|
+
get(:webset_id)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# @return [String, nil] Search query
|
|
135
|
+
def query
|
|
136
|
+
get(:query)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# @return [Hash, nil] Entity type configuration
|
|
140
|
+
def entity
|
|
141
|
+
get(:entity)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# @return [String, nil] Entity type (company, person, research_paper)
|
|
145
|
+
def entity_type
|
|
146
|
+
dig(:entity, :type)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# @return [Array<Hash>] Search criteria
|
|
150
|
+
def criteria
|
|
151
|
+
get(:criteria, [])
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# @return [Integer, nil] Target count of results
|
|
155
|
+
def count
|
|
156
|
+
get(:count)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# @return [Array<Hash>] Exclusion rules
|
|
160
|
+
def exclude
|
|
161
|
+
get(:exclude, [])
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# @return [Array<Hash>] Scope configuration
|
|
165
|
+
def scope
|
|
166
|
+
get(:scope, [])
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# @return [Hash, nil] Progress information
|
|
170
|
+
def progress
|
|
171
|
+
get(:progress)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# @return [Integer, nil] Number of items found
|
|
175
|
+
def found_count
|
|
176
|
+
dig(:progress, :found)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# @return [Integer, nil] Number of items analyzed
|
|
180
|
+
def analyzed_count
|
|
181
|
+
dig(:progress, :analyzed)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# @return [Integer, nil] Completion percentage (0-100)
|
|
185
|
+
def completion_percentage
|
|
186
|
+
dig(:progress, :completion)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# @return [Integer, nil] Estimated time remaining in seconds
|
|
190
|
+
def time_left
|
|
191
|
+
dig(:progress, :time_left)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# @return [Hash, nil] Recall estimation
|
|
195
|
+
def recall
|
|
196
|
+
get(:recall)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# @return [String, nil] Search behavior (override, append)
|
|
200
|
+
def behavior
|
|
201
|
+
get(:behavior)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# @return [Hash] Custom metadata
|
|
205
|
+
def metadata
|
|
206
|
+
get(:metadata, {})
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# @return [Time, nil] Cancellation timestamp
|
|
210
|
+
def canceled_at
|
|
211
|
+
parse_time(get(:canceled_at))
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# @return [String, nil] Cancellation reason
|
|
215
|
+
def canceled_reason
|
|
216
|
+
get(:canceled_reason)
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# @return [Time, nil] Creation timestamp
|
|
220
|
+
def created_at
|
|
221
|
+
parse_time(get(:created_at))
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# @return [Time, nil] Last update timestamp
|
|
225
|
+
def updated_at
|
|
226
|
+
parse_time(get(:updated_at))
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# @return [Boolean] Whether search is running
|
|
230
|
+
def running?
|
|
231
|
+
status == "running"
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# @return [Boolean] Whether search is completed
|
|
235
|
+
def completed?
|
|
236
|
+
status == "completed"
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# @return [Boolean] Whether search was canceled
|
|
240
|
+
def canceled?
|
|
241
|
+
status == "canceled"
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
private
|
|
245
|
+
|
|
246
|
+
def parse_time(value)
|
|
247
|
+
return nil unless value
|
|
248
|
+
|
|
249
|
+
Time.parse(value)
|
|
250
|
+
rescue ArgumentError
|
|
251
|
+
nil
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
class WebsetImport < Base
|
|
256
|
+
# @return [String] Unique identifier
|
|
257
|
+
def id
|
|
258
|
+
get(:id)
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# @return [String] Object type
|
|
262
|
+
def object
|
|
263
|
+
get(:object)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# @return [String] Status: pending, processing, completed, failed
|
|
267
|
+
def status
|
|
268
|
+
get(:status)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# @return [String, nil] Import format (csv)
|
|
272
|
+
def format
|
|
273
|
+
get(:format)
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
# @return [Hash, nil] Entity configuration
|
|
277
|
+
def entity
|
|
278
|
+
get(:entity)
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# @return [String, nil] Title
|
|
282
|
+
def title
|
|
283
|
+
get(:title)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# @return [Integer, nil] Number of items
|
|
287
|
+
def count
|
|
288
|
+
get(:count)
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# @return [Hash] Custom metadata
|
|
292
|
+
def metadata
|
|
293
|
+
get(:metadata, {})
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# @return [String, nil] Failure reason if failed
|
|
297
|
+
def failed_reason
|
|
298
|
+
get(:failed_reason)
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
# @return [Time, nil] Failure timestamp
|
|
302
|
+
def failed_at
|
|
303
|
+
parse_time(get(:failed_at))
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# @return [String, nil] Failure message
|
|
307
|
+
def failed_message
|
|
308
|
+
get(:failed_message)
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# @return [Time, nil] Creation timestamp
|
|
312
|
+
def created_at
|
|
313
|
+
parse_time(get(:created_at))
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# @return [Time, nil] Last update timestamp
|
|
317
|
+
def updated_at
|
|
318
|
+
parse_time(get(:updated_at))
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# @return [Boolean] Whether import failed
|
|
322
|
+
def failed?
|
|
323
|
+
status == "failed"
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
private
|
|
327
|
+
|
|
328
|
+
def parse_time(value)
|
|
329
|
+
return nil unless value
|
|
330
|
+
|
|
331
|
+
Time.parse(value)
|
|
332
|
+
rescue ArgumentError
|
|
333
|
+
nil
|
|
334
|
+
end
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
class WebsetEnrichment < Base
|
|
338
|
+
# @return [String] Unique identifier
|
|
339
|
+
def id
|
|
340
|
+
get(:id)
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# @return [String] Object type
|
|
344
|
+
def object
|
|
345
|
+
get(:object)
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# @return [String] Status: pending, running, completed
|
|
349
|
+
def status
|
|
350
|
+
get(:status)
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# @return [String] Parent webset ID
|
|
354
|
+
def webset_id
|
|
355
|
+
get(:webset_id)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
# @return [String, nil] Title
|
|
359
|
+
def title
|
|
360
|
+
get(:title)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
# @return [String, nil] Description of what to extract
|
|
364
|
+
def description
|
|
365
|
+
get(:description)
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# @return [String, nil] Format: text, enum, number, boolean, date
|
|
369
|
+
def format
|
|
370
|
+
get(:format)
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
# @return [Array<Hash>] Options for enum format
|
|
374
|
+
def options
|
|
375
|
+
get(:options, [])
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
# @return [String, nil] Processing instructions
|
|
379
|
+
def instructions
|
|
380
|
+
get(:instructions)
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
# @return [Hash] Custom metadata
|
|
384
|
+
def metadata
|
|
385
|
+
get(:metadata, {})
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
# @return [Time, nil] Creation timestamp
|
|
389
|
+
def created_at
|
|
390
|
+
parse_time(get(:created_at))
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
# @return [Time, nil] Last update timestamp
|
|
394
|
+
def updated_at
|
|
395
|
+
parse_time(get(:updated_at))
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
private
|
|
399
|
+
|
|
400
|
+
def parse_time(value)
|
|
401
|
+
return nil unless value
|
|
402
|
+
|
|
403
|
+
Time.parse(value)
|
|
404
|
+
rescue ArgumentError
|
|
405
|
+
nil
|
|
406
|
+
end
|
|
407
|
+
end
|
|
408
|
+
|
|
409
|
+
class WebsetMonitor < Base
|
|
410
|
+
# @return [String] Unique identifier
|
|
411
|
+
def id
|
|
412
|
+
get(:id)
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
# @return [String] Object type
|
|
416
|
+
def object
|
|
417
|
+
get(:object)
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
# @return [String] Status: enabled, disabled
|
|
421
|
+
def status
|
|
422
|
+
get(:status)
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
# @return [String] Parent webset ID
|
|
426
|
+
def webset_id
|
|
427
|
+
get(:webset_id)
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
# @return [Hash, nil] Cadence configuration
|
|
431
|
+
def cadence
|
|
432
|
+
get(:cadence)
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
# @return [String, nil] Cron expression
|
|
436
|
+
def cron
|
|
437
|
+
dig(:cadence, :cron)
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
# @return [String, nil] Timezone
|
|
441
|
+
def timezone
|
|
442
|
+
dig(:cadence, :timezone)
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
# @return [Hash, nil] Behavior configuration
|
|
446
|
+
def behavior
|
|
447
|
+
get(:behavior)
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
# @return [Hash, nil] Last run information
|
|
451
|
+
def last_run
|
|
452
|
+
get(:last_run)
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
# @return [Time, nil] Next scheduled run
|
|
456
|
+
def next_run_at
|
|
457
|
+
parse_time(get(:next_run_at))
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
# @return [Hash] Custom metadata
|
|
461
|
+
def metadata
|
|
462
|
+
get(:metadata, {})
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
# @return [Time, nil] Creation timestamp
|
|
466
|
+
def created_at
|
|
467
|
+
parse_time(get(:created_at))
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
# @return [Time, nil] Last update timestamp
|
|
471
|
+
def updated_at
|
|
472
|
+
parse_time(get(:updated_at))
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
# @return [Boolean] Whether monitor is enabled
|
|
476
|
+
def enabled?
|
|
477
|
+
status == "enabled"
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
private
|
|
481
|
+
|
|
482
|
+
def parse_time(value)
|
|
483
|
+
return nil unless value
|
|
484
|
+
|
|
485
|
+
Time.parse(value)
|
|
486
|
+
rescue ArgumentError
|
|
487
|
+
nil
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
end
|
|
491
|
+
end
|