brand.dev 0.18.0 → 0.19.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d8d59aa62a298e531e77537f0438264b92262f8a1d6e2c85ed2f65855287586
4
- data.tar.gz: 77fb50c2084d67c77d21b6eb6a7ec79499b840943516981aafa12448906399c8
3
+ metadata.gz: 5236e2be3cfd4c0d76d750b1cf8763549794d34ce485d269b65f28e86c264e1a
4
+ data.tar.gz: 2eca5ea736c10ded4bf560f2312c89122f2755e879fc9b4f3dabe68c45da8b5f
5
5
  SHA512:
6
- metadata.gz: 9553cf289302a4b1c860e1a8b1939d565a4bb0da41b0bf9730f36f7b4bcef11aed20ea7564bdc4dda11cc187c90d71158ae2f1360b333ad6e4a8faef5613e43b
7
- data.tar.gz: 77871bfd059aef79e463543a0681319fff73aa3ef40bba9bef364fd09b9b0734ea09689c4ac391ef75099001832067ed22cc634ca478c4092ab5988e14f22396
6
+ metadata.gz: 483f164eedf7a9ff9fa29cd607998493be1f611f400c4332f6b6d744788bc0b0b597a65f347fe0b51885117b202c6b546dfd5e7c415ba8a8059166302f259618
7
+ data.tar.gz: ec67429f2dc1d6c6807daef902ae95ae214e959b7e80d326b762946f506f61e132d3d8f59084d8819be03ea38a5b0b78e2d929c0665b4a49aef611e9e8af0aac
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.0 (2025-12-22)
4
+
5
+ Full Changelog: [v0.18.0...v0.19.0](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.18.0...v0.19.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([eb518d4](https://github.com/brand-dot-dev/ruby-sdk/commit/eb518d4ef48fa91039cf54e2ccdc0b9261770268))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * calling `break` out of streams should be instantaneous ([df6f134](https://github.com/brand-dot-dev/ruby-sdk/commit/df6f1348f710b76e3fe4d0b604bb1e98472143d6))
15
+ * issue where json.parse errors when receiving HTTP 204 with nobody ([f041e46](https://github.com/brand-dot-dev/ruby-sdk/commit/f041e461d2fd1b711b63cd11a909a1b44e50247c))
16
+
3
17
  ## 0.18.0 (2025-12-14)
4
18
 
5
19
  Full Changelog: [v0.17.0...v0.18.0](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.17.0...v0.18.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "brand.dev", "~> 0.18.0"
20
+ gem "brand.dev", "~> 0.19.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -153,17 +153,19 @@ module BrandDev
153
153
  end
154
154
 
155
155
  self.class.calibrate_socket_timeout(conn, deadline)
156
- conn.request(req) do |rsp|
157
- y << [req, rsp]
158
- break if finished
159
-
160
- rsp.read_body do |bytes|
161
- y << bytes.force_encoding(Encoding::BINARY)
162
- break if finished
163
-
164
- self.class.calibrate_socket_timeout(conn, deadline)
156
+ ::Kernel.catch(:jump) do
157
+ conn.request(req) do |rsp|
158
+ y << [req, rsp]
159
+ ::Kernel.throw(:jump) if finished
160
+
161
+ rsp.read_body do |bytes|
162
+ y << bytes.force_encoding(Encoding::BINARY)
163
+ ::Kernel.throw(:jump) if finished
164
+
165
+ self.class.calibrate_socket_timeout(conn, deadline)
166
+ end
167
+ eof = true
165
168
  end
166
- eof = true
167
169
  end
168
170
  end
169
171
  ensure
@@ -657,7 +657,8 @@ module BrandDev
657
657
  def decode_content(headers, stream:, suppress_error: false)
658
658
  case (content_type = headers["content-type"])
659
659
  in BrandDev::Internal::Util::JSON_CONTENT
660
- json = stream.to_a.join
660
+ return nil if (json = stream.to_a.join).empty?
661
+
661
662
  begin
662
663
  JSON.parse(json, symbolize_names: true)
663
664
  rescue JSON::ParserError => e
@@ -667,7 +668,11 @@ module BrandDev
667
668
  in BrandDev::Internal::Util::JSONL_CONTENT
668
669
  lines = decode_lines(stream)
669
670
  chain_fused(lines) do |y|
670
- lines.each { y << JSON.parse(_1, symbolize_names: true) }
671
+ lines.each do
672
+ next if _1.empty?
673
+
674
+ y << JSON.parse(_1, symbolize_names: true)
675
+ end
671
676
  end
672
677
  in %r{^text/event-stream}
673
678
  lines = decode_lines(stream)
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrandDev
4
+ module Models
5
+ # @see BrandDev::Resources::Brand#prefetch_by_email
6
+ class BrandPrefetchByEmailParams < BrandDev::Internal::Type::BaseModel
7
+ extend BrandDev::Internal::Type::RequestParameters::Converter
8
+ include BrandDev::Internal::Type::RequestParameters
9
+
10
+ # @!attribute email
11
+ # Email address to prefetch brand data for. The domain will be extracted from the
12
+ # email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email
13
+ # addresses are not allowed.
14
+ #
15
+ # @return [String]
16
+ required :email, String
17
+
18
+ # @!attribute timeout_ms
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
+ #
23
+ # @return [Integer, nil]
24
+ optional :timeout_ms, Integer, api_name: :timeoutMS
25
+
26
+ # @!method initialize(email:, timeout_ms: nil, request_options: {})
27
+ # Some parameter documentations has been truncated, see
28
+ # {BrandDev::Models::BrandPrefetchByEmailParams} for more details.
29
+ #
30
+ # @param email [String] Email address to prefetch brand data for. The domain will be extracted from the
31
+ #
32
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
33
+ #
34
+ # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}]
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrandDev
4
+ module Models
5
+ # @see BrandDev::Resources::Brand#prefetch_by_email
6
+ class BrandPrefetchByEmailResponse < BrandDev::Internal::Type::BaseModel
7
+ # @!attribute domain
8
+ # The domain that was queued for prefetching
9
+ #
10
+ # @return [String, nil]
11
+ optional :domain, String
12
+
13
+ # @!attribute message
14
+ # Success message
15
+ #
16
+ # @return [String, nil]
17
+ optional :message, String
18
+
19
+ # @!attribute status
20
+ # Status of the response, e.g., 'ok'
21
+ #
22
+ # @return [String, nil]
23
+ optional :status, String
24
+
25
+ # @!method initialize(domain: nil, message: nil, status: nil)
26
+ # @param domain [String] The domain that was queued for prefetching
27
+ #
28
+ # @param message [String] Success message
29
+ #
30
+ # @param status [String] Status of the response, e.g., 'ok'
31
+ end
32
+ end
33
+ end
@@ -45,6 +45,8 @@ module BrandDev
45
45
 
46
46
  BrandIdentifyFromTransactionParams = BrandDev::Models::BrandIdentifyFromTransactionParams
47
47
 
48
+ BrandPrefetchByEmailParams = BrandDev::Models::BrandPrefetchByEmailParams
49
+
48
50
  BrandPrefetchParams = BrandDev::Models::BrandPrefetchParams
49
51
 
50
52
  BrandRetrieveByEmailParams = BrandDev::Models::BrandRetrieveByEmailParams
@@ -166,6 +166,38 @@ module BrandDev
166
166
  )
167
167
  end
168
168
 
169
+ # Some parameter documentations has been truncated, see
170
+ # {BrandDev::Models::BrandPrefetchByEmailParams} for more details.
171
+ #
172
+ # Signal that you may fetch brand data for a particular domain soon to improve
173
+ # latency. This endpoint accepts an email address, extracts the domain from it,
174
+ # validates that it's not a disposable or free email provider, and queues the
175
+ # domain for prefetching. This endpoint does not charge credits and is available
176
+ # for paid customers to optimize future requests. [You must be on a paid plan to
177
+ # use this endpoint]
178
+ #
179
+ # @overload prefetch_by_email(email:, timeout_ms: nil, request_options: {})
180
+ #
181
+ # @param email [String] Email address to prefetch brand data for. The domain will be extracted from the
182
+ #
183
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
184
+ #
185
+ # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
186
+ #
187
+ # @return [BrandDev::Models::BrandPrefetchByEmailResponse]
188
+ #
189
+ # @see BrandDev::Models::BrandPrefetchByEmailParams
190
+ def prefetch_by_email(params)
191
+ parsed, options = BrandDev::BrandPrefetchByEmailParams.dump_request(params)
192
+ @client.request(
193
+ method: :post,
194
+ path: "brand/prefetch-by-email",
195
+ body: parsed,
196
+ model: BrandDev::Models::BrandPrefetchByEmailResponse,
197
+ options: options
198
+ )
199
+ end
200
+
169
201
  # Some parameter documentations has been truncated, see
170
202
  # {BrandDev::Models::BrandRetrieveByEmailParams} for more details.
171
203
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrandDev
4
- VERSION = "0.18.0"
4
+ VERSION = "0.19.0"
5
5
  end
data/lib/brand_dev.rb CHANGED
@@ -58,6 +58,8 @@ require_relative "brand_dev/models/brand_fonts_params"
58
58
  require_relative "brand_dev/models/brand_fonts_response"
59
59
  require_relative "brand_dev/models/brand_identify_from_transaction_params"
60
60
  require_relative "brand_dev/models/brand_identify_from_transaction_response"
61
+ require_relative "brand_dev/models/brand_prefetch_by_email_params"
62
+ require_relative "brand_dev/models/brand_prefetch_by_email_response"
61
63
  require_relative "brand_dev/models/brand_prefetch_params"
62
64
  require_relative "brand_dev/models/brand_prefetch_response"
63
65
  require_relative "brand_dev/models/brand_retrieve_by_email_params"
@@ -0,0 +1,65 @@
1
+ # typed: strong
2
+
3
+ module BrandDev
4
+ module Models
5
+ class BrandPrefetchByEmailParams < BrandDev::Internal::Type::BaseModel
6
+ extend BrandDev::Internal::Type::RequestParameters::Converter
7
+ include BrandDev::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ BrandDev::BrandPrefetchByEmailParams,
13
+ BrandDev::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # Email address to prefetch brand data for. The domain will be extracted from the
18
+ # email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email
19
+ # addresses are not allowed.
20
+ sig { returns(String) }
21
+ attr_accessor :email
22
+
23
+ # Optional timeout in milliseconds for the request. If the request takes longer
24
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
25
+ # value is 300000ms (5 minutes).
26
+ sig { returns(T.nilable(Integer)) }
27
+ attr_reader :timeout_ms
28
+
29
+ sig { params(timeout_ms: Integer).void }
30
+ attr_writer :timeout_ms
31
+
32
+ sig do
33
+ params(
34
+ email: String,
35
+ timeout_ms: Integer,
36
+ request_options: BrandDev::RequestOptions::OrHash
37
+ ).returns(T.attached_class)
38
+ end
39
+ def self.new(
40
+ # Email address to prefetch brand data for. The domain will be extracted from the
41
+ # email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email
42
+ # addresses are not allowed.
43
+ email:,
44
+ # Optional timeout in milliseconds for the request. If the request takes longer
45
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
46
+ # value is 300000ms (5 minutes).
47
+ timeout_ms: nil,
48
+ request_options: {}
49
+ )
50
+ end
51
+
52
+ sig do
53
+ override.returns(
54
+ {
55
+ email: String,
56
+ timeout_ms: Integer,
57
+ request_options: BrandDev::RequestOptions
58
+ }
59
+ )
60
+ end
61
+ def to_hash
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,57 @@
1
+ # typed: strong
2
+
3
+ module BrandDev
4
+ module Models
5
+ class BrandPrefetchByEmailResponse < BrandDev::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ BrandDev::Models::BrandPrefetchByEmailResponse,
10
+ BrandDev::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # The domain that was queued for prefetching
15
+ sig { returns(T.nilable(String)) }
16
+ attr_reader :domain
17
+
18
+ sig { params(domain: String).void }
19
+ attr_writer :domain
20
+
21
+ # Success message
22
+ sig { returns(T.nilable(String)) }
23
+ attr_reader :message
24
+
25
+ sig { params(message: String).void }
26
+ attr_writer :message
27
+
28
+ # Status of the response, e.g., 'ok'
29
+ sig { returns(T.nilable(String)) }
30
+ attr_reader :status
31
+
32
+ sig { params(status: String).void }
33
+ attr_writer :status
34
+
35
+ sig do
36
+ params(domain: String, message: String, status: String).returns(
37
+ T.attached_class
38
+ )
39
+ end
40
+ def self.new(
41
+ # The domain that was queued for prefetching
42
+ domain: nil,
43
+ # Success message
44
+ message: nil,
45
+ # Status of the response, e.g., 'ok'
46
+ status: nil
47
+ )
48
+ end
49
+
50
+ sig do
51
+ override.returns({ domain: String, message: String, status: String })
52
+ end
53
+ def to_hash
54
+ end
55
+ end
56
+ end
57
+ end
@@ -8,6 +8,8 @@ module BrandDev
8
8
  BrandIdentifyFromTransactionParams =
9
9
  BrandDev::Models::BrandIdentifyFromTransactionParams
10
10
 
11
+ BrandPrefetchByEmailParams = BrandDev::Models::BrandPrefetchByEmailParams
12
+
11
13
  BrandPrefetchParams = BrandDev::Models::BrandPrefetchParams
12
14
 
13
15
  BrandRetrieveByEmailParams = BrandDev::Models::BrandRetrieveByEmailParams
@@ -149,6 +149,32 @@ module BrandDev
149
149
  )
150
150
  end
151
151
 
152
+ # Signal that you may fetch brand data for a particular domain soon to improve
153
+ # latency. This endpoint accepts an email address, extracts the domain from it,
154
+ # validates that it's not a disposable or free email provider, and queues the
155
+ # domain for prefetching. This endpoint does not charge credits and is available
156
+ # for paid customers to optimize future requests. [You must be on a paid plan to
157
+ # use this endpoint]
158
+ sig do
159
+ params(
160
+ email: String,
161
+ timeout_ms: Integer,
162
+ request_options: BrandDev::RequestOptions::OrHash
163
+ ).returns(BrandDev::Models::BrandPrefetchByEmailResponse)
164
+ end
165
+ def prefetch_by_email(
166
+ # Email address to prefetch brand data for. The domain will be extracted from the
167
+ # email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email
168
+ # addresses are not allowed.
169
+ email:,
170
+ # Optional timeout in milliseconds for the request. If the request takes longer
171
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
172
+ # value is 300000ms (5 minutes).
173
+ timeout_ms: nil,
174
+ request_options: {}
175
+ )
176
+ end
177
+
152
178
  # Retrieve brand information using an email address while detecting disposable and
153
179
  # free email addresses. This endpoint extracts the domain from the email address
154
180
  # and returns brand data for that domain. Disposable and free email addresses
@@ -0,0 +1,30 @@
1
+ module BrandDev
2
+ module Models
3
+ type brand_prefetch_by_email_params =
4
+ { email: String, timeout_ms: Integer }
5
+ & BrandDev::Internal::Type::request_parameters
6
+
7
+ class BrandPrefetchByEmailParams < BrandDev::Internal::Type::BaseModel
8
+ extend BrandDev::Internal::Type::RequestParameters::Converter
9
+ include BrandDev::Internal::Type::RequestParameters
10
+
11
+ attr_accessor email: String
12
+
13
+ attr_reader timeout_ms: Integer?
14
+
15
+ def timeout_ms=: (Integer) -> Integer
16
+
17
+ def initialize: (
18
+ email: String,
19
+ ?timeout_ms: Integer,
20
+ ?request_options: BrandDev::request_opts
21
+ ) -> void
22
+
23
+ def to_hash: -> {
24
+ email: String,
25
+ timeout_ms: Integer,
26
+ request_options: BrandDev::RequestOptions
27
+ }
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ module BrandDev
2
+ module Models
3
+ type brand_prefetch_by_email_response =
4
+ { domain: String, message: String, status: String }
5
+
6
+ class BrandPrefetchByEmailResponse < BrandDev::Internal::Type::BaseModel
7
+ attr_reader domain: String?
8
+
9
+ def domain=: (String) -> String
10
+
11
+ attr_reader message: String?
12
+
13
+ def message=: (String) -> String
14
+
15
+ attr_reader status: String?
16
+
17
+ def status=: (String) -> String
18
+
19
+ def initialize: (
20
+ ?domain: String,
21
+ ?message: String,
22
+ ?status: String
23
+ ) -> void
24
+
25
+ def to_hash: -> { domain: String, message: String, status: String }
26
+ end
27
+ end
28
+ end
@@ -5,6 +5,8 @@ module BrandDev
5
5
 
6
6
  class BrandIdentifyFromTransactionParams = BrandDev::Models::BrandIdentifyFromTransactionParams
7
7
 
8
+ class BrandPrefetchByEmailParams = BrandDev::Models::BrandPrefetchByEmailParams
9
+
8
10
  class BrandPrefetchParams = BrandDev::Models::BrandPrefetchParams
9
11
 
10
12
  class BrandRetrieveByEmailParams = BrandDev::Models::BrandRetrieveByEmailParams
@@ -41,6 +41,12 @@ module BrandDev
41
41
  ?request_options: BrandDev::request_opts
42
42
  ) -> BrandDev::Models::BrandPrefetchResponse
43
43
 
44
+ def prefetch_by_email: (
45
+ email: String,
46
+ ?timeout_ms: Integer,
47
+ ?request_options: BrandDev::request_opts
48
+ ) -> BrandDev::Models::BrandPrefetchByEmailResponse
49
+
44
50
  def retrieve_by_email: (
45
51
  email: String,
46
52
  ?force_language: BrandDev::Models::BrandRetrieveByEmailParams::force_language,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brand.dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brand Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-14 00:00:00.000000000 Z
11
+ date: 2025-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -60,6 +60,8 @@ files:
60
60
  - lib/brand_dev/models/brand_fonts_response.rb
61
61
  - lib/brand_dev/models/brand_identify_from_transaction_params.rb
62
62
  - lib/brand_dev/models/brand_identify_from_transaction_response.rb
63
+ - lib/brand_dev/models/brand_prefetch_by_email_params.rb
64
+ - lib/brand_dev/models/brand_prefetch_by_email_response.rb
63
65
  - lib/brand_dev/models/brand_prefetch_params.rb
64
66
  - lib/brand_dev/models/brand_prefetch_response.rb
65
67
  - lib/brand_dev/models/brand_retrieve_by_email_params.rb
@@ -109,6 +111,8 @@ files:
109
111
  - rbi/brand_dev/models/brand_fonts_response.rbi
110
112
  - rbi/brand_dev/models/brand_identify_from_transaction_params.rbi
111
113
  - rbi/brand_dev/models/brand_identify_from_transaction_response.rbi
114
+ - rbi/brand_dev/models/brand_prefetch_by_email_params.rbi
115
+ - rbi/brand_dev/models/brand_prefetch_by_email_response.rbi
112
116
  - rbi/brand_dev/models/brand_prefetch_params.rbi
113
117
  - rbi/brand_dev/models/brand_prefetch_response.rbi
114
118
  - rbi/brand_dev/models/brand_retrieve_by_email_params.rbi
@@ -157,6 +161,8 @@ files:
157
161
  - sig/brand_dev/models/brand_fonts_response.rbs
158
162
  - sig/brand_dev/models/brand_identify_from_transaction_params.rbs
159
163
  - sig/brand_dev/models/brand_identify_from_transaction_response.rbs
164
+ - sig/brand_dev/models/brand_prefetch_by_email_params.rbs
165
+ - sig/brand_dev/models/brand_prefetch_by_email_response.rbs
160
166
  - sig/brand_dev/models/brand_prefetch_params.rbs
161
167
  - sig/brand_dev/models/brand_prefetch_response.rbs
162
168
  - sig/brand_dev/models/brand_retrieve_by_email_params.rbs