brand.dev 0.0.1.pre.alpha.0 → 0.1.0.pre.alpha.2

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: 308ab90d3e6f03ff0fb725a2aece6d8c14bb16ff54ed00fab2fee5ad217a72fe
4
- data.tar.gz: 92c6e324a4885ac710359c9556dad60e904d8630a25510c79c122de0d436f420
3
+ metadata.gz: a94f139a55d3e88238d913a185093f41026e151b9fd968eb8f249f19ddb54202
4
+ data.tar.gz: 5387c49ab7a97f07f29ff7c937bba1a49377d3555b98299c61fafe22f2d862d7
5
5
  SHA512:
6
- metadata.gz: 9d454dbf45c518f184acb12ec4f9f418add64888c748939005d7a88df98affd9f4935cc5346088aca69041fd18096d6d92d8f4c69b8dbcc537278050c4358e19
7
- data.tar.gz: 9aa4d6101d29030416e70f1ded7cd38550c582baf2822b5face0f3706718c7989ac27d964f7bd9f08ab55fffdb3e4c5ef7f369fd7ecfea5e409fcc67a991ef49
6
+ metadata.gz: 7b44cbd8f70815be419af79dfdf414647e5b274e27fa7f8feb01e0671e22b51299728af2867400360adf711c3a756b05a30f1272b9fedc28ab357ba6bf6c0e6b
7
+ data.tar.gz: 5b2565644ee946cd873a26afeaa9ec5698d360c39677d90d9c6289883be3b0a90f6df1fac6558292798d83877b03f3b3248d309d2137b47223f67a9782781a28
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0-alpha.2 (2025-06-05)
4
+
5
+ Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([6613bcd](https://github.com/brand-dot-dev/ruby-sdk/commit/6613bcdddf846a0dbcb1e507da7ec58c93e4125d))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * `to_sorbet_type` should not return branded types ([0047f7c](https://github.com/brand-dot-dev/ruby-sdk/commit/0047f7ce754514e6c5ac04546aa262d1e4df68f5))
15
+ * default content-type for text in multi-part formdata uploads should be text/plain ([c39a8a7](https://github.com/brand-dot-dev/ruby-sdk/commit/c39a8a78f5445fa88de3b9f765d6211889ba78ef))
16
+
17
+ ## 0.1.0-alpha.1 (2025-06-02)
18
+
19
+ Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/brand-dot-dev/ruby-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
20
+
21
+ ### Features
22
+
23
+ * **api:** manual updates ([1c2a095](https://github.com/brand-dot-dev/ruby-sdk/commit/1c2a09538494964e67752f572ed11a41f4bf4e29))
24
+
25
+
26
+ ### Chores
27
+
28
+ * configure new SDK language ([4b2d19e](https://github.com/brand-dot-dev/ruby-sdk/commit/4b2d19e3ea9342c01529655c0231e1258c04de35))
29
+ * sync repo ([fc86136](https://github.com/brand-dot-dev/ruby-sdk/commit/fc86136bdab0b1c30529662a3dedb8016726d8bc))
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Brand Dev Ruby API library
2
2
 
3
- The Brand Dev Ruby library provides convenient access to the Brand Dev REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/stainless-sdks/brand.dev-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
3
+ The Brand Dev Ruby library provides convenient access to the Brand Dev REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/brand-dot-dev/ruby-sdk#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
4
4
 
5
5
  It is generated with [Stainless](https://www.stainless.com/).
6
6
 
@@ -12,10 +12,14 @@ Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs
12
12
 
13
13
  To use this gem, install via Bundler by adding the following to your application's `Gemfile`:
14
14
 
15
+ <!-- x-release-please-start-version -->
16
+
15
17
  ```ruby
16
- gem "brand.dev", "~> 0.0.1.pre.alpha.0"
18
+ gem "brand.dev", "~> 0.1.0.pre.alpha.2"
17
19
  ```
18
20
 
21
+ <!-- x-release-please-end -->
22
+
19
23
  ## Usage
20
24
 
21
25
  ```ruby
@@ -226,4 +230,4 @@ Ruby 3.2.0 or higher.
226
230
 
227
231
  ## Contributing
228
232
 
229
- See [the contributing documentation](https://github.com/stainless-sdks/brand.dev-ruby/tree/main/CONTRIBUTING.md).
233
+ See [the contributing documentation](https://github.com/brand-dot-dev/ruby-sdk/tree/main/CONTRIBUTING.md).
@@ -91,11 +91,14 @@ module BrandDev
91
91
  #
92
92
  # @return [Object]
93
93
  def to_sorbet_type
94
- case values
94
+ types = values.map { BrandDev::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq
95
+ case types
95
96
  in []
96
97
  T.noreturn
97
- in [value, *_]
98
- T.all(BrandDev::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(value), self)
98
+ in [type]
99
+ type
100
+ else
101
+ T.any(*types)
99
102
  end
100
103
  end
101
104
 
@@ -195,11 +195,14 @@ module BrandDev
195
195
  #
196
196
  # @return [Object]
197
197
  def to_sorbet_type
198
- case (v = variants)
198
+ types = variants.map { BrandDev::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq
199
+ case types
199
200
  in []
200
201
  T.noreturn
202
+ in [type]
203
+ type
201
204
  else
202
- T.any(*v.map { BrandDev::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) })
205
+ T.any(*types)
203
206
  end
204
207
  end
205
208
 
@@ -497,7 +497,7 @@ module BrandDev
497
497
  # @param closing [Array<Proc>]
498
498
  # @param content_type [String, nil]
499
499
  private def write_multipart_content(y, val:, closing:, content_type: nil)
500
- content_type ||= "application/octet-stream"
500
+ content_line = "Content-Type: %s\r\n\r\n"
501
501
 
502
502
  case val
503
503
  in BrandDev::FilePart
@@ -508,24 +508,21 @@ module BrandDev
508
508
  content_type: val.content_type
509
509
  )
510
510
  in Pathname
511
- y << "Content-Type: #{content_type}\r\n\r\n"
511
+ y << format(content_line, content_type || "application/octet-stream")
512
512
  io = val.open(binmode: true)
513
513
  closing << io.method(:close)
514
514
  IO.copy_stream(io, y)
515
515
  in IO
516
- y << "Content-Type: #{content_type}\r\n\r\n"
516
+ y << format(content_line, content_type || "application/octet-stream")
517
517
  IO.copy_stream(val, y)
518
518
  in StringIO
519
- y << "Content-Type: #{content_type}\r\n\r\n"
519
+ y << format(content_line, content_type || "application/octet-stream")
520
520
  y << val.string
521
- in String
522
- y << "Content-Type: #{content_type}\r\n\r\n"
523
- y << val.to_s
524
521
  in -> { primitive?(_1) }
525
- y << "Content-Type: text/plain\r\n\r\n"
522
+ y << format(content_line, content_type || "text/plain")
526
523
  y << val.to_s
527
524
  else
528
- y << "Content-Type: application/json\r\n\r\n"
525
+ y << format(content_line, content_type || "application/json")
529
526
  y << JSON.generate(val)
530
527
  end
531
528
  y << "\r\n"
@@ -563,6 +560,8 @@ module BrandDev
563
560
 
564
561
  # @api private
565
562
  #
563
+ # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content
564
+ #
566
565
  # @param body [Object]
567
566
  #
568
567
  # @return [Array(String, Enumerable<String>)]
@@ -0,0 +1,160 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrandDev
4
+ module Models
5
+ # @see BrandDev::Resources::Brand#ai_query
6
+ class BrandAIQueryParams < BrandDev::Internal::Type::BaseModel
7
+ extend BrandDev::Internal::Type::RequestParameters::Converter
8
+ include BrandDev::Internal::Type::RequestParameters
9
+
10
+ # @!attribute data_to_extract
11
+ # Array of data points to extract from the website
12
+ #
13
+ # @return [Array<BrandDev::Models::BrandAIQueryParams::DataToExtract>]
14
+ required :data_to_extract,
15
+ -> { BrandDev::Internal::Type::ArrayOf[BrandDev::BrandAIQueryParams::DataToExtract] }
16
+
17
+ # @!attribute domain
18
+ # The domain name to analyze
19
+ #
20
+ # @return [String]
21
+ required :domain, String
22
+
23
+ # @!attribute specific_pages
24
+ # Optional object specifying which pages to analyze
25
+ #
26
+ # @return [BrandDev::Models::BrandAIQueryParams::SpecificPages, nil]
27
+ optional :specific_pages, -> { BrandDev::BrandAIQueryParams::SpecificPages }
28
+
29
+ # @!method initialize(data_to_extract:, domain:, specific_pages: nil, request_options: {})
30
+ # @param data_to_extract [Array<BrandDev::Models::BrandAIQueryParams::DataToExtract>] Array of data points to extract from the website
31
+ #
32
+ # @param domain [String] The domain name to analyze
33
+ #
34
+ # @param specific_pages [BrandDev::Models::BrandAIQueryParams::SpecificPages] Optional object specifying which pages to analyze
35
+ #
36
+ # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}]
37
+
38
+ class DataToExtract < BrandDev::Internal::Type::BaseModel
39
+ # @!attribute datapoint_description
40
+ # Description of what to extract
41
+ #
42
+ # @return [String]
43
+ required :datapoint_description, String
44
+
45
+ # @!attribute datapoint_example
46
+ # Example of the expected value
47
+ #
48
+ # @return [String]
49
+ required :datapoint_example, String
50
+
51
+ # @!attribute datapoint_name
52
+ # Name of the data point to extract
53
+ #
54
+ # @return [String]
55
+ required :datapoint_name, String
56
+
57
+ # @!attribute datapoint_type
58
+ # Type of the data point
59
+ #
60
+ # @return [Symbol, BrandDev::Models::BrandAIQueryParams::DataToExtract::DatapointType]
61
+ required :datapoint_type, enum: -> { BrandDev::BrandAIQueryParams::DataToExtract::DatapointType }
62
+
63
+ # @!method initialize(datapoint_description:, datapoint_example:, datapoint_name:, datapoint_type:)
64
+ # @param datapoint_description [String] Description of what to extract
65
+ #
66
+ # @param datapoint_example [String] Example of the expected value
67
+ #
68
+ # @param datapoint_name [String] Name of the data point to extract
69
+ #
70
+ # @param datapoint_type [Symbol, BrandDev::Models::BrandAIQueryParams::DataToExtract::DatapointType] Type of the data point
71
+
72
+ # Type of the data point
73
+ #
74
+ # @see BrandDev::Models::BrandAIQueryParams::DataToExtract#datapoint_type
75
+ module DatapointType
76
+ extend BrandDev::Internal::Type::Enum
77
+
78
+ TEXT = :text
79
+ NUMBER = :number
80
+ DATE = :date
81
+ BOOLEAN = :boolean
82
+ LIST = :list
83
+ URL = :url
84
+
85
+ # @!method self.values
86
+ # @return [Array<Symbol>]
87
+ end
88
+ end
89
+
90
+ class SpecificPages < BrandDev::Internal::Type::BaseModel
91
+ # @!attribute about_us
92
+ # Whether to analyze the about us page
93
+ #
94
+ # @return [Boolean, nil]
95
+ optional :about_us, BrandDev::Internal::Type::Boolean
96
+
97
+ # @!attribute blog
98
+ # Whether to analyze the blog
99
+ #
100
+ # @return [Boolean, nil]
101
+ optional :blog, BrandDev::Internal::Type::Boolean
102
+
103
+ # @!attribute careers
104
+ # Whether to analyze the careers page
105
+ #
106
+ # @return [Boolean, nil]
107
+ optional :careers, BrandDev::Internal::Type::Boolean
108
+
109
+ # @!attribute contact_us
110
+ # Whether to analyze the contact us page
111
+ #
112
+ # @return [Boolean, nil]
113
+ optional :contact_us, BrandDev::Internal::Type::Boolean
114
+
115
+ # @!attribute faq
116
+ # Whether to analyze the FAQ page
117
+ #
118
+ # @return [Boolean, nil]
119
+ optional :faq, BrandDev::Internal::Type::Boolean
120
+
121
+ # @!attribute home_page
122
+ # Whether to analyze the home page
123
+ #
124
+ # @return [Boolean, nil]
125
+ optional :home_page, BrandDev::Internal::Type::Boolean
126
+
127
+ # @!attribute privacy_policy
128
+ # Whether to analyze the privacy policy page
129
+ #
130
+ # @return [Boolean, nil]
131
+ optional :privacy_policy, BrandDev::Internal::Type::Boolean
132
+
133
+ # @!attribute terms_and_conditions
134
+ # Whether to analyze the terms and conditions page
135
+ #
136
+ # @return [Boolean, nil]
137
+ optional :terms_and_conditions, BrandDev::Internal::Type::Boolean
138
+
139
+ # @!method initialize(about_us: nil, blog: nil, careers: nil, contact_us: nil, faq: nil, home_page: nil, privacy_policy: nil, terms_and_conditions: nil)
140
+ # Optional object specifying which pages to analyze
141
+ #
142
+ # @param about_us [Boolean] Whether to analyze the about us page
143
+ #
144
+ # @param blog [Boolean] Whether to analyze the blog
145
+ #
146
+ # @param careers [Boolean] Whether to analyze the careers page
147
+ #
148
+ # @param contact_us [Boolean] Whether to analyze the contact us page
149
+ #
150
+ # @param faq [Boolean] Whether to analyze the FAQ page
151
+ #
152
+ # @param home_page [Boolean] Whether to analyze the home page
153
+ #
154
+ # @param privacy_policy [Boolean] Whether to analyze the privacy policy page
155
+ #
156
+ # @param terms_and_conditions [Boolean] Whether to analyze the terms and conditions page
157
+ end
158
+ end
159
+ end
160
+ end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrandDev
4
+ module Models
5
+ # @see BrandDev::Resources::Brand#ai_query
6
+ class BrandAIQueryResponse < BrandDev::Internal::Type::BaseModel
7
+ # @!attribute data_extracted
8
+ # Array of extracted data points
9
+ #
10
+ # @return [Array<BrandDev::Models::BrandAIQueryResponse::DataExtracted>, nil]
11
+ optional :data_extracted,
12
+ -> { BrandDev::Internal::Type::ArrayOf[BrandDev::Models::BrandAIQueryResponse::DataExtracted] }
13
+
14
+ # @!attribute domain
15
+ # The domain that was analyzed
16
+ #
17
+ # @return [String, nil]
18
+ optional :domain, String
19
+
20
+ # @!attribute urls_analyzed
21
+ # List of URLs that were analyzed
22
+ #
23
+ # @return [Array<String>, nil]
24
+ optional :urls_analyzed, BrandDev::Internal::Type::ArrayOf[String]
25
+
26
+ # @!method initialize(data_extracted: nil, domain: nil, urls_analyzed: nil)
27
+ # @param data_extracted [Array<BrandDev::Models::BrandAIQueryResponse::DataExtracted>] Array of extracted data points
28
+ #
29
+ # @param domain [String] The domain that was analyzed
30
+ #
31
+ # @param urls_analyzed [Array<String>] List of URLs that were analyzed
32
+
33
+ class DataExtracted < BrandDev::Internal::Type::BaseModel
34
+ # @!attribute datapoint_name
35
+ # Name of the extracted data point
36
+ #
37
+ # @return [String, nil]
38
+ optional :datapoint_name, String
39
+
40
+ # @!attribute datapoint_value
41
+ # Value of the extracted data point
42
+ #
43
+ # @return [String, Float, Boolean, Array<String>, Array<Float>, nil]
44
+ optional :datapoint_value,
45
+ union: -> { BrandDev::Models::BrandAIQueryResponse::DataExtracted::DatapointValue }
46
+
47
+ # @!method initialize(datapoint_name: nil, datapoint_value: nil)
48
+ # @param datapoint_name [String] Name of the extracted data point
49
+ #
50
+ # @param datapoint_value [String, Float, Boolean, Array<String>, Array<Float>] Value of the extracted data point
51
+
52
+ # Value of the extracted data point
53
+ #
54
+ # @see BrandDev::Models::BrandAIQueryResponse::DataExtracted#datapoint_value
55
+ module DatapointValue
56
+ extend BrandDev::Internal::Type::Union
57
+
58
+ variant String
59
+
60
+ variant Float
61
+
62
+ variant BrandDev::Internal::Type::Boolean
63
+
64
+ variant -> { BrandDev::Models::BrandAIQueryResponse::DataExtracted::DatapointValue::StringArray }
65
+
66
+ variant -> { BrandDev::Models::BrandAIQueryResponse::DataExtracted::DatapointValue::FloatArray }
67
+
68
+ # @!method self.variants
69
+ # @return [Array(String, Float, Boolean, Array<String>, Array<Float>)]
70
+
71
+ # @type [BrandDev::Internal::Type::Converter]
72
+ StringArray = BrandDev::Internal::Type::ArrayOf[String]
73
+
74
+ # @type [BrandDev::Internal::Type::Converter]
75
+ FloatArray = BrandDev::Internal::Type::ArrayOf[Float]
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -11,16 +11,16 @@ module BrandDev
11
11
  mod.constants.each do |name|
12
12
  case mod.const_get(name)
13
13
  in true | false
14
- mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, mod) } }
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
15
15
  mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
16
16
  in Integer
17
- mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, mod) } }
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
18
18
  mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
19
  in Float
20
- mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, mod) } }
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
21
21
  mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
22
  in Symbol
23
- mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, mod) } }
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
24
24
  mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
25
  else
26
26
  end
@@ -39,6 +39,8 @@ module BrandDev
39
39
  mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
40
40
  end
41
41
 
42
+ BrandAIQueryParams = BrandDev::Models::BrandAIQueryParams
43
+
42
44
  BrandIdentifyFromTransactionParams = BrandDev::Models::BrandIdentifyFromTransactionParams
43
45
 
44
46
  BrandRetrieveByTickerParams = BrandDev::Models::BrandRetrieveByTickerParams
@@ -27,6 +27,34 @@ module BrandDev
27
27
  )
28
28
  end
29
29
 
30
+ # Beta feature: Use AI to extract specific data points from a brand's website. The
31
+ # AI will crawl the website and extract the requested information based on the
32
+ # provided data points.
33
+ #
34
+ # @overload ai_query(data_to_extract:, domain:, specific_pages: nil, request_options: {})
35
+ #
36
+ # @param data_to_extract [Array<BrandDev::Models::BrandAIQueryParams::DataToExtract>] Array of data points to extract from the website
37
+ #
38
+ # @param domain [String] The domain name to analyze
39
+ #
40
+ # @param specific_pages [BrandDev::Models::BrandAIQueryParams::SpecificPages] Optional object specifying which pages to analyze
41
+ #
42
+ # @param request_options [BrandDev::RequestOptions, Hash{Symbol=>Object}, nil]
43
+ #
44
+ # @return [BrandDev::Models::BrandAIQueryResponse]
45
+ #
46
+ # @see BrandDev::Models::BrandAIQueryParams
47
+ def ai_query(params)
48
+ parsed, options = BrandDev::BrandAIQueryParams.dump_request(params)
49
+ @client.request(
50
+ method: :post,
51
+ path: "brand/ai/query",
52
+ body: parsed,
53
+ model: BrandDev::Models::BrandAIQueryResponse,
54
+ options: options
55
+ )
56
+ end
57
+
30
58
  # Endpoint specially designed for platforms that want to identify transaction data
31
59
  # by the transaction title.
32
60
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BrandDev
4
- VERSION = "0.0.1.pre.alpha.0"
4
+ VERSION = "0.1.0.pre.alpha.2"
5
5
  end
data/lib/brand_dev.rb CHANGED
@@ -50,6 +50,8 @@ require_relative "brand_dev/errors"
50
50
  require_relative "brand_dev/internal/transport/base_client"
51
51
  require_relative "brand_dev/internal/transport/pooled_net_requester"
52
52
  require_relative "brand_dev/client"
53
+ require_relative "brand_dev/models/brand_ai_query_params"
54
+ require_relative "brand_dev/models/brand_ai_query_response"
53
55
  require_relative "brand_dev/models/brand_identify_from_transaction_params"
54
56
  require_relative "brand_dev/models/brand_identify_from_transaction_response"
55
57
  require_relative "brand_dev/models/brand_retrieve_by_ticker_params"
@@ -332,6 +332,8 @@ module BrandDev
332
332
  end
333
333
 
334
334
  # @api private
335
+ #
336
+ # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content
335
337
  sig do
336
338
  params(body: T.anything).returns([String, T::Enumerable[String]])
337
339
  end