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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/README.md +1 -1
- data/lib/context_dev/client.rb +0 -4
- data/lib/context_dev/internal/type/base_model.rb +3 -3
- data/lib/context_dev/models/brand_identify_from_transaction_params.rb +0 -1
- data/lib/context_dev/models/brand_retrieve_by_name_params.rb +5 -5
- data/lib/context_dev/models/industry_retrieve_naics_params.rb +4 -4
- data/lib/context_dev/models/{style_extract_fonts_params.rb → web_extract_fonts_params.rb} +18 -7
- data/lib/context_dev/models/web_extract_fonts_response.rb +168 -0
- data/lib/context_dev/models/{style_extract_styleguide_params.rb → web_extract_styleguide_params.rb} +8 -5
- data/lib/context_dev/models/{style_extract_styleguide_response.rb → web_extract_styleguide_response.rb} +147 -80
- data/lib/context_dev/models/web_screenshot_params.rb +3 -2
- data/lib/context_dev/models/web_web_crawl_md_params.rb +11 -1
- data/lib/context_dev/models/web_web_scrape_html_params.rb +14 -1
- data/lib/context_dev/models/web_web_scrape_md_params.rb +13 -3
- data/lib/context_dev/models/web_web_scrape_sitemap_params.rb +12 -4
- data/lib/context_dev/models.rb +4 -4
- data/lib/context_dev/resources/brand.rb +8 -12
- data/lib/context_dev/resources/industry.rb +3 -3
- data/lib/context_dev/resources/web.rb +87 -21
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +4 -5
- data/rbi/context_dev/client.rbi +0 -3
- data/rbi/context_dev/models/brand_identify_from_transaction_params.rbi +0 -2
- data/rbi/context_dev/models/brand_retrieve_by_name_params.rbi +6 -6
- data/rbi/context_dev/models/industry_retrieve_naics_params.rbi +6 -6
- data/rbi/context_dev/models/{style_extract_fonts_params.rbi → web_extract_fonts_params.rbi} +27 -7
- data/rbi/context_dev/models/web_extract_fonts_response.rbi +301 -0
- data/rbi/context_dev/models/{style_extract_styleguide_params.rbi → web_extract_styleguide_params.rbi} +12 -6
- data/rbi/context_dev/models/{style_extract_styleguide_response.rbi → web_extract_styleguide_response.rbi} +232 -94
- data/rbi/context_dev/models/web_screenshot_params.rbi +6 -4
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +15 -0
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +19 -1
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +17 -2
- data/rbi/context_dev/models/web_web_scrape_sitemap_params.rbi +15 -4
- data/rbi/context_dev/models.rbi +4 -5
- data/rbi/context_dev/resources/brand.rbi +9 -14
- data/rbi/context_dev/resources/industry.rbi +4 -4
- data/rbi/context_dev/resources/web.rbi +83 -17
- data/sig/context_dev/client.rbs +0 -2
- data/sig/context_dev/models/{style_extract_styleguide_params.rbs → web_extract_fonts_params.rbs} +2 -2
- data/sig/context_dev/models/web_extract_fonts_response.rbs +138 -0
- data/sig/context_dev/models/{style_extract_fonts_params.rbs → web_extract_styleguide_params.rbs} +13 -5
- data/sig/context_dev/models/{style_extract_styleguide_response.rbs → web_extract_styleguide_response.rbs} +147 -95
- data/sig/context_dev/models/web_web_crawl_md_params.rbs +7 -0
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +8 -1
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +7 -0
- data/sig/context_dev/models/web_web_scrape_sitemap_params.rbs +7 -1
- data/sig/context_dev/models.rbs +4 -4
- data/sig/context_dev/resources/web.rbs +18 -0
- metadata +14 -17
- data/lib/context_dev/models/style_extract_fonts_response.rb +0 -101
- data/lib/context_dev/resources/style.rb +0 -76
- data/rbi/context_dev/models/style_extract_fonts_response.rbi +0 -153
- data/rbi/context_dev/resources/style.rbi +0 -60
- data/sig/context_dev/models/style_extract_fonts_response.rbs +0 -82
- data/sig/context_dev/resources/style.rbs +0 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module ContextDev
|
|
2
2
|
module Models
|
|
3
3
|
type web_web_scrape_sitemap_params =
|
|
4
|
-
{ domain: String, max_links: Integer }
|
|
4
|
+
{ domain: String, max_links: Integer, url_regex: String }
|
|
5
5
|
& ContextDev::Internal::Type::request_parameters
|
|
6
6
|
|
|
7
7
|
class WebWebScrapeSitemapParams < ContextDev::Internal::Type::BaseModel
|
|
@@ -14,15 +14,21 @@ module ContextDev
|
|
|
14
14
|
|
|
15
15
|
def max_links=: (Integer) -> Integer
|
|
16
16
|
|
|
17
|
+
attr_reader url_regex: String?
|
|
18
|
+
|
|
19
|
+
def url_regex=: (String) -> String
|
|
20
|
+
|
|
17
21
|
def initialize: (
|
|
18
22
|
domain: String,
|
|
19
23
|
?max_links: Integer,
|
|
24
|
+
?url_regex: String,
|
|
20
25
|
?request_options: ContextDev::request_opts
|
|
21
26
|
) -> void
|
|
22
27
|
|
|
23
28
|
def to_hash: -> {
|
|
24
29
|
domain: String,
|
|
25
30
|
max_links: Integer,
|
|
31
|
+
url_regex: String,
|
|
26
32
|
request_options: ContextDev::RequestOptions
|
|
27
33
|
}
|
|
28
34
|
end
|
data/sig/context_dev/models.rbs
CHANGED
|
@@ -21,14 +21,14 @@ module ContextDev
|
|
|
21
21
|
|
|
22
22
|
class IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams
|
|
23
23
|
|
|
24
|
-
class StyleExtractFontsParams = ContextDev::Models::StyleExtractFontsParams
|
|
25
|
-
|
|
26
|
-
class StyleExtractStyleguideParams = ContextDev::Models::StyleExtractStyleguideParams
|
|
27
|
-
|
|
28
24
|
class UtilityPrefetchByEmailParams = ContextDev::Models::UtilityPrefetchByEmailParams
|
|
29
25
|
|
|
30
26
|
class UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams
|
|
31
27
|
|
|
28
|
+
class WebExtractFontsParams = ContextDev::Models::WebExtractFontsParams
|
|
29
|
+
|
|
30
|
+
class WebExtractStyleguideParams = ContextDev::Models::WebExtractStyleguideParams
|
|
31
|
+
|
|
32
32
|
class WebScreenshotParams = ContextDev::Models::WebScreenshotParams
|
|
33
33
|
|
|
34
34
|
class WebWebCrawlMdParams = ContextDev::Models::WebWebCrawlMdParams
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
module ContextDev
|
|
2
2
|
module Resources
|
|
3
3
|
class Web
|
|
4
|
+
def extract_fonts: (
|
|
5
|
+
?direct_url: String,
|
|
6
|
+
?domain: String,
|
|
7
|
+
?timeout_ms: Integer,
|
|
8
|
+
?request_options: ContextDev::request_opts
|
|
9
|
+
) -> ContextDev::Models::WebExtractFontsResponse
|
|
10
|
+
|
|
11
|
+
def extract_styleguide: (
|
|
12
|
+
?direct_url: String,
|
|
13
|
+
?domain: String,
|
|
14
|
+
?timeout_ms: Integer,
|
|
15
|
+
?request_options: ContextDev::request_opts
|
|
16
|
+
) -> ContextDev::Models::WebExtractStyleguideResponse
|
|
17
|
+
|
|
4
18
|
def screenshot: (
|
|
5
19
|
?direct_url: String,
|
|
6
20
|
?domain: String,
|
|
@@ -15,6 +29,7 @@ module ContextDev
|
|
|
15
29
|
?follow_subdomains: bool,
|
|
16
30
|
?include_images: bool,
|
|
17
31
|
?include_links: bool,
|
|
32
|
+
?max_age_ms: Integer,
|
|
18
33
|
?max_depth: Integer,
|
|
19
34
|
?max_pages: Integer,
|
|
20
35
|
?shorten_base64_images: bool,
|
|
@@ -25,6 +40,7 @@ module ContextDev
|
|
|
25
40
|
|
|
26
41
|
def web_scrape_html: (
|
|
27
42
|
url: String,
|
|
43
|
+
?max_age_ms: Integer,
|
|
28
44
|
?request_options: ContextDev::request_opts
|
|
29
45
|
) -> ContextDev::Models::WebWebScrapeHTMLResponse
|
|
30
46
|
|
|
@@ -37,6 +53,7 @@ module ContextDev
|
|
|
37
53
|
url: String,
|
|
38
54
|
?include_images: bool,
|
|
39
55
|
?include_links: bool,
|
|
56
|
+
?max_age_ms: Integer,
|
|
40
57
|
?shorten_base64_images: bool,
|
|
41
58
|
?use_main_content_only: bool,
|
|
42
59
|
?request_options: ContextDev::request_opts
|
|
@@ -45,6 +62,7 @@ module ContextDev
|
|
|
45
62
|
def web_scrape_sitemap: (
|
|
46
63
|
domain: String,
|
|
47
64
|
?max_links: Integer,
|
|
65
|
+
?url_regex: String,
|
|
48
66
|
?request_options: ContextDev::request_opts
|
|
49
67
|
) -> ContextDev::Models::WebWebScrapeSitemapResponse
|
|
50
68
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: context.dev
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Context Dev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cgi
|
|
@@ -91,14 +91,14 @@ files:
|
|
|
91
91
|
- lib/context_dev/models/brand_retrieve_simplified_response.rb
|
|
92
92
|
- lib/context_dev/models/industry_retrieve_naics_params.rb
|
|
93
93
|
- lib/context_dev/models/industry_retrieve_naics_response.rb
|
|
94
|
-
- lib/context_dev/models/style_extract_fonts_params.rb
|
|
95
|
-
- lib/context_dev/models/style_extract_fonts_response.rb
|
|
96
|
-
- lib/context_dev/models/style_extract_styleguide_params.rb
|
|
97
|
-
- lib/context_dev/models/style_extract_styleguide_response.rb
|
|
98
94
|
- lib/context_dev/models/utility_prefetch_by_email_params.rb
|
|
99
95
|
- lib/context_dev/models/utility_prefetch_by_email_response.rb
|
|
100
96
|
- lib/context_dev/models/utility_prefetch_params.rb
|
|
101
97
|
- lib/context_dev/models/utility_prefetch_response.rb
|
|
98
|
+
- lib/context_dev/models/web_extract_fonts_params.rb
|
|
99
|
+
- lib/context_dev/models/web_extract_fonts_response.rb
|
|
100
|
+
- lib/context_dev/models/web_extract_styleguide_params.rb
|
|
101
|
+
- lib/context_dev/models/web_extract_styleguide_response.rb
|
|
102
102
|
- lib/context_dev/models/web_screenshot_params.rb
|
|
103
103
|
- lib/context_dev/models/web_screenshot_response.rb
|
|
104
104
|
- lib/context_dev/models/web_web_crawl_md_params.rb
|
|
@@ -115,7 +115,6 @@ files:
|
|
|
115
115
|
- lib/context_dev/resources/ai.rb
|
|
116
116
|
- lib/context_dev/resources/brand.rb
|
|
117
117
|
- lib/context_dev/resources/industry.rb
|
|
118
|
-
- lib/context_dev/resources/style.rb
|
|
119
118
|
- lib/context_dev/resources/utility.rb
|
|
120
119
|
- lib/context_dev/resources/web.rb
|
|
121
120
|
- lib/context_dev/version.rb
|
|
@@ -161,14 +160,14 @@ files:
|
|
|
161
160
|
- rbi/context_dev/models/brand_retrieve_simplified_response.rbi
|
|
162
161
|
- rbi/context_dev/models/industry_retrieve_naics_params.rbi
|
|
163
162
|
- rbi/context_dev/models/industry_retrieve_naics_response.rbi
|
|
164
|
-
- rbi/context_dev/models/style_extract_fonts_params.rbi
|
|
165
|
-
- rbi/context_dev/models/style_extract_fonts_response.rbi
|
|
166
|
-
- rbi/context_dev/models/style_extract_styleguide_params.rbi
|
|
167
|
-
- rbi/context_dev/models/style_extract_styleguide_response.rbi
|
|
168
163
|
- rbi/context_dev/models/utility_prefetch_by_email_params.rbi
|
|
169
164
|
- rbi/context_dev/models/utility_prefetch_by_email_response.rbi
|
|
170
165
|
- rbi/context_dev/models/utility_prefetch_params.rbi
|
|
171
166
|
- rbi/context_dev/models/utility_prefetch_response.rbi
|
|
167
|
+
- rbi/context_dev/models/web_extract_fonts_params.rbi
|
|
168
|
+
- rbi/context_dev/models/web_extract_fonts_response.rbi
|
|
169
|
+
- rbi/context_dev/models/web_extract_styleguide_params.rbi
|
|
170
|
+
- rbi/context_dev/models/web_extract_styleguide_response.rbi
|
|
172
171
|
- rbi/context_dev/models/web_screenshot_params.rbi
|
|
173
172
|
- rbi/context_dev/models/web_screenshot_response.rbi
|
|
174
173
|
- rbi/context_dev/models/web_web_crawl_md_params.rbi
|
|
@@ -185,7 +184,6 @@ files:
|
|
|
185
184
|
- rbi/context_dev/resources/ai.rbi
|
|
186
185
|
- rbi/context_dev/resources/brand.rbi
|
|
187
186
|
- rbi/context_dev/resources/industry.rbi
|
|
188
|
-
- rbi/context_dev/resources/style.rbi
|
|
189
187
|
- rbi/context_dev/resources/utility.rbi
|
|
190
188
|
- rbi/context_dev/resources/web.rbi
|
|
191
189
|
- rbi/context_dev/version.rbi
|
|
@@ -230,14 +228,14 @@ files:
|
|
|
230
228
|
- sig/context_dev/models/brand_retrieve_simplified_response.rbs
|
|
231
229
|
- sig/context_dev/models/industry_retrieve_naics_params.rbs
|
|
232
230
|
- sig/context_dev/models/industry_retrieve_naics_response.rbs
|
|
233
|
-
- sig/context_dev/models/style_extract_fonts_params.rbs
|
|
234
|
-
- sig/context_dev/models/style_extract_fonts_response.rbs
|
|
235
|
-
- sig/context_dev/models/style_extract_styleguide_params.rbs
|
|
236
|
-
- sig/context_dev/models/style_extract_styleguide_response.rbs
|
|
237
231
|
- sig/context_dev/models/utility_prefetch_by_email_params.rbs
|
|
238
232
|
- sig/context_dev/models/utility_prefetch_by_email_response.rbs
|
|
239
233
|
- sig/context_dev/models/utility_prefetch_params.rbs
|
|
240
234
|
- sig/context_dev/models/utility_prefetch_response.rbs
|
|
235
|
+
- sig/context_dev/models/web_extract_fonts_params.rbs
|
|
236
|
+
- sig/context_dev/models/web_extract_fonts_response.rbs
|
|
237
|
+
- sig/context_dev/models/web_extract_styleguide_params.rbs
|
|
238
|
+
- sig/context_dev/models/web_extract_styleguide_response.rbs
|
|
241
239
|
- sig/context_dev/models/web_screenshot_params.rbs
|
|
242
240
|
- sig/context_dev/models/web_screenshot_response.rbs
|
|
243
241
|
- sig/context_dev/models/web_web_crawl_md_params.rbs
|
|
@@ -254,7 +252,6 @@ files:
|
|
|
254
252
|
- sig/context_dev/resources/ai.rbs
|
|
255
253
|
- sig/context_dev/resources/brand.rbs
|
|
256
254
|
- sig/context_dev/resources/industry.rbs
|
|
257
|
-
- sig/context_dev/resources/style.rbs
|
|
258
255
|
- sig/context_dev/resources/utility.rbs
|
|
259
256
|
- sig/context_dev/resources/web.rbs
|
|
260
257
|
- sig/context_dev/version.rbs
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module ContextDev
|
|
4
|
-
module Models
|
|
5
|
-
# @see ContextDev::Resources::Style#extract_fonts
|
|
6
|
-
class StyleExtractFontsResponse < ContextDev::Internal::Type::BaseModel
|
|
7
|
-
# @!attribute code
|
|
8
|
-
# HTTP status code, e.g., 200
|
|
9
|
-
#
|
|
10
|
-
# @return [Integer]
|
|
11
|
-
required :code, Integer
|
|
12
|
-
|
|
13
|
-
# @!attribute domain
|
|
14
|
-
# The normalized domain that was processed
|
|
15
|
-
#
|
|
16
|
-
# @return [String]
|
|
17
|
-
required :domain, String
|
|
18
|
-
|
|
19
|
-
# @!attribute fonts
|
|
20
|
-
# Array of font usage information
|
|
21
|
-
#
|
|
22
|
-
# @return [Array<ContextDev::Models::StyleExtractFontsResponse::Font>]
|
|
23
|
-
required :fonts,
|
|
24
|
-
-> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::StyleExtractFontsResponse::Font] }
|
|
25
|
-
|
|
26
|
-
# @!attribute status
|
|
27
|
-
# Status of the response, e.g., 'ok'
|
|
28
|
-
#
|
|
29
|
-
# @return [String]
|
|
30
|
-
required :status, String
|
|
31
|
-
|
|
32
|
-
# @!method initialize(code:, domain:, fonts:, status:)
|
|
33
|
-
# @param code [Integer] HTTP status code, e.g., 200
|
|
34
|
-
#
|
|
35
|
-
# @param domain [String] The normalized domain that was processed
|
|
36
|
-
#
|
|
37
|
-
# @param fonts [Array<ContextDev::Models::StyleExtractFontsResponse::Font>] Array of font usage information
|
|
38
|
-
#
|
|
39
|
-
# @param status [String] Status of the response, e.g., 'ok'
|
|
40
|
-
|
|
41
|
-
class Font < ContextDev::Internal::Type::BaseModel
|
|
42
|
-
# @!attribute fallbacks
|
|
43
|
-
# Array of fallback font families
|
|
44
|
-
#
|
|
45
|
-
# @return [Array<String>]
|
|
46
|
-
required :fallbacks, ContextDev::Internal::Type::ArrayOf[String]
|
|
47
|
-
|
|
48
|
-
# @!attribute font
|
|
49
|
-
# Font family name
|
|
50
|
-
#
|
|
51
|
-
# @return [String]
|
|
52
|
-
required :font, String
|
|
53
|
-
|
|
54
|
-
# @!attribute num_elements
|
|
55
|
-
# Number of elements using this font
|
|
56
|
-
#
|
|
57
|
-
# @return [Float]
|
|
58
|
-
required :num_elements, Float
|
|
59
|
-
|
|
60
|
-
# @!attribute num_words
|
|
61
|
-
# Number of words using this font
|
|
62
|
-
#
|
|
63
|
-
# @return [Float]
|
|
64
|
-
required :num_words, Float
|
|
65
|
-
|
|
66
|
-
# @!attribute percent_elements
|
|
67
|
-
# Percentage of elements using this font
|
|
68
|
-
#
|
|
69
|
-
# @return [Float]
|
|
70
|
-
required :percent_elements, Float
|
|
71
|
-
|
|
72
|
-
# @!attribute percent_words
|
|
73
|
-
# Percentage of words using this font
|
|
74
|
-
#
|
|
75
|
-
# @return [Float]
|
|
76
|
-
required :percent_words, Float
|
|
77
|
-
|
|
78
|
-
# @!attribute uses
|
|
79
|
-
# Array of CSS selectors or element types where this font is used
|
|
80
|
-
#
|
|
81
|
-
# @return [Array<String>]
|
|
82
|
-
required :uses, ContextDev::Internal::Type::ArrayOf[String]
|
|
83
|
-
|
|
84
|
-
# @!method initialize(fallbacks:, font:, num_elements:, num_words:, percent_elements:, percent_words:, uses:)
|
|
85
|
-
# @param fallbacks [Array<String>] Array of fallback font families
|
|
86
|
-
#
|
|
87
|
-
# @param font [String] Font family name
|
|
88
|
-
#
|
|
89
|
-
# @param num_elements [Float] Number of elements using this font
|
|
90
|
-
#
|
|
91
|
-
# @param num_words [Float] Number of words using this font
|
|
92
|
-
#
|
|
93
|
-
# @param percent_elements [Float] Percentage of elements using this font
|
|
94
|
-
#
|
|
95
|
-
# @param percent_words [Float] Percentage of words using this font
|
|
96
|
-
#
|
|
97
|
-
# @param uses [Array<String>] Array of CSS selectors or element types where this font is used
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module ContextDev
|
|
4
|
-
module Resources
|
|
5
|
-
class Style
|
|
6
|
-
# Some parameter documentations has been truncated, see
|
|
7
|
-
# {ContextDev::Models::StyleExtractFontsParams} for more details.
|
|
8
|
-
#
|
|
9
|
-
# Extract font information from a brand's website including font families, usage
|
|
10
|
-
# statistics, fallbacks, and element/word counts.
|
|
11
|
-
#
|
|
12
|
-
# @overload extract_fonts(domain:, timeout_ms: nil, request_options: {})
|
|
13
|
-
#
|
|
14
|
-
# @param domain [String] Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domai
|
|
15
|
-
#
|
|
16
|
-
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
17
|
-
#
|
|
18
|
-
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
19
|
-
#
|
|
20
|
-
# @return [ContextDev::Models::StyleExtractFontsResponse]
|
|
21
|
-
#
|
|
22
|
-
# @see ContextDev::Models::StyleExtractFontsParams
|
|
23
|
-
def extract_fonts(params)
|
|
24
|
-
parsed, options = ContextDev::StyleExtractFontsParams.dump_request(params)
|
|
25
|
-
query = ContextDev::Internal::Util.encode_query_params(parsed)
|
|
26
|
-
@client.request(
|
|
27
|
-
method: :get,
|
|
28
|
-
path: "brand/fonts",
|
|
29
|
-
query: query.transform_keys(timeout_ms: "timeoutMS"),
|
|
30
|
-
model: ContextDev::Models::StyleExtractFontsResponse,
|
|
31
|
-
options: options
|
|
32
|
-
)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Some parameter documentations has been truncated, see
|
|
36
|
-
# {ContextDev::Models::StyleExtractStyleguideParams} for more details.
|
|
37
|
-
#
|
|
38
|
-
# Automatically extract comprehensive design system information from a brand's
|
|
39
|
-
# website including colors, typography, spacing, shadows, and UI components.
|
|
40
|
-
# Either 'domain' or 'directUrl' must be provided as a query parameter, but not
|
|
41
|
-
# both.
|
|
42
|
-
#
|
|
43
|
-
# @overload extract_styleguide(direct_url: nil, domain: nil, timeout_ms: nil, request_options: {})
|
|
44
|
-
#
|
|
45
|
-
# @param direct_url [String] A specific URL to fetch the styleguide from directly, bypassing domain resolutio
|
|
46
|
-
#
|
|
47
|
-
# @param domain [String] Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
|
|
48
|
-
#
|
|
49
|
-
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
50
|
-
#
|
|
51
|
-
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
52
|
-
#
|
|
53
|
-
# @return [ContextDev::Models::StyleExtractStyleguideResponse]
|
|
54
|
-
#
|
|
55
|
-
# @see ContextDev::Models::StyleExtractStyleguideParams
|
|
56
|
-
def extract_styleguide(params = {})
|
|
57
|
-
parsed, options = ContextDev::StyleExtractStyleguideParams.dump_request(params)
|
|
58
|
-
query = ContextDev::Internal::Util.encode_query_params(parsed)
|
|
59
|
-
@client.request(
|
|
60
|
-
method: :get,
|
|
61
|
-
path: "brand/styleguide",
|
|
62
|
-
query: query.transform_keys(direct_url: "directUrl", timeout_ms: "timeoutMS"),
|
|
63
|
-
model: ContextDev::Models::StyleExtractStyleguideResponse,
|
|
64
|
-
options: options
|
|
65
|
-
)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# @api private
|
|
69
|
-
#
|
|
70
|
-
# @param client [ContextDev::Client]
|
|
71
|
-
def initialize(client:)
|
|
72
|
-
@client = client
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# typed: strong
|
|
2
|
-
|
|
3
|
-
module ContextDev
|
|
4
|
-
module Models
|
|
5
|
-
class StyleExtractFontsResponse < ContextDev::Internal::Type::BaseModel
|
|
6
|
-
OrHash =
|
|
7
|
-
T.type_alias do
|
|
8
|
-
T.any(
|
|
9
|
-
ContextDev::Models::StyleExtractFontsResponse,
|
|
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::StyleExtractFontsResponse::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
|
-
sig do
|
|
33
|
-
params(
|
|
34
|
-
code: Integer,
|
|
35
|
-
domain: String,
|
|
36
|
-
fonts:
|
|
37
|
-
T::Array[
|
|
38
|
-
ContextDev::Models::StyleExtractFontsResponse::Font::OrHash
|
|
39
|
-
],
|
|
40
|
-
status: String
|
|
41
|
-
).returns(T.attached_class)
|
|
42
|
-
end
|
|
43
|
-
def self.new(
|
|
44
|
-
# HTTP status code, e.g., 200
|
|
45
|
-
code:,
|
|
46
|
-
# The normalized domain that was processed
|
|
47
|
-
domain:,
|
|
48
|
-
# Array of font usage information
|
|
49
|
-
fonts:,
|
|
50
|
-
# Status of the response, e.g., 'ok'
|
|
51
|
-
status:
|
|
52
|
-
)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
sig do
|
|
56
|
-
override.returns(
|
|
57
|
-
{
|
|
58
|
-
code: Integer,
|
|
59
|
-
domain: String,
|
|
60
|
-
fonts:
|
|
61
|
-
T::Array[ContextDev::Models::StyleExtractFontsResponse::Font],
|
|
62
|
-
status: String
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
end
|
|
66
|
-
def to_hash
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
class Font < ContextDev::Internal::Type::BaseModel
|
|
70
|
-
OrHash =
|
|
71
|
-
T.type_alias do
|
|
72
|
-
T.any(
|
|
73
|
-
ContextDev::Models::StyleExtractFontsResponse::Font,
|
|
74
|
-
ContextDev::Internal::AnyHash
|
|
75
|
-
)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
# Array of fallback font families
|
|
79
|
-
sig { returns(T::Array[String]) }
|
|
80
|
-
attr_accessor :fallbacks
|
|
81
|
-
|
|
82
|
-
# Font family name
|
|
83
|
-
sig { returns(String) }
|
|
84
|
-
attr_accessor :font
|
|
85
|
-
|
|
86
|
-
# Number of elements using this font
|
|
87
|
-
sig { returns(Float) }
|
|
88
|
-
attr_accessor :num_elements
|
|
89
|
-
|
|
90
|
-
# Number of words using this font
|
|
91
|
-
sig { returns(Float) }
|
|
92
|
-
attr_accessor :num_words
|
|
93
|
-
|
|
94
|
-
# Percentage of elements using this font
|
|
95
|
-
sig { returns(Float) }
|
|
96
|
-
attr_accessor :percent_elements
|
|
97
|
-
|
|
98
|
-
# Percentage of words using this font
|
|
99
|
-
sig { returns(Float) }
|
|
100
|
-
attr_accessor :percent_words
|
|
101
|
-
|
|
102
|
-
# Array of CSS selectors or element types where this font is used
|
|
103
|
-
sig { returns(T::Array[String]) }
|
|
104
|
-
attr_accessor :uses
|
|
105
|
-
|
|
106
|
-
sig do
|
|
107
|
-
params(
|
|
108
|
-
fallbacks: T::Array[String],
|
|
109
|
-
font: String,
|
|
110
|
-
num_elements: Float,
|
|
111
|
-
num_words: Float,
|
|
112
|
-
percent_elements: Float,
|
|
113
|
-
percent_words: Float,
|
|
114
|
-
uses: T::Array[String]
|
|
115
|
-
).returns(T.attached_class)
|
|
116
|
-
end
|
|
117
|
-
def self.new(
|
|
118
|
-
# Array of fallback font families
|
|
119
|
-
fallbacks:,
|
|
120
|
-
# Font family name
|
|
121
|
-
font:,
|
|
122
|
-
# Number of elements using this font
|
|
123
|
-
num_elements:,
|
|
124
|
-
# Number of words using this font
|
|
125
|
-
num_words:,
|
|
126
|
-
# Percentage of elements using this font
|
|
127
|
-
percent_elements:,
|
|
128
|
-
# Percentage of words using this font
|
|
129
|
-
percent_words:,
|
|
130
|
-
# Array of CSS selectors or element types where this font is used
|
|
131
|
-
uses:
|
|
132
|
-
)
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
sig do
|
|
136
|
-
override.returns(
|
|
137
|
-
{
|
|
138
|
-
fallbacks: T::Array[String],
|
|
139
|
-
font: String,
|
|
140
|
-
num_elements: Float,
|
|
141
|
-
num_words: Float,
|
|
142
|
-
percent_elements: Float,
|
|
143
|
-
percent_words: Float,
|
|
144
|
-
uses: T::Array[String]
|
|
145
|
-
}
|
|
146
|
-
)
|
|
147
|
-
end
|
|
148
|
-
def to_hash
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# typed: strong
|
|
2
|
-
|
|
3
|
-
module ContextDev
|
|
4
|
-
module Resources
|
|
5
|
-
class Style
|
|
6
|
-
# Extract font information from a brand's website including font families, usage
|
|
7
|
-
# statistics, fallbacks, and element/word counts.
|
|
8
|
-
sig do
|
|
9
|
-
params(
|
|
10
|
-
domain: String,
|
|
11
|
-
timeout_ms: Integer,
|
|
12
|
-
request_options: ContextDev::RequestOptions::OrHash
|
|
13
|
-
).returns(ContextDev::Models::StyleExtractFontsResponse)
|
|
14
|
-
end
|
|
15
|
-
def extract_fonts(
|
|
16
|
-
# Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The
|
|
17
|
-
# domain will be automatically normalized and validated.
|
|
18
|
-
domain:,
|
|
19
|
-
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
20
|
-
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
21
|
-
# value is 300000ms (5 minutes).
|
|
22
|
-
timeout_ms: nil,
|
|
23
|
-
request_options: {}
|
|
24
|
-
)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# Automatically extract comprehensive design system information from a brand's
|
|
28
|
-
# website including colors, typography, spacing, shadows, and UI components.
|
|
29
|
-
# Either 'domain' or 'directUrl' must be provided as a query parameter, but not
|
|
30
|
-
# both.
|
|
31
|
-
sig do
|
|
32
|
-
params(
|
|
33
|
-
direct_url: String,
|
|
34
|
-
domain: String,
|
|
35
|
-
timeout_ms: Integer,
|
|
36
|
-
request_options: ContextDev::RequestOptions::OrHash
|
|
37
|
-
).returns(ContextDev::Models::StyleExtractStyleguideResponse)
|
|
38
|
-
end
|
|
39
|
-
def extract_styleguide(
|
|
40
|
-
# A specific URL to fetch the styleguide from directly, bypassing domain
|
|
41
|
-
# resolution (e.g., 'https://example.com/design-system').
|
|
42
|
-
direct_url: nil,
|
|
43
|
-
# Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
|
|
44
|
-
# domain will be automatically normalized and validated.
|
|
45
|
-
domain: nil,
|
|
46
|
-
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
47
|
-
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
48
|
-
# value is 300000ms (5 minutes).
|
|
49
|
-
timeout_ms: nil,
|
|
50
|
-
request_options: {}
|
|
51
|
-
)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# @api private
|
|
55
|
-
sig { params(client: ContextDev::Client).returns(T.attached_class) }
|
|
56
|
-
def self.new(client:)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
module ContextDev
|
|
2
|
-
module Models
|
|
3
|
-
type style_extract_fonts_response =
|
|
4
|
-
{
|
|
5
|
-
code: Integer,
|
|
6
|
-
domain: String,
|
|
7
|
-
fonts: ::Array[ContextDev::Models::StyleExtractFontsResponse::Font],
|
|
8
|
-
status: String
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
class StyleExtractFontsResponse < ContextDev::Internal::Type::BaseModel
|
|
12
|
-
attr_accessor code: Integer
|
|
13
|
-
|
|
14
|
-
attr_accessor domain: String
|
|
15
|
-
|
|
16
|
-
attr_accessor fonts: ::Array[ContextDev::Models::StyleExtractFontsResponse::Font]
|
|
17
|
-
|
|
18
|
-
attr_accessor status: String
|
|
19
|
-
|
|
20
|
-
def initialize: (
|
|
21
|
-
code: Integer,
|
|
22
|
-
domain: String,
|
|
23
|
-
fonts: ::Array[ContextDev::Models::StyleExtractFontsResponse::Font],
|
|
24
|
-
status: String
|
|
25
|
-
) -> void
|
|
26
|
-
|
|
27
|
-
def to_hash: -> {
|
|
28
|
-
code: Integer,
|
|
29
|
-
domain: String,
|
|
30
|
-
fonts: ::Array[ContextDev::Models::StyleExtractFontsResponse::Font],
|
|
31
|
-
status: String
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
type font =
|
|
35
|
-
{
|
|
36
|
-
fallbacks: ::Array[String],
|
|
37
|
-
font: String,
|
|
38
|
-
num_elements: Float,
|
|
39
|
-
num_words: Float,
|
|
40
|
-
percent_elements: Float,
|
|
41
|
-
percent_words: Float,
|
|
42
|
-
uses: ::Array[String]
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
class Font < ContextDev::Internal::Type::BaseModel
|
|
46
|
-
attr_accessor fallbacks: ::Array[String]
|
|
47
|
-
|
|
48
|
-
attr_accessor font: String
|
|
49
|
-
|
|
50
|
-
attr_accessor num_elements: Float
|
|
51
|
-
|
|
52
|
-
attr_accessor num_words: Float
|
|
53
|
-
|
|
54
|
-
attr_accessor percent_elements: Float
|
|
55
|
-
|
|
56
|
-
attr_accessor percent_words: Float
|
|
57
|
-
|
|
58
|
-
attr_accessor uses: ::Array[String]
|
|
59
|
-
|
|
60
|
-
def initialize: (
|
|
61
|
-
fallbacks: ::Array[String],
|
|
62
|
-
font: String,
|
|
63
|
-
num_elements: Float,
|
|
64
|
-
num_words: Float,
|
|
65
|
-
percent_elements: Float,
|
|
66
|
-
percent_words: Float,
|
|
67
|
-
uses: ::Array[String]
|
|
68
|
-
) -> void
|
|
69
|
-
|
|
70
|
-
def to_hash: -> {
|
|
71
|
-
fallbacks: ::Array[String],
|
|
72
|
-
font: String,
|
|
73
|
-
num_elements: Float,
|
|
74
|
-
num_words: Float,
|
|
75
|
-
percent_elements: Float,
|
|
76
|
-
percent_words: Float,
|
|
77
|
-
uses: ::Array[String]
|
|
78
|
-
}
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module ContextDev
|
|
2
|
-
module Resources
|
|
3
|
-
class Style
|
|
4
|
-
def extract_fonts: (
|
|
5
|
-
domain: String,
|
|
6
|
-
?timeout_ms: Integer,
|
|
7
|
-
?request_options: ContextDev::request_opts
|
|
8
|
-
) -> ContextDev::Models::StyleExtractFontsResponse
|
|
9
|
-
|
|
10
|
-
def extract_styleguide: (
|
|
11
|
-
?direct_url: String,
|
|
12
|
-
?domain: String,
|
|
13
|
-
?timeout_ms: Integer,
|
|
14
|
-
?request_options: ContextDev::request_opts
|
|
15
|
-
) -> ContextDev::Models::StyleExtractStyleguideResponse
|
|
16
|
-
|
|
17
|
-
def initialize: (client: ContextDev::Client) -> void
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|