diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 86b0e83..cb9d254 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.21.0" + ".": "0.22.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 69f3e77..ef7f019 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-737dbedd830e2c989387e90a9bb5baa3915306ecfef2e46b09d02cb1879f043c.yml -openapi_spec_hash: 7bc21f4c6d5fd39c1a3b22626846ca87 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-73562e26b663cf10185b9e98966accf5f151c6d3cf99b5e060ce5a847045e383.yml +openapi_spec_hash: bf5994966b84f9dda998ad5059ff8318 config_hash: 6f10592c7d0c3bafefc1271472283217 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ed12bd..28bee12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 0.22.0 (2026-02-07) + +Full Changelog: [v0.21.0...v0.22.0](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.21.0...v0.22.0) + +### Features + +* **api:** api update ([f61453c](https://github.com/brand-dot-dev/ruby-sdk/commit/f61453cacff28784915b193547f730b8eb76cf92)) + + +### Bug Fixes + +* **client:** always add content-length to post body, even when empty ([6d12b11](https://github.com/brand-dot-dev/ruby-sdk/commit/6d12b114daabfd7ca3afc167a18adbe1fe347a36)) +* **client:** loosen json header parsing ([3739920](https://github.com/brand-dot-dev/ruby-sdk/commit/37399200e8e055ed11e83489cdf2674a2a9e6aa8)) + + +### Chores + +* **docs:** remove www prefix ([5b8d2c8](https://github.com/brand-dot-dev/ruby-sdk/commit/5b8d2c8b141d6bc47c5ac75aa640d620bfd3ada2)) + ## 0.21.0 (2026-02-02) Full Changelog: [v0.20.0...v0.21.0](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.20.0...v0.21.0) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b91a588..931427a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,13 +43,13 @@ If you’d like to use the repository from source, you can either install from g To install via git in your `Gemfile`: ```ruby -gem "brand.dev", git: "https://www.github.com/brand-dot-dev/ruby-sdk" +gem "brand.dev", git: "https://github.com/brand-dot-dev/ruby-sdk" ``` Alternatively, reference local copy of the repo: ```bash -$ git clone -- 'https://www.github.com/brand-dot-dev/ruby-sdk' '' +$ git clone -- 'https://github.com/brand-dot-dev/ruby-sdk' '' ``` ```ruby diff --git a/Gemfile.lock b/Gemfile.lock index 3f25a9c..61c4bb4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - brand.dev (0.21.0) + brand.dev (0.22.0) cgi connection_pool diff --git a/README.md b/README.md index 157ab3b..a610b5e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "brand.dev", "~> 0.21.0" +gem "brand.dev", "~> 0.22.0" ``` diff --git a/lib/brand_dev/internal/transport/pooled_net_requester.rb b/lib/brand_dev/internal/transport/pooled_net_requester.rb index 91f62cd..0edf660 100644 --- a/lib/brand_dev/internal/transport/pooled_net_requester.rb +++ b/lib/brand_dev/internal/transport/pooled_net_requester.rb @@ -75,7 +75,7 @@ def build_request(request, &blk) case body in nil - nil + req["content-length"] ||= 0 unless req["transfer-encoding"] in String req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"] req.body_stream = BrandDev::Internal::Util::ReadIOAdapter.new(body, &blk) diff --git a/lib/brand_dev/internal/util.rb b/lib/brand_dev/internal/util.rb index 1236458..d297fd3 100644 --- a/lib/brand_dev/internal/util.rb +++ b/lib/brand_dev/internal/util.rb @@ -485,7 +485,7 @@ def writable_enum(&blk) end # @type [Regexp] - JSON_CONTENT = %r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)} + JSON_CONTENT = %r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)} # @type [Regexp] JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)} diff --git a/lib/brand_dev/models/brand_ai_products_params.rb b/lib/brand_dev/models/brand_ai_products_params.rb index 8340e40..6aad592 100644 --- a/lib/brand_dev/models/brand_ai_products_params.rb +++ b/lib/brand_dev/models/brand_ai_products_params.rb @@ -7,11 +7,21 @@ class BrandAIProductsParams < BrandDev::Internal::Type::BaseModel extend BrandDev::Internal::Type::RequestParameters::Converter include BrandDev::Internal::Type::RequestParameters + # @!attribute direct_url + # A specific URL to use directly as the starting point for extraction without + # domain resolution. Useful when you want to extract products from a specific page + # rather than discovering the site's product pages automatically. Either 'domain' + # or 'directUrl' must be provided, but not both. + # + # @return [String, nil] + optional :direct_url, String, api_name: :directUrl + # @!attribute domain - # The domain name to analyze + # The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but + # not both. # - # @return [String] - required :domain, String + # @return [String, nil] + optional :domain, String # @!attribute max_products # Maximum number of products to extract. @@ -27,11 +37,13 @@ class BrandAIProductsParams < BrandDev::Internal::Type::BaseModel # @return [Integer, nil] optional :timeout_ms, Integer, api_name: :timeoutMS - # @!method initialize(domain:, max_products: nil, timeout_ms: nil, request_options: {}) + # @!method initialize(direct_url: nil, domain: nil, max_products: nil, timeout_ms: nil, request_options: {}) # Some parameter documentations has been truncated, see # {BrandDev::Models::BrandAIProductsParams} for more details. # - # @param domain [String] The domain name to analyze + # @param direct_url [String] A specific URL to use directly as the starting point for extraction without doma + # + # @param domain [String] The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but # # @param max_products [Integer] Maximum number of products to extract. # diff --git a/lib/brand_dev/resources/brand.rb b/lib/brand_dev/resources/brand.rb index de0cfb7..951aed2 100644 --- a/lib/brand_dev/resources/brand.rb +++ b/lib/brand_dev/resources/brand.rb @@ -42,9 +42,11 @@ def retrieve(params) # analyze the website and return a list of products with details such as name, # description, image, pricing, features, and more. # - # @overload ai_products(domain:, max_products: nil, timeout_ms: nil, request_options: {}) + # @overload ai_products(direct_url: nil, domain: nil, max_products: nil, timeout_ms: nil, request_options: {}) # - # @param domain [String] The domain name to analyze + # @param direct_url [String] A specific URL to use directly as the starting point for extraction without doma + # + # @param domain [String] The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but # # @param max_products [Integer] Maximum number of products to extract. # @@ -55,7 +57,7 @@ def retrieve(params) # @return [BrandDev::Models::BrandAIProductsResponse] # # @see BrandDev::Models::BrandAIProductsParams - def ai_products(params) + def ai_products(params = {}) parsed, options = BrandDev::BrandAIProductsParams.dump_request(params) @client.request( method: :post, diff --git a/lib/brand_dev/version.rb b/lib/brand_dev/version.rb index a03864e..99f29ec 100644 --- a/lib/brand_dev/version.rb +++ b/lib/brand_dev/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module BrandDev - VERSION = "0.21.0" + VERSION = "0.22.0" end diff --git a/rbi/brand_dev/internal/util.rbi b/rbi/brand_dev/internal/util.rbi index fd4fc56..9103e5d 100644 --- a/rbi/brand_dev/internal/util.rbi +++ b/rbi/brand_dev/internal/util.rbi @@ -296,7 +296,7 @@ module BrandDev end JSON_CONTENT = - T.let(%r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}, Regexp) + T.let(%r{^application/(?:[a-zA-Z0-9.-]+\+)?json(?!l)}, Regexp) JSONL_CONTENT = T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp) diff --git a/rbi/brand_dev/models/brand_ai_products_params.rbi b/rbi/brand_dev/models/brand_ai_products_params.rbi index 4ca1d78..1e0e1c9 100644 --- a/rbi/brand_dev/models/brand_ai_products_params.rbi +++ b/rbi/brand_dev/models/brand_ai_products_params.rbi @@ -11,9 +11,23 @@ module BrandDev T.any(BrandDev::BrandAIProductsParams, BrandDev::Internal::AnyHash) end - # The domain name to analyze - sig { returns(String) } - attr_accessor :domain + # A specific URL to use directly as the starting point for extraction without + # domain resolution. Useful when you want to extract products from a specific page + # rather than discovering the site's product pages automatically. Either 'domain' + # or 'directUrl' must be provided, but not both. + sig { returns(T.nilable(String)) } + attr_reader :direct_url + + sig { params(direct_url: String).void } + attr_writer :direct_url + + # The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but + # not both. + sig { returns(T.nilable(String)) } + attr_reader :domain + + sig { params(domain: String).void } + attr_writer :domain # Maximum number of products to extract. sig { returns(T.nilable(Integer)) } @@ -33,6 +47,7 @@ module BrandDev sig do params( + direct_url: String, domain: String, max_products: Integer, timeout_ms: Integer, @@ -40,8 +55,14 @@ module BrandDev ).returns(T.attached_class) end def self.new( - # The domain name to analyze - domain:, + # A specific URL to use directly as the starting point for extraction without + # domain resolution. Useful when you want to extract products from a specific page + # rather than discovering the site's product pages automatically. Either 'domain' + # or 'directUrl' must be provided, but not both. + direct_url: nil, + # The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but + # not both. + domain: nil, # Maximum number of products to extract. max_products: nil, # Optional timeout in milliseconds for the request. If the request takes longer @@ -55,6 +76,7 @@ module BrandDev sig do override.returns( { + direct_url: String, domain: String, max_products: Integer, timeout_ms: Integer, diff --git a/rbi/brand_dev/resources/brand.rbi b/rbi/brand_dev/resources/brand.rbi index c4d9a97..395da65 100644 --- a/rbi/brand_dev/resources/brand.rbi +++ b/rbi/brand_dev/resources/brand.rbi @@ -39,6 +39,7 @@ module BrandDev # description, image, pricing, features, and more. sig do params( + direct_url: String, domain: String, max_products: Integer, timeout_ms: Integer, @@ -46,8 +47,14 @@ module BrandDev ).returns(BrandDev::Models::BrandAIProductsResponse) end def ai_products( - # The domain name to analyze - domain:, + # A specific URL to use directly as the starting point for extraction without + # domain resolution. Useful when you want to extract products from a specific page + # rather than discovering the site's product pages automatically. Either 'domain' + # or 'directUrl' must be provided, but not both. + direct_url: nil, + # The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but + # not both. + domain: nil, # Maximum number of products to extract. max_products: nil, # Optional timeout in milliseconds for the request. If the request takes longer diff --git a/sig/brand_dev/models/brand_ai_products_params.rbs b/sig/brand_dev/models/brand_ai_products_params.rbs index 8739bcd..a6d8ea6 100644 --- a/sig/brand_dev/models/brand_ai_products_params.rbs +++ b/sig/brand_dev/models/brand_ai_products_params.rbs @@ -1,14 +1,25 @@ module BrandDev module Models type brand_ai_products_params = - { domain: String, max_products: Integer, timeout_ms: Integer } + { + direct_url: String, + domain: String, + max_products: Integer, + timeout_ms: Integer + } & BrandDev::Internal::Type::request_parameters class BrandAIProductsParams < BrandDev::Internal::Type::BaseModel extend BrandDev::Internal::Type::RequestParameters::Converter include BrandDev::Internal::Type::RequestParameters - attr_accessor domain: String + attr_reader direct_url: String? + + def direct_url=: (String) -> String + + attr_reader domain: String? + + def domain=: (String) -> String attr_reader max_products: Integer? @@ -19,13 +30,15 @@ module BrandDev def timeout_ms=: (Integer) -> Integer def initialize: ( - domain: String, + ?direct_url: String, + ?domain: String, ?max_products: Integer, ?timeout_ms: Integer, ?request_options: BrandDev::request_opts ) -> void def to_hash: -> { + direct_url: String, domain: String, max_products: Integer, timeout_ms: Integer, diff --git a/sig/brand_dev/resources/brand.rbs b/sig/brand_dev/resources/brand.rbs index 3ac72e7..d065cbb 100644 --- a/sig/brand_dev/resources/brand.rbs +++ b/sig/brand_dev/resources/brand.rbs @@ -10,7 +10,8 @@ module BrandDev ) -> BrandDev::Models::BrandRetrieveResponse def ai_products: ( - domain: String, + ?direct_url: String, + ?domain: String, ?max_products: Integer, ?timeout_ms: Integer, ?request_options: BrandDev::request_opts diff --git a/test/brand_dev/internal/util_test.rb b/test/brand_dev/internal/util_test.rb index 34423c1..fd21458 100644 --- a/test/brand_dev/internal/util_test.rb +++ b/test/brand_dev/internal/util_test.rb @@ -171,6 +171,8 @@ def test_json_content cases = { "application/json" => true, "application/jsonl" => false, + "application/arbitrary+json" => true, + "application/ARBITRARY+json" => true, "application/vnd.github.v3+json" => true, "application/vnd.api+json" => true } diff --git a/test/brand_dev/resources/brand_test.rb b/test/brand_dev/resources/brand_test.rb index 22afe6e..d79c82a 100644 --- a/test/brand_dev/resources/brand_test.rb +++ b/test/brand_dev/resources/brand_test.rb @@ -21,10 +21,10 @@ def test_retrieve_required_params end end - def test_ai_products_required_params + def test_ai_products skip("Prism tests are disabled") - response = @brand_dev.brand.ai_products(domain: "domain") + response = @brand_dev.brand.ai_products assert_pattern do response => BrandDev::Models::BrandAIProductsResponse