brand.dev 0.8.0 → 0.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +1 -1
  4. data/lib/brand_dev/internal/transport/pooled_net_requester.rb +30 -24
  5. data/lib/brand_dev/internal/util.rb +5 -5
  6. data/lib/brand_dev/models/brand_identify_from_transaction_params.rb +80 -1
  7. data/lib/brand_dev/models/brand_retrieve_by_name_params.rb +115 -0
  8. data/lib/brand_dev/models/brand_retrieve_by_name_response.rb +850 -0
  9. data/lib/brand_dev/models/brand_retrieve_by_ticker_params.rb +204 -0
  10. data/lib/brand_dev/models/brand_retrieve_by_ticker_response.rb +850 -0
  11. data/lib/brand_dev/models/brand_retrieve_params.rb +1 -112
  12. data/lib/brand_dev/models.rb +4 -0
  13. data/lib/brand_dev/resources/brand.rb +75 -11
  14. data/lib/brand_dev/version.rb +1 -1
  15. data/lib/brand_dev.rb +4 -0
  16. data/rbi/brand_dev/models/brand_identify_from_transaction_params.rbi +324 -0
  17. data/rbi/brand_dev/models/brand_retrieve_by_name_params.rbi +384 -0
  18. data/rbi/brand_dev/models/brand_retrieve_by_name_response.rbi +2588 -0
  19. data/rbi/brand_dev/models/brand_retrieve_by_ticker_params.rbi +790 -0
  20. data/rbi/brand_dev/models/brand_retrieve_by_ticker_response.rbi +2590 -0
  21. data/rbi/brand_dev/models/brand_retrieve_params.rbi +0 -437
  22. data/rbi/brand_dev/models.rbi +4 -0
  23. data/rbi/brand_dev/resources/brand.rbi +75 -17
  24. data/sig/brand_dev/models/brand_identify_from_transaction_params.rbs +133 -1
  25. data/sig/brand_dev/models/brand_retrieve_by_name_params.rbs +162 -0
  26. data/sig/brand_dev/models/brand_retrieve_by_name_response.rbs +1076 -0
  27. data/sig/brand_dev/models/brand_retrieve_by_ticker_params.rbs +324 -0
  28. data/sig/brand_dev/models/brand_retrieve_by_ticker_response.rbs +1076 -0
  29. data/sig/brand_dev/models/brand_retrieve_params.rbs +0 -176
  30. data/sig/brand_dev/models.rbs +4 -0
  31. data/sig/brand_dev/resources/brand.rbs +19 -3
  32. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2a777226800e59bc4e2049b62764ebe941bb521595593edb0b046969fd37d82
4
- data.tar.gz: 3491f48a0bf45538ad64d0eeb21897a181c60c64d4eaa78987c1f86802b2ea59
3
+ metadata.gz: 0ef03e7b6853ec28ff9e849eefdddb67833cca59c7425eed236c940c2734ee9a
4
+ data.tar.gz: c9fed285665ae840bc83604781fa85440938d6870d1bb76afb2526cd7016bf1e
5
5
  SHA512:
6
- metadata.gz: e019fe296386830d0bd10ac02f2720a27a568b6553f9dab0f94e11a52f75b29d8ab9dded416615a1236b32daa00df4d862393dc18c146836449f54594417130e
7
- data.tar.gz: 247ba3c2617791ee32a412d1547bf7b54723d04ccc979c9fe28ee74d6d2d989f238280763c299e0e410b06c6d280e9c2f3f296d5c41b10ba050a6df56707e469
6
+ metadata.gz: c50034c0f2ed5f2f5d262fc62df5622d9ca9c9af7fb1948c1f9398271e9573c47e48543a89737fefb2edd4f965b9b803f9bdf1539f3913a567206a66e1afd1fd
7
+ data.tar.gz: a77bac67dd721824b3c1196d05d137f757f42094f2aa4d15deb10dc63373ea48a3dfa047548bc4027e2aaaa5f689c606cca7151462ab441992cb002e14a38b79
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0 (2025-10-30)
4
+
5
+ Full Changelog: [v0.9.0...v0.10.0](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.9.0...v0.10.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([07b68c6](https://github.com/brand-dot-dev/ruby-sdk/commit/07b68c68b7b9eea13e58243cb68e09c4bba0a3c5))
10
+ * **api:** api update ([a7d19e7](https://github.com/brand-dot-dev/ruby-sdk/commit/a7d19e70873dfd9b9a6aa4d66a53158f7b1fab19))
11
+ * **api:** manual updates ([0b3251c](https://github.com/brand-dot-dev/ruby-sdk/commit/0b3251ca8e25b0a4d9b7ca9daccfe9201bd0b0fc))
12
+
13
+ ## 0.9.0 (2025-10-24)
14
+
15
+ Full Changelog: [v0.8.0...v0.9.0](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.8.0...v0.9.0)
16
+
17
+ ### Features
18
+
19
+ * handle thread interrupts in the core HTTP client ([1148b44](https://github.com/brand-dot-dev/ruby-sdk/commit/1148b44345308fa59a566bc0257a330a5a90bf2e))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * absolutely qualified uris should always override the default ([c5d7b82](https://github.com/brand-dot-dev/ruby-sdk/commit/c5d7b820e8b615d3dc838680253491a505012103))
25
+ * should not reuse buffers for `IO.copy_stream` interop ([bd29b0a](https://github.com/brand-dot-dev/ruby-sdk/commit/bd29b0a85f00ce0cc2c95caba81f5b5e53dd1d9e))
26
+
27
+
28
+ ### Chores
29
+
30
+ * ignore linter error for tests having large collections ([3e192fb](https://github.com/brand-dot-dev/ruby-sdk/commit/3e192fb1c4ed321949bc73076da40577daae1279))
31
+
3
32
  ## 0.8.0 (2025-10-08)
4
33
 
5
34
  Full Changelog: [v0.7.0...v0.8.0](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.7.0...v0.8.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.8.0"
20
+ gem "brand.dev", "~> 0.10.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -128,40 +128,48 @@ module BrandDev
128
128
  url, deadline = request.fetch_values(:url, :deadline)
129
129
 
130
130
  req = nil
131
- eof = false
132
131
  finished = false
133
- closing = nil
134
132
 
135
133
  # rubocop:disable Metrics/BlockLength
136
134
  enum = Enumerator.new do |y|
137
135
  next if finished
138
136
 
139
137
  with_pool(url, deadline: deadline) do |conn|
140
- req, closing = self.class.build_request(request) do
141
- self.class.calibrate_socket_timeout(conn, deadline)
142
- end
143
-
144
- self.class.calibrate_socket_timeout(conn, deadline)
145
- unless conn.started?
146
- conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
147
- conn.start
148
- end
138
+ eof = false
139
+ closing = nil
140
+ ::Thread.handle_interrupt(Object => :never) do
141
+ ::Thread.handle_interrupt(Object => :immediate) do
142
+ req, closing = self.class.build_request(request) do
143
+ self.class.calibrate_socket_timeout(conn, deadline)
144
+ end
149
145
 
150
- self.class.calibrate_socket_timeout(conn, deadline)
151
- conn.request(req) do |rsp|
152
- y << [req, rsp]
153
- break if finished
154
-
155
- rsp.read_body do |bytes|
156
- y << bytes.force_encoding(Encoding::BINARY)
157
- break if finished
146
+ self.class.calibrate_socket_timeout(conn, deadline)
147
+ unless conn.started?
148
+ conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
149
+ conn.start
150
+ end
158
151
 
159
152
  self.class.calibrate_socket_timeout(conn, deadline)
153
+ conn.request(req) do |rsp|
154
+ y << [req, rsp]
155
+ break if finished
156
+
157
+ rsp.read_body do |bytes|
158
+ y << bytes.force_encoding(Encoding::BINARY)
159
+ break if finished
160
+
161
+ self.class.calibrate_socket_timeout(conn, deadline)
162
+ end
163
+ eof = true
164
+ end
165
+ end
166
+ ensure
167
+ begin
168
+ conn.finish if !eof && conn&.started?
169
+ ensure
170
+ closing&.call
160
171
  end
161
- eof = true
162
172
  end
163
- ensure
164
- conn.finish if !eof && conn&.started?
165
173
  end
166
174
  rescue Timeout::Error
167
175
  raise BrandDev::Errors::APITimeoutError.new(url: url, request: req)
@@ -174,8 +182,6 @@ module BrandDev
174
182
  body = BrandDev::Internal::Util.fused_enum(enum, external: true) do
175
183
  finished = true
176
184
  loop { enum.next }
177
- ensure
178
- closing&.call
179
185
  end
180
186
  [Integer(response.code), response, body]
181
187
  end
@@ -346,8 +346,9 @@ module BrandDev
346
346
  base_path, base_query = lhs.fetch_values(:path, :query)
347
347
  slashed = base_path.end_with?("/") ? base_path : "#{base_path}/"
348
348
 
349
- parsed_path, parsed_query = parse_uri(rhs.fetch(:path)).fetch_values(:path, :query)
350
- override = URI::Generic.build(**rhs.slice(:scheme, :host, :port), path: parsed_path)
349
+ merged = {**parse_uri(rhs.fetch(:path)), **rhs.except(:path, :query)}
350
+ parsed_path, parsed_query = merged.fetch_values(:path, :query)
351
+ override = URI::Generic.build(**merged.slice(:scheme, :host, :port), path: parsed_path)
351
352
 
352
353
  joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override)
353
354
  query = deep_merge(
@@ -473,10 +474,9 @@ module BrandDev
473
474
  # @return [Enumerable<String>]
474
475
  def writable_enum(&blk)
475
476
  Enumerator.new do |y|
476
- buf = String.new
477
477
  y.define_singleton_method(:write) do
478
- self << buf.replace(_1)
479
- buf.bytesize
478
+ self << _1.dup
479
+ _1.bytesize
480
480
  end
481
481
 
482
482
  blk.call(y)
@@ -13,6 +13,20 @@ module BrandDev
13
13
  # @return [String]
14
14
  required :transaction_info, String
15
15
 
16
+ # @!attribute force_language
17
+ # Optional parameter to force the language of the retrieved brand data.
18
+ #
19
+ # @return [Symbol, BrandDev::Models::BrandIdentifyFromTransactionParams::ForceLanguage, nil]
20
+ optional :force_language, enum: -> { BrandDev::BrandIdentifyFromTransactionParams::ForceLanguage }
21
+
22
+ # @!attribute max_speed
23
+ # Optional parameter to optimize the API call for maximum speed. When set to true,
24
+ # the API will skip time-consuming operations for faster response at the cost of
25
+ # less comprehensive data.
26
+ #
27
+ # @return [Boolean, nil]
28
+ optional :max_speed, BrandDev::Internal::Type::Boolean
29
+
16
30
  # @!attribute timeout_ms
17
31
  # Optional timeout in milliseconds for the request. If the request takes longer
18
32
  # than this value, it will be aborted with a 408 status code. Maximum allowed
@@ -21,15 +35,80 @@ module BrandDev
21
35
  # @return [Integer, nil]
22
36
  optional :timeout_ms, Integer
23
37
 
24
- # @!method initialize(transaction_info:, timeout_ms: nil, request_options: {})
38
+ # @!method initialize(transaction_info:, force_language: nil, max_speed: nil, timeout_ms: nil, request_options: {})
25
39
  # Some parameter documentations has been truncated, see
26
40
  # {BrandDev::Models::BrandIdentifyFromTransactionParams} for more details.
27
41
  #
28
42
  # @param transaction_info [String] Transaction information to identify the brand
29
43
  #
44
+ # @param force_language [Symbol, BrandDev::Models::BrandIdentifyFromTransactionParams::ForceLanguage] Optional parameter to force the language of the retrieved brand data.
45
+ #
46
+ # @param max_speed [Boolean] Optional parameter to optimize the API call for maximum speed. When set to true,
47
+ #
30
48
  # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
31
49
  #
32
50
  # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}]
51
+
52
+ # Optional parameter to force the language of the retrieved brand data.
53
+ module ForceLanguage
54
+ extend BrandDev::Internal::Type::Enum
55
+
56
+ ALBANIAN = :albanian
57
+ ARABIC = :arabic
58
+ AZERI = :azeri
59
+ BENGALI = :bengali
60
+ BULGARIAN = :bulgarian
61
+ CEBUANO = :cebuano
62
+ CROATIAN = :croatian
63
+ CZECH = :czech
64
+ DANISH = :danish
65
+ DUTCH = :dutch
66
+ ENGLISH = :english
67
+ ESTONIAN = :estonian
68
+ FARSI = :farsi
69
+ FINNISH = :finnish
70
+ FRENCH = :french
71
+ GERMAN = :german
72
+ HAUSA = :hausa
73
+ HAWAIIAN = :hawaiian
74
+ HINDI = :hindi
75
+ HUNGARIAN = :hungarian
76
+ ICELANDIC = :icelandic
77
+ INDONESIAN = :indonesian
78
+ ITALIAN = :italian
79
+ KAZAKH = :kazakh
80
+ KYRGYZ = :kyrgyz
81
+ LATIN = :latin
82
+ LATVIAN = :latvian
83
+ LITHUANIAN = :lithuanian
84
+ MACEDONIAN = :macedonian
85
+ MONGOLIAN = :mongolian
86
+ NEPALI = :nepali
87
+ NORWEGIAN = :norwegian
88
+ PASHTO = :pashto
89
+ PIDGIN = :pidgin
90
+ POLISH = :polish
91
+ PORTUGUESE = :portuguese
92
+ ROMANIAN = :romanian
93
+ RUSSIAN = :russian
94
+ SERBIAN = :serbian
95
+ SLOVAK = :slovak
96
+ SLOVENE = :slovene
97
+ SOMALI = :somali
98
+ SPANISH = :spanish
99
+ SWAHILI = :swahili
100
+ SWEDISH = :swedish
101
+ TAGALOG = :tagalog
102
+ TURKISH = :turkish
103
+ UKRAINIAN = :ukrainian
104
+ URDU = :urdu
105
+ UZBEK = :uzbek
106
+ VIETNAMESE = :vietnamese
107
+ WELSH = :welsh
108
+
109
+ # @!method self.values
110
+ # @return [Array<Symbol>]
111
+ end
33
112
  end
34
113
  end
35
114
  end
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrandDev
4
+ module Models
5
+ # @see BrandDev::Resources::Brand#retrieve_by_name
6
+ class BrandRetrieveByNameParams < BrandDev::Internal::Type::BaseModel
7
+ extend BrandDev::Internal::Type::RequestParameters::Converter
8
+ include BrandDev::Internal::Type::RequestParameters
9
+
10
+ # @!attribute name
11
+ # Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft
12
+ # Corporation'). Must be 3-30 characters.
13
+ #
14
+ # @return [String]
15
+ required :name, String
16
+
17
+ # @!attribute force_language
18
+ # Optional parameter to force the language of the retrieved brand data.
19
+ #
20
+ # @return [Symbol, BrandDev::Models::BrandRetrieveByNameParams::ForceLanguage, nil]
21
+ optional :force_language, enum: -> { BrandDev::BrandRetrieveByNameParams::ForceLanguage }
22
+
23
+ # @!attribute max_speed
24
+ # Optional parameter to optimize the API call for maximum speed. When set to true,
25
+ # the API will skip time-consuming operations for faster response at the cost of
26
+ # less comprehensive data.
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :max_speed, BrandDev::Internal::Type::Boolean
30
+
31
+ # @!attribute timeout_ms
32
+ # Optional timeout in milliseconds for the request. If the request takes longer
33
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
34
+ # value is 300000ms (5 minutes).
35
+ #
36
+ # @return [Integer, nil]
37
+ optional :timeout_ms, Integer
38
+
39
+ # @!method initialize(name:, force_language: nil, max_speed: nil, timeout_ms: nil, request_options: {})
40
+ # Some parameter documentations has been truncated, see
41
+ # {BrandDev::Models::BrandRetrieveByNameParams} for more details.
42
+ #
43
+ # @param name [String] Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporati
44
+ #
45
+ # @param force_language [Symbol, BrandDev::Models::BrandRetrieveByNameParams::ForceLanguage] Optional parameter to force the language of the retrieved brand data.
46
+ #
47
+ # @param max_speed [Boolean] Optional parameter to optimize the API call for maximum speed. When set to true,
48
+ #
49
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
50
+ #
51
+ # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}]
52
+
53
+ # Optional parameter to force the language of the retrieved brand data.
54
+ module ForceLanguage
55
+ extend BrandDev::Internal::Type::Enum
56
+
57
+ ALBANIAN = :albanian
58
+ ARABIC = :arabic
59
+ AZERI = :azeri
60
+ BENGALI = :bengali
61
+ BULGARIAN = :bulgarian
62
+ CEBUANO = :cebuano
63
+ CROATIAN = :croatian
64
+ CZECH = :czech
65
+ DANISH = :danish
66
+ DUTCH = :dutch
67
+ ENGLISH = :english
68
+ ESTONIAN = :estonian
69
+ FARSI = :farsi
70
+ FINNISH = :finnish
71
+ FRENCH = :french
72
+ GERMAN = :german
73
+ HAUSA = :hausa
74
+ HAWAIIAN = :hawaiian
75
+ HINDI = :hindi
76
+ HUNGARIAN = :hungarian
77
+ ICELANDIC = :icelandic
78
+ INDONESIAN = :indonesian
79
+ ITALIAN = :italian
80
+ KAZAKH = :kazakh
81
+ KYRGYZ = :kyrgyz
82
+ LATIN = :latin
83
+ LATVIAN = :latvian
84
+ LITHUANIAN = :lithuanian
85
+ MACEDONIAN = :macedonian
86
+ MONGOLIAN = :mongolian
87
+ NEPALI = :nepali
88
+ NORWEGIAN = :norwegian
89
+ PASHTO = :pashto
90
+ PIDGIN = :pidgin
91
+ POLISH = :polish
92
+ PORTUGUESE = :portuguese
93
+ ROMANIAN = :romanian
94
+ RUSSIAN = :russian
95
+ SERBIAN = :serbian
96
+ SLOVAK = :slovak
97
+ SLOVENE = :slovene
98
+ SOMALI = :somali
99
+ SPANISH = :spanish
100
+ SWAHILI = :swahili
101
+ SWEDISH = :swedish
102
+ TAGALOG = :tagalog
103
+ TURKISH = :turkish
104
+ UKRAINIAN = :ukrainian
105
+ URDU = :urdu
106
+ UZBEK = :uzbek
107
+ VIETNAMESE = :vietnamese
108
+ WELSH = :welsh
109
+
110
+ # @!method self.values
111
+ # @return [Array<Symbol>]
112
+ end
113
+ end
114
+ end
115
+ end