brand.dev 1.0.0 → 1.2.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.
@@ -75,6 +75,10 @@ module BrandDev
75
75
  LINK = :link
76
76
  SOURCE = :source
77
77
  VIDEO = :video
78
+ CSS = :css
79
+ OBJECT = :object
80
+ META = :meta
81
+ BACKGROUND = :background
78
82
 
79
83
  # @!method self.values
80
84
  # @return [Array<Symbol>]
@@ -32,7 +32,14 @@ module BrandDev
32
32
  # @return [Boolean, nil]
33
33
  optional :shorten_base64_images, BrandDev::Internal::Type::Boolean
34
34
 
35
- # @!method initialize(url:, include_images: nil, include_links: nil, shorten_base64_images: nil, request_options: {})
35
+ # @!attribute use_main_content_only
36
+ # Extract only the main content of the page, excluding headers, footers, sidebars,
37
+ # and navigation
38
+ #
39
+ # @return [Boolean, nil]
40
+ optional :use_main_content_only, BrandDev::Internal::Type::Boolean
41
+
42
+ # @!method initialize(url:, include_images: nil, include_links: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {})
36
43
  # Some parameter documentations has been truncated, see
37
44
  # {BrandDev::Models::BrandWebScrapeMdParams} for more details.
38
45
  #
@@ -44,6 +51,8 @@ module BrandDev
44
51
  #
45
52
  # @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output
46
53
  #
54
+ # @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars,
55
+ #
47
56
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}]
48
57
  end
49
58
  end
@@ -503,14 +503,12 @@ module BrandDev
503
503
  # Either 'domain' or 'directUrl' must be provided as a query parameter, but not
504
504
  # both.
505
505
  #
506
- # @overload styleguide(direct_url: nil, domain: nil, prioritize: nil, timeout_ms: nil, request_options: {})
506
+ # @overload styleguide(direct_url: nil, domain: nil, timeout_ms: nil, request_options: {})
507
507
  #
508
508
  # @param direct_url [String] A specific URL to fetch the styleguide from directly, bypassing domain resolutio
509
509
  #
510
510
  # @param domain [String] Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
511
511
  #
512
- # @param prioritize [Symbol, BrandDev::Models::BrandStyleguideParams::Prioritize] Optional parameter to prioritize screenshot capture for styleguide extraction. I
513
- #
514
512
  # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
515
513
  #
516
514
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -584,7 +582,7 @@ module BrandDev
584
582
  # Scrapes the given URL, converts the HTML content to Markdown, and returns the
585
583
  # result.
586
584
  #
587
- # @overload web_scrape_md(url:, include_images: nil, include_links: nil, shorten_base64_images: nil, request_options: {})
585
+ # @overload web_scrape_md(url:, include_images: nil, include_links: nil, shorten_base64_images: nil, use_main_content_only: nil, request_options: {})
588
586
  #
589
587
  # @param url [String] Full URL to scrape and convert to markdown (must include http:// or https:// pro
590
588
  #
@@ -594,6 +592,8 @@ module BrandDev
594
592
  #
595
593
  # @param shorten_base64_images [Boolean] Shorten base64-encoded image data in the Markdown output
596
594
  #
595
+ # @param use_main_content_only [Boolean] Extract only the main content of the page, excluding headers, footers, sidebars,
596
+ #
597
597
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
598
598
  #
599
599
  # @return [BrandDev::Models::BrandWebScrapeMdResponse]
@@ -608,7 +608,8 @@ module BrandDev
608
608
  query: query.transform_keys(
609
609
  include_images: "includeImages",
610
610
  include_links: "includeLinks",
611
- shorten_base64_images: "shortenBase64Images"
611
+ shorten_base64_images: "shortenBase64Images",
612
+ use_main_content_only: "useMainContentOnly"
612
613
  ),
613
614
  model: BrandDev::Models::BrandWebScrapeMdResponse,
614
615
  options: options
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrandDev
4
- VERSION = "1.0.0"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -148,12 +148,20 @@ module BrandDev
148
148
  end
149
149
  end
150
150
 
151
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
152
+ RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)
153
+
151
154
  class << self
152
155
  # @api private
153
156
  sig { params(uri: URI::Generic).returns(String) }
154
157
  def uri_origin(uri)
155
158
  end
156
159
 
160
+ # @api private
161
+ sig { params(path: T.any(String, Integer)).returns(String) }
162
+ def encode_path(path)
163
+ end
164
+
157
165
  # @api private
158
166
  sig { params(path: T.any(String, T::Array[String])).returns(String) }
159
167
  def interpolate_path(path)
@@ -27,24 +27,6 @@ module BrandDev
27
27
  sig { params(domain: String).void }
28
28
  attr_writer :domain
29
29
 
30
- # Optional parameter to prioritize screenshot capture for styleguide extraction.
31
- # If 'speed', optimizes for faster capture with basic quality. If 'quality',
32
- # optimizes for higher quality with longer wait times. Defaults to 'quality' if
33
- # not provided.
34
- sig do
35
- returns(
36
- T.nilable(BrandDev::BrandStyleguideParams::Prioritize::OrSymbol)
37
- )
38
- end
39
- attr_reader :prioritize
40
-
41
- sig do
42
- params(
43
- prioritize: BrandDev::BrandStyleguideParams::Prioritize::OrSymbol
44
- ).void
45
- end
46
- attr_writer :prioritize
47
-
48
30
  # Optional timeout in milliseconds for the request. If the request takes longer
49
31
  # than this value, it will be aborted with a 408 status code. Maximum allowed
50
32
  # value is 300000ms (5 minutes).
@@ -58,7 +40,6 @@ module BrandDev
58
40
  params(
59
41
  direct_url: String,
60
42
  domain: String,
61
- prioritize: BrandDev::BrandStyleguideParams::Prioritize::OrSymbol,
62
43
  timeout_ms: Integer,
63
44
  request_options: BrandDev::RequestOptions::OrHash
64
45
  ).returns(T.attached_class)
@@ -70,11 +51,6 @@ module BrandDev
70
51
  # Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
71
52
  # domain will be automatically normalized and validated.
72
53
  domain: nil,
73
- # Optional parameter to prioritize screenshot capture for styleguide extraction.
74
- # If 'speed', optimizes for faster capture with basic quality. If 'quality',
75
- # optimizes for higher quality with longer wait times. Defaults to 'quality' if
76
- # not provided.
77
- prioritize: nil,
78
54
  # Optional timeout in milliseconds for the request. If the request takes longer
79
55
  # than this value, it will be aborted with a 408 status code. Maximum allowed
80
56
  # value is 300000ms (5 minutes).
@@ -88,7 +64,6 @@ module BrandDev
88
64
  {
89
65
  direct_url: String,
90
66
  domain: String,
91
- prioritize: BrandDev::BrandStyleguideParams::Prioritize::OrSymbol,
92
67
  timeout_ms: Integer,
93
68
  request_options: BrandDev::RequestOptions
94
69
  }
@@ -96,39 +71,6 @@ module BrandDev
96
71
  end
97
72
  def to_hash
98
73
  end
99
-
100
- # Optional parameter to prioritize screenshot capture for styleguide extraction.
101
- # If 'speed', optimizes for faster capture with basic quality. If 'quality',
102
- # optimizes for higher quality with longer wait times. Defaults to 'quality' if
103
- # not provided.
104
- module Prioritize
105
- extend BrandDev::Internal::Type::Enum
106
-
107
- TaggedSymbol =
108
- T.type_alias do
109
- T.all(Symbol, BrandDev::BrandStyleguideParams::Prioritize)
110
- end
111
- OrSymbol = T.type_alias { T.any(Symbol, String) }
112
-
113
- SPEED =
114
- T.let(
115
- :speed,
116
- BrandDev::BrandStyleguideParams::Prioritize::TaggedSymbol
117
- )
118
- QUALITY =
119
- T.let(
120
- :quality,
121
- BrandDev::BrandStyleguideParams::Prioritize::TaggedSymbol
122
- )
123
-
124
- sig do
125
- override.returns(
126
- T::Array[BrandDev::BrandStyleguideParams::Prioritize::TaggedSymbol]
127
- )
128
- end
129
- def self.values
130
- end
131
- end
132
74
  end
133
75
  end
134
76
  end