context.dev 1.4.0 → 1.6.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +0 -4
  5. data/lib/context_dev/internal/type/base_model.rb +3 -3
  6. data/lib/context_dev/models/brand_identify_from_transaction_params.rb +0 -1
  7. data/lib/context_dev/models/brand_retrieve_by_name_params.rb +5 -5
  8. data/lib/context_dev/models/industry_retrieve_naics_params.rb +4 -4
  9. data/lib/context_dev/models/{style_extract_fonts_params.rb → web_extract_fonts_params.rb} +18 -7
  10. data/lib/context_dev/models/web_extract_fonts_response.rb +168 -0
  11. data/lib/context_dev/models/{style_extract_styleguide_params.rb → web_extract_styleguide_params.rb} +8 -5
  12. data/lib/context_dev/models/{style_extract_styleguide_response.rb → web_extract_styleguide_response.rb} +147 -80
  13. data/lib/context_dev/models/web_screenshot_params.rb +3 -2
  14. data/lib/context_dev/models/web_web_crawl_md_params.rb +11 -1
  15. data/lib/context_dev/models/web_web_scrape_html_params.rb +14 -1
  16. data/lib/context_dev/models/web_web_scrape_md_params.rb +13 -3
  17. data/lib/context_dev/models/web_web_scrape_sitemap_params.rb +12 -4
  18. data/lib/context_dev/models.rb +4 -4
  19. data/lib/context_dev/resources/brand.rb +8 -12
  20. data/lib/context_dev/resources/industry.rb +3 -3
  21. data/lib/context_dev/resources/web.rb +87 -21
  22. data/lib/context_dev/version.rb +1 -1
  23. data/lib/context_dev.rb +4 -5
  24. data/rbi/context_dev/client.rbi +0 -3
  25. data/rbi/context_dev/models/brand_identify_from_transaction_params.rbi +0 -2
  26. data/rbi/context_dev/models/brand_retrieve_by_name_params.rbi +6 -6
  27. data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +6 -6
  28. data/rbi/context_dev/models/{style_extract_fonts_params.rbi → web_extract_fonts_params.rbi} +27 -7
  29. data/rbi/context_dev/models/web_extract_fonts_response.rbi +301 -0
  30. data/rbi/context_dev/models/{style_extract_styleguide_params.rbi → web_extract_styleguide_params.rbi} +12 -6
  31. data/rbi/context_dev/models/{style_extract_styleguide_response.rbi → web_extract_styleguide_response.rbi} +232 -94
  32. data/rbi/context_dev/models/web_screenshot_params.rbi +6 -4
  33. data/rbi/context_dev/models/web_web_crawl_md_params.rbi +15 -0
  34. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +19 -1
  35. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +17 -2
  36. data/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +15 -4
  37. data/rbi/context_dev/models.rbi +4 -5
  38. data/rbi/context_dev/resources/brand.rbi +9 -14
  39. data/rbi/context_dev/resources/industry.rbi +4 -4
  40. data/rbi/context_dev/resources/web.rbi +83 -17
  41. data/sig/context_dev/client.rbs +0 -2
  42. data/sig/context_dev/models/{style_extract_styleguide_params.rbs → web_extract_fonts_params.rbs} +2 -2
  43. data/sig/context_dev/models/web_extract_fonts_response.rbs +138 -0
  44. data/sig/context_dev/models/{style_extract_fonts_params.rbs → web_extract_styleguide_params.rbs} +13 -5
  45. data/sig/context_dev/models/{style_extract_styleguide_response.rbs → web_extract_styleguide_response.rbs} +147 -95
  46. data/sig/context_dev/models/web_web_crawl_md_params.rbs +7 -0
  47. data/sig/context_dev/models/web_web_scrape_html_params.rbs +8 -1
  48. data/sig/context_dev/models/web_web_scrape_md_params.rbs +7 -0
  49. data/sig/context_dev/models/web_web_scrape_sitemap_params.rbs +7 -1
  50. data/sig/context_dev/models.rbs +4 -4
  51. data/sig/context_dev/resources/web.rbs +18 -0
  52. metadata +14 -17
  53. data/lib/context_dev/models/style_extract_fonts_response.rb +0 -101
  54. data/lib/context_dev/resources/style.rb +0 -76
  55. data/rbi/context_dev/models/style_extract_fonts_response.rbi +0 -153
  56. data/rbi/context_dev/resources/style.rbi +0 -60
  57. data/sig/context_dev/models/style_extract_fonts_response.rbs +0 -82
  58. data/sig/context_dev/resources/style.rbs +0 -20
@@ -0,0 +1,301 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Models
5
+ class WebExtractFontsResponse < ContextDev::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ ContextDev::Models::WebExtractFontsResponse,
10
+ ContextDev::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # HTTP status code, e.g., 200
15
+ sig { returns(Integer) }
16
+ attr_accessor :code
17
+
18
+ # The normalized domain that was processed
19
+ sig { returns(String) }
20
+ attr_accessor :domain
21
+
22
+ # Array of font usage information
23
+ sig do
24
+ returns(T::Array[ContextDev::Models::WebExtractFontsResponse::Font])
25
+ end
26
+ attr_accessor :fonts
27
+
28
+ # Status of the response, e.g., 'ok'
29
+ sig { returns(String) }
30
+ attr_accessor :status
31
+
32
+ # Font assets keyed by family name as it appears in the fonts array (non-generic
33
+ # names only). Clients match entries in fonts to pick a file URL from files.
34
+ # Omitted when no families resolve to Google or custom @font-face URLs.
35
+ sig do
36
+ returns(
37
+ T.nilable(
38
+ T::Hash[
39
+ Symbol,
40
+ ContextDev::Models::WebExtractFontsResponse::FontLink
41
+ ]
42
+ )
43
+ )
44
+ end
45
+ attr_reader :font_links
46
+
47
+ sig do
48
+ params(
49
+ font_links:
50
+ T::Hash[
51
+ Symbol,
52
+ ContextDev::Models::WebExtractFontsResponse::FontLink::OrHash
53
+ ]
54
+ ).void
55
+ end
56
+ attr_writer :font_links
57
+
58
+ sig do
59
+ params(
60
+ code: Integer,
61
+ domain: String,
62
+ fonts:
63
+ T::Array[ContextDev::Models::WebExtractFontsResponse::Font::OrHash],
64
+ status: String,
65
+ font_links:
66
+ T::Hash[
67
+ Symbol,
68
+ ContextDev::Models::WebExtractFontsResponse::FontLink::OrHash
69
+ ]
70
+ ).returns(T.attached_class)
71
+ end
72
+ def self.new(
73
+ # HTTP status code, e.g., 200
74
+ code:,
75
+ # The normalized domain that was processed
76
+ domain:,
77
+ # Array of font usage information
78
+ fonts:,
79
+ # Status of the response, e.g., 'ok'
80
+ status:,
81
+ # Font assets keyed by family name as it appears in the fonts array (non-generic
82
+ # names only). Clients match entries in fonts to pick a file URL from files.
83
+ # Omitted when no families resolve to Google or custom @font-face URLs.
84
+ font_links: nil
85
+ )
86
+ end
87
+
88
+ sig do
89
+ override.returns(
90
+ {
91
+ code: Integer,
92
+ domain: String,
93
+ fonts: T::Array[ContextDev::Models::WebExtractFontsResponse::Font],
94
+ status: String,
95
+ font_links:
96
+ T::Hash[
97
+ Symbol,
98
+ ContextDev::Models::WebExtractFontsResponse::FontLink
99
+ ]
100
+ }
101
+ )
102
+ end
103
+ def to_hash
104
+ end
105
+
106
+ class Font < ContextDev::Internal::Type::BaseModel
107
+ OrHash =
108
+ T.type_alias do
109
+ T.any(
110
+ ContextDev::Models::WebExtractFontsResponse::Font,
111
+ ContextDev::Internal::AnyHash
112
+ )
113
+ end
114
+
115
+ # Array of fallback font families
116
+ sig { returns(T::Array[String]) }
117
+ attr_accessor :fallbacks
118
+
119
+ # Font family name
120
+ sig { returns(String) }
121
+ attr_accessor :font
122
+
123
+ # Number of elements using this font
124
+ sig { returns(Float) }
125
+ attr_accessor :num_elements
126
+
127
+ # Number of words using this font
128
+ sig { returns(Float) }
129
+ attr_accessor :num_words
130
+
131
+ # Percentage of elements using this font
132
+ sig { returns(Float) }
133
+ attr_accessor :percent_elements
134
+
135
+ # Percentage of words using this font
136
+ sig { returns(Float) }
137
+ attr_accessor :percent_words
138
+
139
+ # Array of CSS selectors or element types where this font is used
140
+ sig { returns(T::Array[String]) }
141
+ attr_accessor :uses
142
+
143
+ sig do
144
+ params(
145
+ fallbacks: T::Array[String],
146
+ font: String,
147
+ num_elements: Float,
148
+ num_words: Float,
149
+ percent_elements: Float,
150
+ percent_words: Float,
151
+ uses: T::Array[String]
152
+ ).returns(T.attached_class)
153
+ end
154
+ def self.new(
155
+ # Array of fallback font families
156
+ fallbacks:,
157
+ # Font family name
158
+ font:,
159
+ # Number of elements using this font
160
+ num_elements:,
161
+ # Number of words using this font
162
+ num_words:,
163
+ # Percentage of elements using this font
164
+ percent_elements:,
165
+ # Percentage of words using this font
166
+ percent_words:,
167
+ # Array of CSS selectors or element types where this font is used
168
+ uses:
169
+ )
170
+ end
171
+
172
+ sig do
173
+ override.returns(
174
+ {
175
+ fallbacks: T::Array[String],
176
+ font: String,
177
+ num_elements: Float,
178
+ num_words: Float,
179
+ percent_elements: Float,
180
+ percent_words: Float,
181
+ uses: T::Array[String]
182
+ }
183
+ )
184
+ end
185
+ def to_hash
186
+ end
187
+ end
188
+
189
+ class FontLink < ContextDev::Internal::Type::BaseModel
190
+ OrHash =
191
+ T.type_alias do
192
+ T.any(
193
+ ContextDev::Models::WebExtractFontsResponse::FontLink,
194
+ ContextDev::Internal::AnyHash
195
+ )
196
+ end
197
+
198
+ # Upright font files keyed by weight string (e.g. "400" for regular, "500",
199
+ # "700"). Values are absolute URLs.
200
+ sig { returns(T::Hash[Symbol, String]) }
201
+ attr_accessor :files
202
+
203
+ sig do
204
+ returns(
205
+ ContextDev::Models::WebExtractFontsResponse::FontLink::Type::TaggedSymbol
206
+ )
207
+ end
208
+ attr_accessor :type
209
+
210
+ # Google Fonts category when type is google (e.g. sans-serif, serif, monospace,
211
+ # display, handwriting). Omitted for custom fonts when unknown.
212
+ sig { returns(T.nilable(String)) }
213
+ attr_reader :category
214
+
215
+ sig { params(category: String).void }
216
+ attr_writer :category
217
+
218
+ # Present when type is custom: human-readable name derived from the fontLinks key
219
+ # (strip build/hash suffixes, split camelCase / PascalCase, normalize separators).
220
+ # Google entries omit this.
221
+ sig { returns(T.nilable(String)) }
222
+ attr_reader :display_name
223
+
224
+ sig { params(display_name: String).void }
225
+ attr_writer :display_name
226
+
227
+ sig do
228
+ params(
229
+ files: T::Hash[Symbol, String],
230
+ type:
231
+ ContextDev::Models::WebExtractFontsResponse::FontLink::Type::OrSymbol,
232
+ category: String,
233
+ display_name: String
234
+ ).returns(T.attached_class)
235
+ end
236
+ def self.new(
237
+ # Upright font files keyed by weight string (e.g. "400" for regular, "500",
238
+ # "700"). Values are absolute URLs.
239
+ files:,
240
+ type:,
241
+ # Google Fonts category when type is google (e.g. sans-serif, serif, monospace,
242
+ # display, handwriting). Omitted for custom fonts when unknown.
243
+ category: nil,
244
+ # Present when type is custom: human-readable name derived from the fontLinks key
245
+ # (strip build/hash suffixes, split camelCase / PascalCase, normalize separators).
246
+ # Google entries omit this.
247
+ display_name: nil
248
+ )
249
+ end
250
+
251
+ sig do
252
+ override.returns(
253
+ {
254
+ files: T::Hash[Symbol, String],
255
+ type:
256
+ ContextDev::Models::WebExtractFontsResponse::FontLink::Type::TaggedSymbol,
257
+ category: String,
258
+ display_name: String
259
+ }
260
+ )
261
+ end
262
+ def to_hash
263
+ end
264
+
265
+ module Type
266
+ extend ContextDev::Internal::Type::Enum
267
+
268
+ TaggedSymbol =
269
+ T.type_alias do
270
+ T.all(
271
+ Symbol,
272
+ ContextDev::Models::WebExtractFontsResponse::FontLink::Type
273
+ )
274
+ end
275
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
276
+
277
+ GOOGLE =
278
+ T.let(
279
+ :google,
280
+ ContextDev::Models::WebExtractFontsResponse::FontLink::Type::TaggedSymbol
281
+ )
282
+ CUSTOM =
283
+ T.let(
284
+ :custom,
285
+ ContextDev::Models::WebExtractFontsResponse::FontLink::Type::TaggedSymbol
286
+ )
287
+
288
+ sig do
289
+ override.returns(
290
+ T::Array[
291
+ ContextDev::Models::WebExtractFontsResponse::FontLink::Type::TaggedSymbol
292
+ ]
293
+ )
294
+ end
295
+ def self.values
296
+ end
297
+ end
298
+ end
299
+ end
300
+ end
301
+ end
@@ -2,20 +2,22 @@
2
2
 
3
3
  module ContextDev
4
4
  module Models
5
- class StyleExtractStyleguideParams < ContextDev::Internal::Type::BaseModel
5
+ class WebExtractStyleguideParams < ContextDev::Internal::Type::BaseModel
6
6
  extend ContextDev::Internal::Type::RequestParameters::Converter
7
7
  include ContextDev::Internal::Type::RequestParameters
8
8
 
9
9
  OrHash =
10
10
  T.type_alias do
11
11
  T.any(
12
- ContextDev::StyleExtractStyleguideParams,
12
+ ContextDev::WebExtractStyleguideParams,
13
13
  ContextDev::Internal::AnyHash
14
14
  )
15
15
  end
16
16
 
17
17
  # A specific URL to fetch the styleguide from directly, bypassing domain
18
- # resolution (e.g., 'https://example.com/design-system').
18
+ # resolution (e.g., 'https://example.com/design-system'). When provided, the
19
+ # styleguide is extracted from this exact URL. You must provide either 'domain' or
20
+ # 'directUrl', but not both.
19
21
  sig { returns(T.nilable(String)) }
20
22
  attr_reader :direct_url
21
23
 
@@ -23,7 +25,8 @@ module ContextDev
23
25
  attr_writer :direct_url
24
26
 
25
27
  # Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
26
- # domain will be automatically normalized and validated.
28
+ # domain will be automatically normalized and validated. You must provide either
29
+ # 'domain' or 'directUrl', but not both.
27
30
  sig { returns(T.nilable(String)) }
28
31
  attr_reader :domain
29
32
 
@@ -49,10 +52,13 @@ module ContextDev
49
52
  end
50
53
  def self.new(
51
54
  # A specific URL to fetch the styleguide from directly, bypassing domain
52
- # resolution (e.g., 'https://example.com/design-system').
55
+ # resolution (e.g., 'https://example.com/design-system'). When provided, the
56
+ # styleguide is extracted from this exact URL. You must provide either 'domain' or
57
+ # 'directUrl', but not both.
53
58
  direct_url: nil,
54
59
  # Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
55
- # domain will be automatically normalized and validated.
60
+ # domain will be automatically normalized and validated. You must provide either
61
+ # 'domain' or 'directUrl', but not both.
56
62
  domain: nil,
57
63
  # Optional timeout in milliseconds for the request. If the request takes longer
58
64
  # than this value, it will be aborted with a 408 status code. Maximum allowed