exa-ai 0.13.0 → 0.14.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.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +119 -73
  3. data/exe/exa-ai +41 -136
  4. data/exe/exa-ai-agent-run-create +55 -20
  5. data/exe/exa-ai-agent-run-delete +1 -8
  6. data/exe/exa-ai-agent-run-events +21 -1
  7. data/exe/exa-ai-agent-run-list +1 -1
  8. data/exe/exa-ai-agent-run-stop +93 -0
  9. data/exe/exa-ai-answer +25 -0
  10. data/exe/exa-ai-context +6 -2
  11. data/exe/exa-ai-find-similar +26 -68
  12. data/exe/exa-ai-get-contents +138 -42
  13. data/exe/exa-ai-search +27 -104
  14. data/exe/exa-ai-search-monitor-batch +93 -0
  15. data/exe/exa-ai-search-monitor-create +104 -0
  16. data/exe/exa-ai-search-monitor-delete +69 -0
  17. data/exe/exa-ai-search-monitor-get +69 -0
  18. data/exe/exa-ai-search-monitor-list +73 -0
  19. data/exe/exa-ai-search-monitor-runs-get +68 -0
  20. data/exe/exa-ai-search-monitor-runs-list +75 -0
  21. data/exe/exa-ai-search-monitor-trigger +69 -0
  22. data/exe/exa-ai-search-monitor-update +102 -0
  23. data/lib/exa/cli/base.rb +57 -0
  24. data/lib/exa/cli/contents_flags.rb +199 -0
  25. data/lib/exa/cli/formatters/agent_run_formatter.rb +79 -3
  26. data/lib/exa/cli/formatters/search_formatter.rb +18 -2
  27. data/lib/exa/cli/formatters/search_monitor_formatter.rb +98 -0
  28. data/lib/exa/cli/search_parser.rb +46 -87
  29. data/lib/exa/client.rb +186 -310
  30. data/lib/exa/resources/agent_run.rb +5 -3
  31. data/lib/exa/resources/agent_run_deletion.rb +17 -0
  32. data/lib/exa/resources/answer.rb +3 -3
  33. data/lib/exa/resources/contents_result.rb +5 -1
  34. data/lib/exa/resources/find_similar_result.rb +5 -1
  35. data/lib/exa/resources/search_monitor.rb +42 -0
  36. data/lib/exa/resources/search_monitor_batch_result.rb +11 -0
  37. data/lib/exa/resources/search_monitor_list.rb +19 -0
  38. data/lib/exa/resources/search_monitor_run.rb +46 -0
  39. data/lib/exa/resources/search_monitor_trigger_result.rb +11 -0
  40. data/lib/exa/resources/search_result.rb +11 -1
  41. data/lib/exa/services/agent_run_cancel.rb +1 -12
  42. data/lib/exa/services/agent_run_create.rb +1 -12
  43. data/lib/exa/services/agent_run_delete.rb +6 -14
  44. data/lib/exa/services/agent_run_events.rb +33 -4
  45. data/lib/exa/services/agent_run_get.rb +1 -12
  46. data/lib/exa/services/agent_run_list.rb +1 -12
  47. data/lib/exa/services/agent_run_stop.rb +21 -0
  48. data/lib/exa/services/agent_run_stream.rb +53 -51
  49. data/lib/exa/services/answer.rb +5 -2
  50. data/lib/exa/services/answer_stream.rb +54 -45
  51. data/lib/exa/services/context.rb +3 -1
  52. data/lib/exa/services/find_similar.rb +9 -2
  53. data/lib/exa/services/get_contents.rb +14 -15
  54. data/lib/exa/services/parameter_converter.rb +128 -111
  55. data/lib/exa/services/search.rb +58 -19
  56. data/lib/exa/services/search_monitors/batch.rb +36 -0
  57. data/lib/exa/services/search_monitors/create.rb +37 -0
  58. data/lib/exa/services/search_monitors/delete.rb +22 -0
  59. data/lib/exa/services/search_monitors/get.rb +22 -0
  60. data/lib/exa/services/search_monitors/list.rb +29 -0
  61. data/lib/exa/services/search_monitors/runs_get.rb +23 -0
  62. data/lib/exa/services/search_monitors/runs_list.rb +29 -0
  63. data/lib/exa/services/search_monitors/trigger.rb +22 -0
  64. data/lib/exa/services/search_monitors/update.rb +42 -0
  65. data/lib/exa/services/search_stream.rb +38 -0
  66. data/lib/exa/version.rb +1 -1
  67. data/lib/exa.rb +18 -50
  68. metadata +30 -84
  69. data/exe/exa-ai-enrichment-cancel +0 -108
  70. data/exe/exa-ai-enrichment-create +0 -226
  71. data/exe/exa-ai-enrichment-delete +0 -122
  72. data/exe/exa-ai-enrichment-get +0 -104
  73. data/exe/exa-ai-enrichment-list +0 -99
  74. data/exe/exa-ai-enrichment-update +0 -171
  75. data/exe/exa-ai-import-create +0 -253
  76. data/exe/exa-ai-import-delete +0 -92
  77. data/exe/exa-ai-import-get +0 -92
  78. data/exe/exa-ai-import-list +0 -72
  79. data/exe/exa-ai-import-update +0 -164
  80. data/exe/exa-ai-monitor-create +0 -223
  81. data/exe/exa-ai-monitor-delete +0 -101
  82. data/exe/exa-ai-monitor-get +0 -92
  83. data/exe/exa-ai-monitor-list +0 -90
  84. data/exe/exa-ai-monitor-runs-get +0 -103
  85. data/exe/exa-ai-monitor-runs-list +0 -110
  86. data/exe/exa-ai-monitor-update +0 -207
  87. data/exe/exa-ai-webset-cancel +0 -97
  88. data/exe/exa-ai-webset-create +0 -254
  89. data/exe/exa-ai-webset-delete +0 -111
  90. data/exe/exa-ai-webset-get +0 -93
  91. data/exe/exa-ai-webset-item-delete +0 -111
  92. data/exe/exa-ai-webset-item-get +0 -105
  93. data/exe/exa-ai-webset-item-list +0 -108
  94. data/exe/exa-ai-webset-list +0 -91
  95. data/exe/exa-ai-webset-search-cancel +0 -104
  96. data/exe/exa-ai-webset-search-create +0 -247
  97. data/exe/exa-ai-webset-search-get +0 -105
  98. data/exe/exa-ai-webset-update +0 -143
  99. data/lib/exa/cli/formatters/enrichment_formatter.rb +0 -125
  100. data/lib/exa/cli/formatters/import_formatter.rb +0 -153
  101. data/lib/exa/cli/formatters/monitor_formatter.rb +0 -144
  102. data/lib/exa/cli/formatters/monitor_run_formatter.rb +0 -126
  103. data/lib/exa/cli/formatters/webset_formatter.rb +0 -134
  104. data/lib/exa/cli/formatters/webset_item_formatter.rb +0 -131
  105. data/lib/exa/cli/formatters/webset_search_formatter.rb +0 -57
  106. data/lib/exa/constants/websets.rb +0 -19
  107. data/lib/exa/resources/import.rb +0 -86
  108. data/lib/exa/resources/import_collection.rb +0 -33
  109. data/lib/exa/resources/monitor.rb +0 -48
  110. data/lib/exa/resources/monitor_collection.rb +0 -30
  111. data/lib/exa/resources/monitor_run.rb +0 -52
  112. data/lib/exa/resources/monitor_run_collection.rb +0 -30
  113. data/lib/exa/resources/webset.rb +0 -74
  114. data/lib/exa/resources/webset_collection.rb +0 -33
  115. data/lib/exa/resources/webset_enrichment.rb +0 -71
  116. data/lib/exa/resources/webset_enrichment_collection.rb +0 -28
  117. data/lib/exa/resources/webset_item_collection.rb +0 -33
  118. data/lib/exa/resources/webset_search.rb +0 -112
  119. data/lib/exa/services/websets/cancel.rb +0 -36
  120. data/lib/exa/services/websets/cancel_enrichment.rb +0 -35
  121. data/lib/exa/services/websets/cancel_search.rb +0 -44
  122. data/lib/exa/services/websets/create.rb +0 -45
  123. data/lib/exa/services/websets/create_enrichment.rb +0 -35
  124. data/lib/exa/services/websets/create_search.rb +0 -48
  125. data/lib/exa/services/websets/create_search_validator.rb +0 -128
  126. data/lib/exa/services/websets/create_validator.rb +0 -213
  127. data/lib/exa/services/websets/delete.rb +0 -36
  128. data/lib/exa/services/websets/delete_enrichment.rb +0 -35
  129. data/lib/exa/services/websets/delete_item.rb +0 -20
  130. data/lib/exa/services/websets/get_item.rb +0 -20
  131. data/lib/exa/services/websets/get_search.rb +0 -43
  132. data/lib/exa/services/websets/import_create.rb +0 -40
  133. data/lib/exa/services/websets/import_delete.rb +0 -37
  134. data/lib/exa/services/websets/import_get.rb +0 -37
  135. data/lib/exa/services/websets/import_list.rb +0 -25
  136. data/lib/exa/services/websets/import_update.rb +0 -38
  137. data/lib/exa/services/websets/import_upload.rb +0 -59
  138. data/lib/exa/services/websets/list.rb +0 -25
  139. data/lib/exa/services/websets/list_items.rb +0 -26
  140. data/lib/exa/services/websets/monitors/create.rb +0 -42
  141. data/lib/exa/services/websets/monitors/delete.rb +0 -32
  142. data/lib/exa/services/websets/monitors/get.rb +0 -33
  143. data/lib/exa/services/websets/monitors/list.rb +0 -27
  144. data/lib/exa/services/websets/monitors/runs/get.rb +0 -37
  145. data/lib/exa/services/websets/monitors/runs/list.rb +0 -30
  146. data/lib/exa/services/websets/monitors/update.rb +0 -33
  147. data/lib/exa/services/websets/retrieve.rb +0 -47
  148. data/lib/exa/services/websets/retrieve_enrichment.rb +0 -35
  149. data/lib/exa/services/websets/update.rb +0 -37
  150. data/lib/exa/services/websets/update_enrichment.rb +0 -36
  151. data/lib/exa/services/websets_parameter_converter.rb +0 -45
@@ -1,134 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module CLI
5
- module Formatters
6
- class WebsetFormatter
7
- def self.format(webset, output_format)
8
- case output_format
9
- when "json"
10
- JSON.generate(webset.to_h)
11
- when "pretty"
12
- JSON.pretty_generate(webset.to_h)
13
- when "text"
14
- format_as_text(webset)
15
- when "toon"
16
- Exa::CLI::Base.encode_as_toon(webset.to_h)
17
- else
18
- raise ArgumentError, "Unknown output format: #{output_format}"
19
- end
20
- end
21
-
22
- def self.format_collection(collection, output_format)
23
- case output_format
24
- when "json"
25
- JSON.generate(collection.to_h)
26
- when "pretty"
27
- format_collection_as_pretty(collection)
28
- when "text"
29
- format_collection_as_text(collection)
30
- when "toon"
31
- Exa::CLI::Base.encode_as_toon(collection.to_h)
32
- else
33
- raise ArgumentError, "Unknown output format: #{output_format}"
34
- end
35
- end
36
-
37
- def self.format_as_text(webset)
38
- lines = []
39
- lines << "Webset: #{webset.id}"
40
- lines << "Status: #{webset.status}"
41
- lines << "Title: #{webset.title}" if webset.title
42
- lines << "Created: #{webset.created_at}" if webset.created_at
43
- lines << "Updated: #{webset.updated_at}" if webset.updated_at
44
-
45
- if webset.searches && !webset.searches.empty?
46
- lines << "\nSearches:"
47
- webset.searches.each do |search|
48
- lines << " - #{search['query']}" if search['query']
49
- end
50
- end
51
-
52
- if webset.enrichments && !webset.enrichments.empty?
53
- lines << "\nEnrichments: #{webset.enrichments.length}"
54
- end
55
-
56
- lines.join("\n")
57
- end
58
- private_class_method :format_as_text
59
-
60
- def self.format_collection_as_text(collection)
61
- lines = ["Websets (#{collection.data.length} items):"]
62
- collection.data.each do |ws|
63
- lines << "\n #{ws['id']}"
64
- lines << " Status: #{ws['status']}"
65
- lines << " Title: #{ws['title']}" if ws['title']
66
- lines << " Created: #{ws['createdAt']}" if ws['createdAt']
67
- end
68
- lines.join("\n")
69
- end
70
- private_class_method :format_collection_as_text
71
-
72
- def self.format_collection_as_pretty(collection)
73
- lines = []
74
-
75
- # Header with count and pagination info
76
- header = "Websets (#{collection.data.length} items)"
77
- header += " - Page #{collection.has_more ? '1 of many' : '1 of 1'}" if collection.data.any?
78
- lines << header
79
-
80
- if collection.has_more
81
- lines << "Next Cursor: #{collection.next_cursor}"
82
- end
83
-
84
- lines << ""
85
-
86
- # Format each webset
87
- collection.data.each_with_index do |ws, idx|
88
- lines << "" if idx > 0 # Blank line between websets
89
-
90
- lines << "Webset ID: #{ws['id']}"
91
- lines << "Status: #{ws['status']}"
92
- lines << "Title: #{ws['title']}" if ws['title']
93
- lines << "External ID: #{ws['externalId']}" if ws['externalId']
94
- lines << "Created: #{ws['createdAt']}" if ws['createdAt']
95
- lines << "Updated: #{ws['updatedAt']}" if ws['updatedAt']
96
-
97
- # Searches
98
- if ws['searches'] && !ws['searches'].empty?
99
- lines << ""
100
- lines << "Searches (#{ws['searches'].length}):"
101
- ws['searches'].each do |search|
102
- status_indicator = case search['status']
103
- when 'completed' then '✓'
104
- when 'running' then '→'
105
- when 'failed' then '✗'
106
- else '•'
107
- end
108
- lines << " #{status_indicator} #{search['query']} (#{search['status']})" if search['query']
109
- end
110
- end
111
-
112
- # Enrichments
113
- if ws['enrichments'] && !ws['enrichments'].empty?
114
- lines << "Enrichments: #{ws['enrichments'].length}"
115
- end
116
-
117
- # Monitors
118
- if ws['monitors'] && !ws['monitors'].empty?
119
- lines << "Monitors: #{ws['monitors'].length}"
120
- end
121
-
122
- # Imports
123
- if ws['imports'] && !ws['imports'].empty?
124
- lines << "Imports: #{ws['imports'].length}"
125
- end
126
- end
127
-
128
- lines.join("\n")
129
- end
130
- private_class_method :format_collection_as_pretty
131
- end
132
- end
133
- end
134
- end
@@ -1,131 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module CLI
5
- module Formatters
6
- class WebsetItemFormatter
7
- def self.format(item, output_format)
8
- case output_format
9
- when "json"
10
- JSON.generate(item)
11
- when "pretty"
12
- format_as_pretty(item)
13
- when "text"
14
- format_as_text(item)
15
- when "toon"
16
- Exa::CLI::Base.encode_as_toon(item)
17
- else
18
- raise ArgumentError, "Unknown output format: #{output_format}"
19
- end
20
- end
21
-
22
- def self.format_collection(collection, output_format)
23
- case output_format
24
- when "json"
25
- JSON.generate(collection.to_h)
26
- when "pretty"
27
- format_collection_as_pretty(collection)
28
- when "text"
29
- format_collection_as_text(collection)
30
- when "toon"
31
- Exa::CLI::Base.encode_as_toon(collection.to_h)
32
- else
33
- raise ArgumentError, "Unknown output format: #{output_format}"
34
- end
35
- end
36
-
37
- def self.format_as_pretty(item)
38
- lines = []
39
- lines << "Item ID: #{item['id']}"
40
- lines << "URL: #{item['url']}" if item['url']
41
- lines << "Title: #{item['title']}" if item['title']
42
- lines << "Status: #{item['status']}" if item['status']
43
- lines << "Created: #{item['createdAt']}" if item['createdAt']
44
- lines << "Updated: #{item['updatedAt']}" if item['updatedAt']
45
-
46
- if item['entity']
47
- lines << ""
48
- lines << "Entity:"
49
- lines << " Type: #{item['entity']['type']}" if item['entity']['type']
50
- lines << " Name: #{item['entity']['name']}" if item['entity']['name']
51
- lines << " Description: #{item['entity']['description']}" if item['entity']['description']
52
- end
53
-
54
- lines.join("\n")
55
- end
56
- private_class_method :format_as_pretty
57
-
58
- def self.format_as_text(item)
59
- lines = []
60
- lines << "Item: #{item['id']}"
61
- lines << "URL: #{item['url']}" if item['url']
62
- lines << "Title: #{item['title']}" if item['title']
63
- lines << "Status: #{item['status']}" if item['status']
64
- lines << "Created: #{item['createdAt']}" if item['createdAt']
65
- lines << "Updated: #{item['updatedAt']}" if item['updatedAt']
66
-
67
- if item['entity']
68
- lines << "\nEntity:"
69
- lines << " Type: #{item['entity']['type']}" if item['entity']['type']
70
- lines << " Name: #{item['entity']['name']}" if item['entity']['name']
71
- end
72
-
73
- lines.join("\n")
74
- end
75
- private_class_method :format_as_text
76
-
77
- def self.format_collection_as_pretty(collection)
78
- lines = []
79
- lines << "Webset Items (#{collection.data.length} items)"
80
-
81
- if collection.has_more
82
- lines << "Next Cursor: #{collection.next_cursor}"
83
- end
84
-
85
- lines << ""
86
-
87
- collection.data.each_with_index do |item, idx|
88
- lines << "" if idx > 0 # Blank line between items
89
-
90
- lines << "Item ID: #{item['id']}"
91
- lines << "URL: #{item['url']}" if item['url']
92
- lines << "Title: #{item['title']}" if item['title']
93
- lines << "Status: #{item['status']}" if item['status']
94
- lines << "Created: #{item['createdAt']}" if item['createdAt']
95
- lines << "Updated: #{item['updatedAt']}" if item['updatedAt']
96
-
97
- if item['entity']
98
- entity_name = item['entity']['name']
99
- entity_type = item['entity']['type']
100
- lines << "Entity: #{entity_name}" if entity_name
101
- lines << "Entity Type: #{entity_type}" if entity_type && !entity_name
102
- end
103
- end
104
-
105
- lines.join("\n")
106
- end
107
- private_class_method :format_collection_as_pretty
108
-
109
- def self.format_collection_as_text(collection)
110
- lines = ["Webset Items (#{collection.data.length} items):"]
111
- collection.data.each_with_index do |item, idx|
112
- lines << "\n#{idx + 1}. #{item['id']}"
113
- lines << " URL: #{item['url']}" if item['url']
114
- lines << " Title: #{item['title']}" if item['title']
115
- lines << " Status: #{item['status']}" if item['status']
116
- if item['entity'] && item['entity']['name']
117
- lines << " Entity: #{item['entity']['name']}"
118
- end
119
- end
120
-
121
- if collection.has_more
122
- lines << "\nMore available (cursor: #{collection.next_cursor})"
123
- end
124
-
125
- lines.join("\n")
126
- end
127
- private_class_method :format_collection_as_text
128
- end
129
- end
130
- end
131
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module CLI
5
- module Formatters
6
- class WebsetSearchFormatter
7
- def self.format(search, format)
8
- case format
9
- when "json"
10
- JSON.pretty_generate(search.to_h)
11
- when "pretty"
12
- format_pretty(search)
13
- when "text"
14
- format_text(search)
15
- when "toon"
16
- Exa::CLI::Base.encode_as_toon(search.to_h)
17
- else
18
- JSON.pretty_generate(search.to_h)
19
- end
20
- end
21
-
22
- private
23
-
24
- def self.format_pretty(search)
25
- output = []
26
- output << "Search ID: #{search.id}"
27
- output << "Status: #{search.status}"
28
- output << "Query: #{search.query}"
29
- output << "Entity Type: #{search.entity&.[]('type') || 'N/A'}" if search.entity
30
- output << "Count: #{search.count}" if search.count
31
- output << "Behavior: #{search.behavior}"
32
- output << "Recall: #{search.recall}" if search.recall
33
- output << "Created: #{search.created_at}"
34
- output << "Updated: #{search.updated_at}"
35
- output << "Progress: #{search.progress}" if search.progress
36
- output << ""
37
-
38
- if search.canceled?
39
- output << "Canceled: #{search.canceled_at}"
40
- output << "Cancel Reason: #{search.canceled_reason}" if search.canceled_reason
41
- end
42
-
43
- output.join("\n")
44
- end
45
-
46
- def self.format_text(search)
47
- [
48
- "ID: #{search.id}",
49
- "Status: #{search.status}",
50
- "Query: #{search.query}",
51
- "Behavior: #{search.behavior}"
52
- ].join("\n")
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module Constants
5
- module Websets
6
- # Valid entity types for websets
7
- ENTITY_TYPES = %w[company person article research_paper custom].freeze
8
-
9
- # Valid enrichment formats
10
- ENRICHMENT_FORMATS = %w[text date number options email phone url].freeze
11
-
12
- # Valid source types for imports and exclusions
13
- SOURCE_TYPES = %w[import webset].freeze
14
-
15
- # Valid import formats
16
- IMPORT_FORMATS = %w[csv].freeze
17
- end
18
- end
19
- end
@@ -1,86 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module Resources
5
- # Represents an import operation for bringing external data into Exa
6
- #
7
- # An import allows uploading CSV data containing entities (e.g., companies)
8
- # to be processed and enriched within the Exa system.
9
- class Import < Struct.new(
10
- :id,
11
- :object,
12
- :status,
13
- :format,
14
- :entity,
15
- :title,
16
- :count,
17
- :metadata,
18
- :failed_reason,
19
- :failed_at,
20
- :failed_message,
21
- :created_at,
22
- :updated_at,
23
- :upload_url,
24
- :upload_valid_until,
25
- keyword_init: true
26
- )
27
- def initialize(
28
- id:,
29
- object:,
30
- status:,
31
- format: nil,
32
- entity: nil,
33
- title: nil,
34
- count: nil,
35
- metadata: nil,
36
- failed_reason: nil,
37
- failed_at: nil,
38
- failed_message: nil,
39
- created_at: nil,
40
- updated_at: nil,
41
- upload_url: nil,
42
- upload_valid_until: nil
43
- )
44
- super
45
- freeze
46
- end
47
-
48
- # Status helper methods
49
- def pending?
50
- status == "pending"
51
- end
52
-
53
- def processing?
54
- status == "processing"
55
- end
56
-
57
- def completed?
58
- status == "completed"
59
- end
60
-
61
- def failed?
62
- status == "failed"
63
- end
64
-
65
- def to_h
66
- {
67
- id: id,
68
- object: object,
69
- status: status,
70
- format: format,
71
- entity: entity,
72
- title: title,
73
- count: count,
74
- metadata: metadata,
75
- failed_reason: failed_reason,
76
- failed_at: failed_at,
77
- failed_message: failed_message,
78
- created_at: created_at,
79
- updated_at: updated_at,
80
- upload_url: upload_url,
81
- upload_valid_until: upload_valid_until
82
- }.compact
83
- end
84
- end
85
- end
86
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module Resources
5
- # Represents a paginated list of imports from the Exa API
6
- #
7
- # This class wraps the JSON response from the GET /websets/v0/imports endpoint
8
- # and provides pagination support.
9
- class ImportCollection < Struct.new(
10
- :data,
11
- :has_more,
12
- :next_cursor,
13
- keyword_init: true
14
- )
15
- def initialize(data:, has_more: false, next_cursor: nil)
16
- super
17
- freeze
18
- end
19
-
20
- def empty?
21
- data.empty?
22
- end
23
-
24
- def to_h
25
- {
26
- data: data,
27
- has_more: has_more,
28
- next_cursor: next_cursor
29
- }
30
- end
31
- end
32
- end
33
- end
@@ -1,48 +0,0 @@
1
- module Exa
2
- module Resources
3
- # Represents a webset monitor that automates updates on a schedule
4
- Monitor = Struct.new(
5
- :id,
6
- :object,
7
- :status,
8
- :webset_id,
9
- :cadence,
10
- :behavior,
11
- :created_at,
12
- :updated_at,
13
- keyword_init: true
14
- ) do
15
- def freeze
16
- super
17
- cadence.freeze if cadence
18
- behavior.freeze if behavior
19
- self
20
- end
21
-
22
- def pending?
23
- status == "pending"
24
- end
25
-
26
- def active?
27
- status == "active"
28
- end
29
-
30
- def paused?
31
- status == "paused"
32
- end
33
-
34
- def to_h
35
- {
36
- id: id,
37
- object: object,
38
- status: status,
39
- webset_id: webset_id,
40
- cadence: cadence,
41
- behavior: behavior,
42
- created_at: created_at,
43
- updated_at: updated_at
44
- }.compact
45
- end
46
- end
47
- end
48
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module Resources
5
- # Represents a paginated list of monitors from the Exa API
6
- class MonitorCollection < Struct.new(
7
- :data,
8
- :has_more,
9
- :next_cursor,
10
- keyword_init: true
11
- )
12
- def initialize(data:, has_more: false, next_cursor: nil)
13
- super
14
- freeze
15
- end
16
-
17
- def empty?
18
- data.empty?
19
- end
20
-
21
- def to_h
22
- {
23
- data: data,
24
- has_more: has_more,
25
- next_cursor: next_cursor
26
- }
27
- end
28
- end
29
- end
30
- end
@@ -1,52 +0,0 @@
1
- module Exa
2
- module Resources
3
- # Represents a monitor run execution
4
- MonitorRun = Struct.new(
5
- :id,
6
- :object,
7
- :monitor_id,
8
- :status,
9
- :created_at,
10
- :updated_at,
11
- :completed_at,
12
- :failed_at,
13
- :failed_reason,
14
- keyword_init: true
15
- ) do
16
- def freeze
17
- super
18
- self
19
- end
20
-
21
- def pending?
22
- status == "pending"
23
- end
24
-
25
- def running?
26
- status == "running"
27
- end
28
-
29
- def completed?
30
- status == "completed"
31
- end
32
-
33
- def failed?
34
- status == "failed"
35
- end
36
-
37
- def to_h
38
- {
39
- id: id,
40
- object: object,
41
- monitor_id: monitor_id,
42
- status: status,
43
- created_at: created_at,
44
- updated_at: updated_at,
45
- completed_at: completed_at,
46
- failed_at: failed_at,
47
- failed_reason: failed_reason
48
- }.compact
49
- end
50
- end
51
- end
52
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module Resources
5
- # Represents a paginated list of monitor runs from the Exa API
6
- class MonitorRunCollection < Struct.new(
7
- :data,
8
- :has_more,
9
- :next_cursor,
10
- keyword_init: true
11
- )
12
- def initialize(data:, has_more: false, next_cursor: nil)
13
- super
14
- freeze
15
- end
16
-
17
- def empty?
18
- data.empty?
19
- end
20
-
21
- def to_h
22
- {
23
- data: data,
24
- has_more: has_more,
25
- next_cursor: next_cursor
26
- }
27
- end
28
- end
29
- end
30
- end
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Exa
4
- module Resources
5
- # Represents a webset from the Exa API
6
- #
7
- # A webset is a collection of web entities (companies, people, etc.)
8
- # discovered through searches, imports, and enrichments.
9
- class Webset < Struct.new(
10
- :id,
11
- :object,
12
- :status,
13
- :external_id,
14
- :title,
15
- :searches,
16
- :imports,
17
- :enrichments,
18
- :monitors,
19
- :excludes,
20
- :metadata,
21
- :created_at,
22
- :updated_at,
23
- :items,
24
- keyword_init: true
25
- )
26
- def initialize(
27
- id:,
28
- object:,
29
- status:,
30
- external_id: nil,
31
- title: nil,
32
- searches: nil,
33
- imports: nil,
34
- enrichments: nil,
35
- monitors: nil,
36
- excludes: nil,
37
- metadata: nil,
38
- created_at: nil,
39
- updated_at: nil,
40
- items: nil
41
- )
42
- super
43
- freeze
44
- end
45
-
46
- def idle?
47
- status == "idle"
48
- end
49
-
50
- def processing?
51
- status == "processing"
52
- end
53
-
54
- def to_h
55
- {
56
- id: id,
57
- object: object,
58
- status: status,
59
- external_id: external_id,
60
- title: title,
61
- searches: searches,
62
- imports: imports,
63
- enrichments: enrichments,
64
- monitors: monitors,
65
- excludes: excludes,
66
- metadata: metadata,
67
- created_at: created_at,
68
- updated_at: updated_at,
69
- items: items
70
- }.compact
71
- end
72
- end
73
- end
74
- end