context.dev 1.8.0 → 1.10.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 +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +1 -1
- data/lib/context_dev/client.rb +15 -1
- data/lib/context_dev/models/ai_extract_product_params.rb +11 -1
- data/lib/context_dev/models/ai_extract_products_params.rb +22 -2
- data/lib/context_dev/models/industry_retrieve_sic_params.rb +76 -0
- data/lib/context_dev/models/industry_retrieve_sic_response.rb +139 -0
- data/lib/context_dev/models.rb +2 -0
- data/lib/context_dev/resources/ai.rb +8 -7
- data/lib/context_dev/resources/industry.rb +40 -0
- data/lib/context_dev/resources/utility.rb +2 -6
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +2 -0
- data/rbi/context_dev/models/ai_extract_product_params.rbi +15 -0
- data/rbi/context_dev/models/ai_extract_products_params.rbi +40 -2
- data/rbi/context_dev/models/industry_retrieve_sic_params.rbi +140 -0
- data/rbi/context_dev/models/industry_retrieve_sic_response.rbi +292 -0
- data/rbi/context_dev/models.rbi +2 -0
- data/rbi/context_dev/resources/ai.rbi +10 -6
- data/rbi/context_dev/resources/industry.rbi +34 -0
- data/rbi/context_dev/resources/utility.rbi +2 -6
- data/sig/context_dev/models/ai_extract_product_params.rbs +7 -1
- data/sig/context_dev/models/ai_extract_products_params.rbs +24 -2
- data/sig/context_dev/models/industry_retrieve_sic_params.rbs +67 -0
- data/sig/context_dev/models/industry_retrieve_sic_response.rbs +125 -0
- data/sig/context_dev/models.rbs +2 -0
- data/sig/context_dev/resources/ai.rbs +1 -0
- data/sig/context_dev/resources/industry.rbs +9 -0
- metadata +8 -2
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
class IndustryRetrieveSicParams < ContextDev::Internal::Type::BaseModel
|
|
6
|
+
extend ContextDev::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include ContextDev::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
ContextDev::IndustryRetrieveSicParams,
|
|
13
|
+
ContextDev::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Brand domain or title to retrieve SIC code for. If a valid domain is provided,
|
|
18
|
+
# it will be used for classification, otherwise, we will search for the brand
|
|
19
|
+
# using the provided title.
|
|
20
|
+
sig { returns(String) }
|
|
21
|
+
attr_accessor :input
|
|
22
|
+
|
|
23
|
+
# Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5.
|
|
24
|
+
sig { returns(T.nilable(Integer)) }
|
|
25
|
+
attr_reader :max_results
|
|
26
|
+
|
|
27
|
+
sig { params(max_results: Integer).void }
|
|
28
|
+
attr_writer :max_results
|
|
29
|
+
|
|
30
|
+
# Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.
|
|
31
|
+
sig { returns(T.nilable(Integer)) }
|
|
32
|
+
attr_reader :min_results
|
|
33
|
+
|
|
34
|
+
sig { params(min_results: Integer).void }
|
|
35
|
+
attr_writer :min_results
|
|
36
|
+
|
|
37
|
+
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
38
|
+
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
39
|
+
# value is 300000ms (5 minutes).
|
|
40
|
+
sig { returns(T.nilable(Integer)) }
|
|
41
|
+
attr_reader :timeout_ms
|
|
42
|
+
|
|
43
|
+
sig { params(timeout_ms: Integer).void }
|
|
44
|
+
attr_writer :timeout_ms
|
|
45
|
+
|
|
46
|
+
# Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
|
|
47
|
+
# Industrial Classification system; `latest_sec` uses the current SIC list as
|
|
48
|
+
# published by the SEC. Defaults to `original_sic`.
|
|
49
|
+
sig do
|
|
50
|
+
returns(
|
|
51
|
+
T.nilable(ContextDev::IndustryRetrieveSicParams::Type::OrSymbol)
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
attr_reader :type
|
|
55
|
+
|
|
56
|
+
sig do
|
|
57
|
+
params(type: ContextDev::IndustryRetrieveSicParams::Type::OrSymbol).void
|
|
58
|
+
end
|
|
59
|
+
attr_writer :type
|
|
60
|
+
|
|
61
|
+
sig do
|
|
62
|
+
params(
|
|
63
|
+
input: String,
|
|
64
|
+
max_results: Integer,
|
|
65
|
+
min_results: Integer,
|
|
66
|
+
timeout_ms: Integer,
|
|
67
|
+
type: ContextDev::IndustryRetrieveSicParams::Type::OrSymbol,
|
|
68
|
+
request_options: ContextDev::RequestOptions::OrHash
|
|
69
|
+
).returns(T.attached_class)
|
|
70
|
+
end
|
|
71
|
+
def self.new(
|
|
72
|
+
# Brand domain or title to retrieve SIC code for. If a valid domain is provided,
|
|
73
|
+
# it will be used for classification, otherwise, we will search for the brand
|
|
74
|
+
# using the provided title.
|
|
75
|
+
input:,
|
|
76
|
+
# Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5.
|
|
77
|
+
max_results: nil,
|
|
78
|
+
# Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.
|
|
79
|
+
min_results: nil,
|
|
80
|
+
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
81
|
+
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
82
|
+
# value is 300000ms (5 minutes).
|
|
83
|
+
timeout_ms: nil,
|
|
84
|
+
# Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
|
|
85
|
+
# Industrial Classification system; `latest_sec` uses the current SIC list as
|
|
86
|
+
# published by the SEC. Defaults to `original_sic`.
|
|
87
|
+
type: nil,
|
|
88
|
+
request_options: {}
|
|
89
|
+
)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
sig do
|
|
93
|
+
override.returns(
|
|
94
|
+
{
|
|
95
|
+
input: String,
|
|
96
|
+
max_results: Integer,
|
|
97
|
+
min_results: Integer,
|
|
98
|
+
timeout_ms: Integer,
|
|
99
|
+
type: ContextDev::IndustryRetrieveSicParams::Type::OrSymbol,
|
|
100
|
+
request_options: ContextDev::RequestOptions
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
def to_hash
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
|
|
108
|
+
# Industrial Classification system; `latest_sec` uses the current SIC list as
|
|
109
|
+
# published by the SEC. Defaults to `original_sic`.
|
|
110
|
+
module Type
|
|
111
|
+
extend ContextDev::Internal::Type::Enum
|
|
112
|
+
|
|
113
|
+
TaggedSymbol =
|
|
114
|
+
T.type_alias do
|
|
115
|
+
T.all(Symbol, ContextDev::IndustryRetrieveSicParams::Type)
|
|
116
|
+
end
|
|
117
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
118
|
+
|
|
119
|
+
ORIGINAL_SIC =
|
|
120
|
+
T.let(
|
|
121
|
+
:original_sic,
|
|
122
|
+
ContextDev::IndustryRetrieveSicParams::Type::TaggedSymbol
|
|
123
|
+
)
|
|
124
|
+
LATEST_SEC =
|
|
125
|
+
T.let(
|
|
126
|
+
:latest_sec,
|
|
127
|
+
ContextDev::IndustryRetrieveSicParams::Type::TaggedSymbol
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
sig do
|
|
131
|
+
override.returns(
|
|
132
|
+
T::Array[ContextDev::IndustryRetrieveSicParams::Type::TaggedSymbol]
|
|
133
|
+
)
|
|
134
|
+
end
|
|
135
|
+
def self.values
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
class IndustryRetrieveSicResponse < ContextDev::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
ContextDev::Models::IndustryRetrieveSicResponse,
|
|
10
|
+
ContextDev::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Echoes back which SIC dataset was used to classify the brand.
|
|
15
|
+
sig do
|
|
16
|
+
returns(
|
|
17
|
+
T.nilable(
|
|
18
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol
|
|
19
|
+
)
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
attr_reader :classification
|
|
23
|
+
|
|
24
|
+
sig do
|
|
25
|
+
params(
|
|
26
|
+
classification:
|
|
27
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Classification::OrSymbol
|
|
28
|
+
).void
|
|
29
|
+
end
|
|
30
|
+
attr_writer :classification
|
|
31
|
+
|
|
32
|
+
# Array of SIC codes with confidence scores. Extra fields depend on the requested
|
|
33
|
+
# classification: `original_sic` results include `majorGroup` and
|
|
34
|
+
# `majorGroupName`; `latest_sec` results include `office`.
|
|
35
|
+
sig do
|
|
36
|
+
returns(
|
|
37
|
+
T.nilable(
|
|
38
|
+
T::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code]
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
attr_reader :codes
|
|
43
|
+
|
|
44
|
+
sig do
|
|
45
|
+
params(
|
|
46
|
+
codes:
|
|
47
|
+
T::Array[
|
|
48
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::OrHash
|
|
49
|
+
]
|
|
50
|
+
).void
|
|
51
|
+
end
|
|
52
|
+
attr_writer :codes
|
|
53
|
+
|
|
54
|
+
# Domain found for the brand
|
|
55
|
+
sig { returns(T.nilable(String)) }
|
|
56
|
+
attr_reader :domain
|
|
57
|
+
|
|
58
|
+
sig { params(domain: String).void }
|
|
59
|
+
attr_writer :domain
|
|
60
|
+
|
|
61
|
+
# Status of the response, e.g., 'ok'
|
|
62
|
+
sig { returns(T.nilable(String)) }
|
|
63
|
+
attr_reader :status
|
|
64
|
+
|
|
65
|
+
sig { params(status: String).void }
|
|
66
|
+
attr_writer :status
|
|
67
|
+
|
|
68
|
+
# Industry classification type, for sic api it will be `sic`
|
|
69
|
+
sig { returns(T.nilable(String)) }
|
|
70
|
+
attr_reader :type
|
|
71
|
+
|
|
72
|
+
sig { params(type: String).void }
|
|
73
|
+
attr_writer :type
|
|
74
|
+
|
|
75
|
+
sig do
|
|
76
|
+
params(
|
|
77
|
+
classification:
|
|
78
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Classification::OrSymbol,
|
|
79
|
+
codes:
|
|
80
|
+
T::Array[
|
|
81
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::OrHash
|
|
82
|
+
],
|
|
83
|
+
domain: String,
|
|
84
|
+
status: String,
|
|
85
|
+
type: String
|
|
86
|
+
).returns(T.attached_class)
|
|
87
|
+
end
|
|
88
|
+
def self.new(
|
|
89
|
+
# Echoes back which SIC dataset was used to classify the brand.
|
|
90
|
+
classification: nil,
|
|
91
|
+
# Array of SIC codes with confidence scores. Extra fields depend on the requested
|
|
92
|
+
# classification: `original_sic` results include `majorGroup` and
|
|
93
|
+
# `majorGroupName`; `latest_sec` results include `office`.
|
|
94
|
+
codes: nil,
|
|
95
|
+
# Domain found for the brand
|
|
96
|
+
domain: nil,
|
|
97
|
+
# Status of the response, e.g., 'ok'
|
|
98
|
+
status: nil,
|
|
99
|
+
# Industry classification type, for sic api it will be `sic`
|
|
100
|
+
type: nil
|
|
101
|
+
)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
sig do
|
|
105
|
+
override.returns(
|
|
106
|
+
{
|
|
107
|
+
classification:
|
|
108
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol,
|
|
109
|
+
codes:
|
|
110
|
+
T::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code],
|
|
111
|
+
domain: String,
|
|
112
|
+
status: String,
|
|
113
|
+
type: String
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
end
|
|
117
|
+
def to_hash
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Echoes back which SIC dataset was used to classify the brand.
|
|
121
|
+
module Classification
|
|
122
|
+
extend ContextDev::Internal::Type::Enum
|
|
123
|
+
|
|
124
|
+
TaggedSymbol =
|
|
125
|
+
T.type_alias do
|
|
126
|
+
T.all(
|
|
127
|
+
Symbol,
|
|
128
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Classification
|
|
129
|
+
)
|
|
130
|
+
end
|
|
131
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
132
|
+
|
|
133
|
+
ORIGINAL_SIC =
|
|
134
|
+
T.let(
|
|
135
|
+
:original_sic,
|
|
136
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol
|
|
137
|
+
)
|
|
138
|
+
LATEST_SEC =
|
|
139
|
+
T.let(
|
|
140
|
+
:latest_sec,
|
|
141
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
sig do
|
|
145
|
+
override.returns(
|
|
146
|
+
T::Array[
|
|
147
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol
|
|
148
|
+
]
|
|
149
|
+
)
|
|
150
|
+
end
|
|
151
|
+
def self.values
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
class Code < ContextDev::Internal::Type::BaseModel
|
|
156
|
+
OrHash =
|
|
157
|
+
T.type_alias do
|
|
158
|
+
T.any(
|
|
159
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code,
|
|
160
|
+
ContextDev::Internal::AnyHash
|
|
161
|
+
)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# SIC code (4-digit).
|
|
165
|
+
sig { returns(String) }
|
|
166
|
+
attr_accessor :code
|
|
167
|
+
|
|
168
|
+
# Confidence level for how well this SIC code matches the company description.
|
|
169
|
+
sig do
|
|
170
|
+
returns(
|
|
171
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol
|
|
172
|
+
)
|
|
173
|
+
end
|
|
174
|
+
attr_accessor :confidence
|
|
175
|
+
|
|
176
|
+
# SIC industry title.
|
|
177
|
+
sig { returns(String) }
|
|
178
|
+
attr_accessor :name
|
|
179
|
+
|
|
180
|
+
# 2-digit major group identifier (the leading two digits of the code). Only
|
|
181
|
+
# present when `classification` is `original_sic`.
|
|
182
|
+
sig { returns(T.nilable(String)) }
|
|
183
|
+
attr_reader :major_group
|
|
184
|
+
|
|
185
|
+
sig { params(major_group: String).void }
|
|
186
|
+
attr_writer :major_group
|
|
187
|
+
|
|
188
|
+
# Description of the 2-digit major group. Only present when `classification` is
|
|
189
|
+
# `original_sic`.
|
|
190
|
+
sig { returns(T.nilable(String)) }
|
|
191
|
+
attr_reader :major_group_name
|
|
192
|
+
|
|
193
|
+
sig { params(major_group_name: String).void }
|
|
194
|
+
attr_writer :major_group_name
|
|
195
|
+
|
|
196
|
+
# SEC review office responsible for filings under this code. Only present when
|
|
197
|
+
# `classification` is `latest_sec`.
|
|
198
|
+
sig { returns(T.nilable(String)) }
|
|
199
|
+
attr_reader :office
|
|
200
|
+
|
|
201
|
+
sig { params(office: String).void }
|
|
202
|
+
attr_writer :office
|
|
203
|
+
|
|
204
|
+
sig do
|
|
205
|
+
params(
|
|
206
|
+
code: String,
|
|
207
|
+
confidence:
|
|
208
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::OrSymbol,
|
|
209
|
+
name: String,
|
|
210
|
+
major_group: String,
|
|
211
|
+
major_group_name: String,
|
|
212
|
+
office: String
|
|
213
|
+
).returns(T.attached_class)
|
|
214
|
+
end
|
|
215
|
+
def self.new(
|
|
216
|
+
# SIC code (4-digit).
|
|
217
|
+
code:,
|
|
218
|
+
# Confidence level for how well this SIC code matches the company description.
|
|
219
|
+
confidence:,
|
|
220
|
+
# SIC industry title.
|
|
221
|
+
name:,
|
|
222
|
+
# 2-digit major group identifier (the leading two digits of the code). Only
|
|
223
|
+
# present when `classification` is `original_sic`.
|
|
224
|
+
major_group: nil,
|
|
225
|
+
# Description of the 2-digit major group. Only present when `classification` is
|
|
226
|
+
# `original_sic`.
|
|
227
|
+
major_group_name: nil,
|
|
228
|
+
# SEC review office responsible for filings under this code. Only present when
|
|
229
|
+
# `classification` is `latest_sec`.
|
|
230
|
+
office: nil
|
|
231
|
+
)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
sig do
|
|
235
|
+
override.returns(
|
|
236
|
+
{
|
|
237
|
+
code: String,
|
|
238
|
+
confidence:
|
|
239
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol,
|
|
240
|
+
name: String,
|
|
241
|
+
major_group: String,
|
|
242
|
+
major_group_name: String,
|
|
243
|
+
office: String
|
|
244
|
+
}
|
|
245
|
+
)
|
|
246
|
+
end
|
|
247
|
+
def to_hash
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Confidence level for how well this SIC code matches the company description.
|
|
251
|
+
module Confidence
|
|
252
|
+
extend ContextDev::Internal::Type::Enum
|
|
253
|
+
|
|
254
|
+
TaggedSymbol =
|
|
255
|
+
T.type_alias do
|
|
256
|
+
T.all(
|
|
257
|
+
Symbol,
|
|
258
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence
|
|
259
|
+
)
|
|
260
|
+
end
|
|
261
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
262
|
+
|
|
263
|
+
HIGH =
|
|
264
|
+
T.let(
|
|
265
|
+
:high,
|
|
266
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol
|
|
267
|
+
)
|
|
268
|
+
MEDIUM =
|
|
269
|
+
T.let(
|
|
270
|
+
:medium,
|
|
271
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol
|
|
272
|
+
)
|
|
273
|
+
LOW =
|
|
274
|
+
T.let(
|
|
275
|
+
:low,
|
|
276
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
sig do
|
|
280
|
+
override.returns(
|
|
281
|
+
T::Array[
|
|
282
|
+
ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol
|
|
283
|
+
]
|
|
284
|
+
)
|
|
285
|
+
end
|
|
286
|
+
def self.values
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
end
|
data/rbi/context_dev/models.rbi
CHANGED
|
@@ -25,6 +25,8 @@ module ContextDev
|
|
|
25
25
|
|
|
26
26
|
IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams
|
|
27
27
|
|
|
28
|
+
IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams
|
|
29
|
+
|
|
28
30
|
UtilityPrefetchByEmailParams =
|
|
29
31
|
ContextDev::Models::UtilityPrefetchByEmailParams
|
|
30
32
|
|
|
@@ -31,12 +31,12 @@ module ContextDev
|
|
|
31
31
|
)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
# Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites.
|
|
34
|
+
# Given a single URL, determines if it is a product page and extracts the product
|
|
35
|
+
# information.
|
|
37
36
|
sig do
|
|
38
37
|
params(
|
|
39
38
|
url: String,
|
|
39
|
+
max_age_ms: Integer,
|
|
40
40
|
timeout_ms: Integer,
|
|
41
41
|
request_options: ContextDev::RequestOptions::OrHash
|
|
42
42
|
).returns(ContextDev::Models::AIExtractProductResponse)
|
|
@@ -44,6 +44,10 @@ module ContextDev
|
|
|
44
44
|
def extract_product(
|
|
45
45
|
# The product page URL to extract product data from.
|
|
46
46
|
url:,
|
|
47
|
+
# Return a cached result if a prior scrape for the same parameters exists and is
|
|
48
|
+
# younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
|
|
49
|
+
# omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
|
|
50
|
+
max_age_ms: nil,
|
|
47
51
|
# Optional timeout in milliseconds for the request. Maximum allowed value is
|
|
48
52
|
# 300000ms (5 minutes).
|
|
49
53
|
timeout_ms: nil,
|
|
@@ -51,9 +55,9 @@ module ContextDev
|
|
|
51
55
|
)
|
|
52
56
|
end
|
|
53
57
|
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
58
|
+
# Extract product information from a brand's website. We will analyze the website
|
|
59
|
+
# and return a list of products with details such as name, description, image,
|
|
60
|
+
# pricing, features, and more.
|
|
57
61
|
sig do
|
|
58
62
|
params(
|
|
59
63
|
body:
|
|
@@ -31,6 +31,40 @@ module ContextDev
|
|
|
31
31
|
)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
# Classify any brand into Standard Industrial Classification (SIC) codes from its
|
|
35
|
+
# domain or name. Choose between the original SIC system (`original_sic`) or the
|
|
36
|
+
# latest SIC list maintained by the SEC (`latest_sec`).
|
|
37
|
+
sig do
|
|
38
|
+
params(
|
|
39
|
+
input: String,
|
|
40
|
+
max_results: Integer,
|
|
41
|
+
min_results: Integer,
|
|
42
|
+
timeout_ms: Integer,
|
|
43
|
+
type: ContextDev::IndustryRetrieveSicParams::Type::OrSymbol,
|
|
44
|
+
request_options: ContextDev::RequestOptions::OrHash
|
|
45
|
+
).returns(ContextDev::Models::IndustryRetrieveSicResponse)
|
|
46
|
+
end
|
|
47
|
+
def retrieve_sic(
|
|
48
|
+
# Brand domain or title to retrieve SIC code for. If a valid domain is provided,
|
|
49
|
+
# it will be used for classification, otherwise, we will search for the brand
|
|
50
|
+
# using the provided title.
|
|
51
|
+
input:,
|
|
52
|
+
# Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5.
|
|
53
|
+
max_results: nil,
|
|
54
|
+
# Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.
|
|
55
|
+
min_results: nil,
|
|
56
|
+
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
57
|
+
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
58
|
+
# value is 300000ms (5 minutes).
|
|
59
|
+
timeout_ms: nil,
|
|
60
|
+
# Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
|
|
61
|
+
# Industrial Classification system; `latest_sec` uses the current SIC list as
|
|
62
|
+
# published by the SEC. Defaults to `original_sic`.
|
|
63
|
+
type: nil,
|
|
64
|
+
request_options: {}
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
34
68
|
# @api private
|
|
35
69
|
sig { params(client: ContextDev::Client).returns(T.attached_class) }
|
|
36
70
|
def self.new(client:)
|
|
@@ -4,9 +4,7 @@ module ContextDev
|
|
|
4
4
|
module Resources
|
|
5
5
|
class Utility
|
|
6
6
|
# Signal that you may fetch brand data for a particular domain soon to improve
|
|
7
|
-
# latency.
|
|
8
|
-
# customers to optimize future requests. [You must be on a paid plan to use this
|
|
9
|
-
# endpoint]
|
|
7
|
+
# latency.
|
|
10
8
|
sig do
|
|
11
9
|
params(
|
|
12
10
|
domain: String,
|
|
@@ -28,9 +26,7 @@ module ContextDev
|
|
|
28
26
|
# Signal that you may fetch brand data for a particular domain soon to improve
|
|
29
27
|
# latency. This endpoint accepts an email address, extracts the domain from it,
|
|
30
28
|
# validates that it's not a disposable or free email provider, and queues the
|
|
31
|
-
# domain for prefetching.
|
|
32
|
-
# for paid customers to optimize future requests. [You must be on a paid plan to
|
|
33
|
-
# use this endpoint]
|
|
29
|
+
# domain for prefetching.
|
|
34
30
|
sig do
|
|
35
31
|
params(
|
|
36
32
|
email: String,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module ContextDev
|
|
2
2
|
module Models
|
|
3
3
|
type ai_extract_product_params =
|
|
4
|
-
{ url: String, timeout_ms: Integer }
|
|
4
|
+
{ url: String, max_age_ms: Integer, timeout_ms: Integer }
|
|
5
5
|
& ContextDev::Internal::Type::request_parameters
|
|
6
6
|
|
|
7
7
|
class AIExtractProductParams < ContextDev::Internal::Type::BaseModel
|
|
@@ -10,18 +10,24 @@ module ContextDev
|
|
|
10
10
|
|
|
11
11
|
attr_accessor url: String
|
|
12
12
|
|
|
13
|
+
attr_reader max_age_ms: Integer?
|
|
14
|
+
|
|
15
|
+
def max_age_ms=: (Integer) -> Integer
|
|
16
|
+
|
|
13
17
|
attr_reader timeout_ms: Integer?
|
|
14
18
|
|
|
15
19
|
def timeout_ms=: (Integer) -> Integer
|
|
16
20
|
|
|
17
21
|
def initialize: (
|
|
18
22
|
url: String,
|
|
23
|
+
?max_age_ms: Integer,
|
|
19
24
|
?timeout_ms: Integer,
|
|
20
25
|
?request_options: ContextDev::request_opts
|
|
21
26
|
) -> void
|
|
22
27
|
|
|
23
28
|
def to_hash: -> {
|
|
24
29
|
url: String,
|
|
30
|
+
max_age_ms: Integer,
|
|
25
31
|
timeout_ms: Integer,
|
|
26
32
|
request_options: ContextDev::RequestOptions
|
|
27
33
|
}
|
|
@@ -28,11 +28,20 @@ module ContextDev
|
|
|
28
28
|
extend ContextDev::Internal::Type::Union
|
|
29
29
|
|
|
30
30
|
type by_domain =
|
|
31
|
-
{
|
|
31
|
+
{
|
|
32
|
+
domain: String,
|
|
33
|
+
max_age_ms: Integer,
|
|
34
|
+
max_products: Integer,
|
|
35
|
+
timeout_ms: Integer
|
|
36
|
+
}
|
|
32
37
|
|
|
33
38
|
class ByDomain < ContextDev::Internal::Type::BaseModel
|
|
34
39
|
attr_accessor domain: String
|
|
35
40
|
|
|
41
|
+
attr_reader max_age_ms: Integer?
|
|
42
|
+
|
|
43
|
+
def max_age_ms=: (Integer) -> Integer
|
|
44
|
+
|
|
36
45
|
attr_reader max_products: Integer?
|
|
37
46
|
|
|
38
47
|
def max_products=: (Integer) -> Integer
|
|
@@ -43,23 +52,34 @@ module ContextDev
|
|
|
43
52
|
|
|
44
53
|
def initialize: (
|
|
45
54
|
domain: String,
|
|
55
|
+
?max_age_ms: Integer,
|
|
46
56
|
?max_products: Integer,
|
|
47
57
|
?timeout_ms: Integer
|
|
48
58
|
) -> void
|
|
49
59
|
|
|
50
60
|
def to_hash: -> {
|
|
51
61
|
domain: String,
|
|
62
|
+
max_age_ms: Integer,
|
|
52
63
|
max_products: Integer,
|
|
53
64
|
timeout_ms: Integer
|
|
54
65
|
}
|
|
55
66
|
end
|
|
56
67
|
|
|
57
68
|
type by_direct_url =
|
|
58
|
-
{
|
|
69
|
+
{
|
|
70
|
+
direct_url: String,
|
|
71
|
+
max_age_ms: Integer,
|
|
72
|
+
max_products: Integer,
|
|
73
|
+
timeout_ms: Integer
|
|
74
|
+
}
|
|
59
75
|
|
|
60
76
|
class ByDirectURL < ContextDev::Internal::Type::BaseModel
|
|
61
77
|
attr_accessor direct_url: String
|
|
62
78
|
|
|
79
|
+
attr_reader max_age_ms: Integer?
|
|
80
|
+
|
|
81
|
+
def max_age_ms=: (Integer) -> Integer
|
|
82
|
+
|
|
63
83
|
attr_reader max_products: Integer?
|
|
64
84
|
|
|
65
85
|
def max_products=: (Integer) -> Integer
|
|
@@ -70,12 +90,14 @@ module ContextDev
|
|
|
70
90
|
|
|
71
91
|
def initialize: (
|
|
72
92
|
direct_url: String,
|
|
93
|
+
?max_age_ms: Integer,
|
|
73
94
|
?max_products: Integer,
|
|
74
95
|
?timeout_ms: Integer
|
|
75
96
|
) -> void
|
|
76
97
|
|
|
77
98
|
def to_hash: -> {
|
|
78
99
|
direct_url: String,
|
|
100
|
+
max_age_ms: Integer,
|
|
79
101
|
max_products: Integer,
|
|
80
102
|
timeout_ms: Integer
|
|
81
103
|
}
|