diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c523ce19..c3c95522 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.0" + ".": "1.9.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c7218284..6d33ce61 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 21 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-18bb184b75673248917773c4c074813ca4bd966458b2f039b937df63209c029d.yml -openapi_spec_hash: ef79dd2063dd500127748ee843f5e783 -config_hash: 7d13dca2b2c6f71fc463cb6062efa5ea +configured_endpoints: 22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-a831ece9950c336fba69327e01aed391a08418e1898f4aff27a800471f139cc7.yml +openapi_spec_hash: 459258410b739536cdc75b91e8b4eac7 +config_hash: 70354330f92ce169beabc98696ebb9a3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f150a82..c3c32c4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.9.0 (2026-04-25) + +Full Changelog: [v1.8.0...v1.9.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.8.0...v1.9.0) + +### Features + +* **api:** manual updates ([e1f12de](https://github.com/context-dot-dev/context-ruby-sdk/commit/e1f12de44bcadd047b5746fdddcd828a29107e1e)) + ## 1.8.0 (2026-04-24) Full Changelog: [v1.7.0...v1.8.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.7.0...v1.8.0) diff --git a/Gemfile.lock b/Gemfile.lock index c3a1d4a8..39d83909 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - context.dev (1.8.0) + context.dev (1.9.0) cgi connection_pool diff --git a/README.md b/README.md index 914f01b2..55c45cee 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 "context.dev", "~> 1.8.0" +gem "context.dev", "~> 1.9.0" ``` diff --git a/lib/context_dev.rb b/lib/context_dev.rb index 6d616a84..16cc022c 100644 --- a/lib/context_dev.rb +++ b/lib/context_dev.rb @@ -74,6 +74,8 @@ require_relative "context_dev/models/brand_retrieve_simplified_response" require_relative "context_dev/models/industry_retrieve_naics_params" require_relative "context_dev/models/industry_retrieve_naics_response" +require_relative "context_dev/models/industry_retrieve_sic_params" +require_relative "context_dev/models/industry_retrieve_sic_response" require_relative "context_dev/models/utility_prefetch_by_email_params" require_relative "context_dev/models/utility_prefetch_by_email_response" require_relative "context_dev/models/utility_prefetch_params" diff --git a/lib/context_dev/models.rb b/lib/context_dev/models.rb index 9049afe5..c8578560 100644 --- a/lib/context_dev/models.rb +++ b/lib/context_dev/models.rb @@ -61,6 +61,8 @@ module ContextDev IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams + IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams + UtilityPrefetchByEmailParams = ContextDev::Models::UtilityPrefetchByEmailParams UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams diff --git a/lib/context_dev/models/industry_retrieve_sic_params.rb b/lib/context_dev/models/industry_retrieve_sic_params.rb new file mode 100644 index 00000000..0ea2f18f --- /dev/null +++ b/lib/context_dev/models/industry_retrieve_sic_params.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Industry#retrieve_sic + class IndustryRetrieveSicParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + # @!attribute input + # Brand domain or title to retrieve SIC code for. If a valid domain is provided, + # it will be used for classification, otherwise, we will search for the brand + # using the provided title. + # + # @return [String] + required :input, String + + # @!attribute max_results + # Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + # + # @return [Integer, nil] + optional :max_results, Integer + + # @!attribute min_results + # Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + # + # @return [Integer, nil] + optional :min_results, Integer + + # @!attribute timeout_ms + # Optional timeout in milliseconds for the request. If the request takes longer + # than this value, it will be aborted with a 408 status code. Maximum allowed + # value is 300000ms (5 minutes). + # + # @return [Integer, nil] + optional :timeout_ms, Integer + + # @!attribute type + # Which SIC dataset to classify against. `original_sic` uses the 1987 Standard + # Industrial Classification system; `latest_sec` uses the current SIC list as + # published by the SEC. Defaults to `original_sic`. + # + # @return [Symbol, ContextDev::Models::IndustryRetrieveSicParams::Type, nil] + optional :type, enum: -> { ContextDev::IndustryRetrieveSicParams::Type } + + # @!method initialize(input:, max_results: nil, min_results: nil, timeout_ms: nil, type: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::IndustryRetrieveSicParams} for more details. + # + # @param input [String] Brand domain or title to retrieve SIC code for. If a valid domain is provided, i + # + # @param max_results [Integer] Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + # + # @param min_results [Integer] Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param type [Symbol, ContextDev::Models::IndustryRetrieveSicParams::Type] Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Ind + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}] + + # Which SIC dataset to classify against. `original_sic` uses the 1987 Standard + # Industrial Classification system; `latest_sec` uses the current SIC list as + # published by the SEC. Defaults to `original_sic`. + module Type + extend ContextDev::Internal::Type::Enum + + ORIGINAL_SIC = :original_sic + LATEST_SEC = :latest_sec + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/context_dev/models/industry_retrieve_sic_response.rb b/lib/context_dev/models/industry_retrieve_sic_response.rb new file mode 100644 index 00000000..e7051bb4 --- /dev/null +++ b/lib/context_dev/models/industry_retrieve_sic_response.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +module ContextDev + module Models + # @see ContextDev::Resources::Industry#retrieve_sic + class IndustryRetrieveSicResponse < ContextDev::Internal::Type::BaseModel + # @!attribute classification + # Echoes back which SIC dataset was used to classify the brand. + # + # @return [Symbol, ContextDev::Models::IndustryRetrieveSicResponse::Classification, nil] + optional :classification, enum: -> { ContextDev::Models::IndustryRetrieveSicResponse::Classification } + + # @!attribute codes + # Array of SIC codes with confidence scores. Extra fields depend on the requested + # classification: `original_sic` results include `majorGroup` and + # `majorGroupName`; `latest_sec` results include `office`. + # + # @return [Array, nil] + optional :codes, + -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::IndustryRetrieveSicResponse::Code] } + + # @!attribute domain + # Domain found for the brand + # + # @return [String, nil] + optional :domain, String + + # @!attribute status + # Status of the response, e.g., 'ok' + # + # @return [String, nil] + optional :status, String + + # @!attribute type + # Industry classification type, for sic api it will be `sic` + # + # @return [String, nil] + optional :type, String + + # @!method initialize(classification: nil, codes: nil, domain: nil, status: nil, type: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::IndustryRetrieveSicResponse} for more details. + # + # @param classification [Symbol, ContextDev::Models::IndustryRetrieveSicResponse::Classification] Echoes back which SIC dataset was used to classify the brand. + # + # @param codes [Array] Array of SIC codes with confidence scores. Extra fields depend on the requested + # + # @param domain [String] Domain found for the brand + # + # @param status [String] Status of the response, e.g., 'ok' + # + # @param type [String] Industry classification type, for sic api it will be `sic` + + # Echoes back which SIC dataset was used to classify the brand. + # + # @see ContextDev::Models::IndustryRetrieveSicResponse#classification + module Classification + extend ContextDev::Internal::Type::Enum + + ORIGINAL_SIC = :original_sic + LATEST_SEC = :latest_sec + + # @!method self.values + # @return [Array] + end + + class Code < ContextDev::Internal::Type::BaseModel + # @!attribute code + # SIC code (4-digit). + # + # @return [String] + required :code, String + + # @!attribute confidence + # Confidence level for how well this SIC code matches the company description. + # + # @return [Symbol, ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence] + required :confidence, enum: -> { ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence } + + # @!attribute name + # SIC industry title. + # + # @return [String] + required :name, String + + # @!attribute major_group + # 2-digit major group identifier (the leading two digits of the code). Only + # present when `classification` is `original_sic`. + # + # @return [String, nil] + optional :major_group, String, api_name: :majorGroup + + # @!attribute major_group_name + # Description of the 2-digit major group. Only present when `classification` is + # `original_sic`. + # + # @return [String, nil] + optional :major_group_name, String, api_name: :majorGroupName + + # @!attribute office + # SEC review office responsible for filings under this code. Only present when + # `classification` is `latest_sec`. + # + # @return [String, nil] + optional :office, String + + # @!method initialize(code:, confidence:, name:, major_group: nil, major_group_name: nil, office: nil) + # Some parameter documentations has been truncated, see + # {ContextDev::Models::IndustryRetrieveSicResponse::Code} for more details. + # + # @param code [String] SIC code (4-digit). + # + # @param confidence [Symbol, ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence] Confidence level for how well this SIC code matches the company description. + # + # @param name [String] SIC industry title. + # + # @param major_group [String] 2-digit major group identifier (the leading two digits of the code). Only presen + # + # @param major_group_name [String] Description of the 2-digit major group. Only present when `classification` is `o + # + # @param office [String] SEC review office responsible for filings under this code. Only present when `cl + + # Confidence level for how well this SIC code matches the company description. + # + # @see ContextDev::Models::IndustryRetrieveSicResponse::Code#confidence + module Confidence + extend ContextDev::Internal::Type::Enum + + HIGH = :high + MEDIUM = :medium + LOW = :low + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/context_dev/resources/industry.rb b/lib/context_dev/resources/industry.rb index 47f27fa5..a90c3851 100644 --- a/lib/context_dev/resources/industry.rb +++ b/lib/context_dev/resources/industry.rb @@ -39,6 +39,46 @@ def retrieve_naics(params) ) end + # Some parameter documentations has been truncated, see + # {ContextDev::Models::IndustryRetrieveSicParams} for more details. + # + # Classify any brand into Standard Industrial Classification (SIC) codes from its + # domain or name. Choose between the original 1987 SIC system (`original_sic`) or + # the latest SIC list maintained by the SEC (`latest_sec`). + # + # @overload retrieve_sic(input:, max_results: nil, min_results: nil, timeout_ms: nil, type: nil, request_options: {}) + # + # @param input [String] Brand domain or title to retrieve SIC code for. If a valid domain is provided, i + # + # @param max_results [Integer] Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + # + # @param min_results [Integer] Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + # + # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th + # + # @param type [Symbol, ContextDev::Models::IndustryRetrieveSicParams::Type] Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Ind + # + # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [ContextDev::Models::IndustryRetrieveSicResponse] + # + # @see ContextDev::Models::IndustryRetrieveSicParams + def retrieve_sic(params) + parsed, options = ContextDev::IndustryRetrieveSicParams.dump_request(params) + query = ContextDev::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: "web/sic", + query: query.transform_keys( + max_results: "maxResults", + min_results: "minResults", + timeout_ms: "timeoutMS" + ), + model: ContextDev::Models::IndustryRetrieveSicResponse, + options: options + ) + end + # @api private # # @param client [ContextDev::Client] diff --git a/lib/context_dev/version.rb b/lib/context_dev/version.rb index dd56d101..e28554d1 100644 --- a/lib/context_dev/version.rb +++ b/lib/context_dev/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module ContextDev - VERSION = "1.8.0" + VERSION = "1.9.0" end diff --git a/rbi/context_dev/models.rbi b/rbi/context_dev/models.rbi index 43142d69..bff273c1 100644 --- a/rbi/context_dev/models.rbi +++ b/rbi/context_dev/models.rbi @@ -25,6 +25,8 @@ module ContextDev IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams + IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams + UtilityPrefetchByEmailParams = ContextDev::Models::UtilityPrefetchByEmailParams diff --git a/rbi/context_dev/models/industry_retrieve_sic_params.rbi b/rbi/context_dev/models/industry_retrieve_sic_params.rbi new file mode 100644 index 00000000..3f8c35b8 --- /dev/null +++ b/rbi/context_dev/models/industry_retrieve_sic_params.rbi @@ -0,0 +1,140 @@ +# typed: strong + +module ContextDev + module Models + class IndustryRetrieveSicParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + ContextDev::IndustryRetrieveSicParams, + ContextDev::Internal::AnyHash + ) + end + + # Brand domain or title to retrieve SIC code for. If a valid domain is provided, + # it will be used for classification, otherwise, we will search for the brand + # using the provided title. + sig { returns(String) } + attr_accessor :input + + # Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + sig { returns(T.nilable(Integer)) } + attr_reader :max_results + + sig { params(max_results: Integer).void } + attr_writer :max_results + + # Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + sig { returns(T.nilable(Integer)) } + attr_reader :min_results + + sig { params(min_results: Integer).void } + attr_writer :min_results + + # Optional timeout in milliseconds for the request. If the request takes longer + # than this value, it will be aborted with a 408 status code. Maximum allowed + # value is 300000ms (5 minutes). + sig { returns(T.nilable(Integer)) } + attr_reader :timeout_ms + + sig { params(timeout_ms: Integer).void } + attr_writer :timeout_ms + + # Which SIC dataset to classify against. `original_sic` uses the 1987 Standard + # Industrial Classification system; `latest_sec` uses the current SIC list as + # published by the SEC. Defaults to `original_sic`. + sig do + returns( + T.nilable(ContextDev::IndustryRetrieveSicParams::Type::OrSymbol) + ) + end + attr_reader :type + + sig do + params(type: ContextDev::IndustryRetrieveSicParams::Type::OrSymbol).void + end + attr_writer :type + + sig do + params( + input: String, + max_results: Integer, + min_results: Integer, + timeout_ms: Integer, + type: ContextDev::IndustryRetrieveSicParams::Type::OrSymbol, + request_options: ContextDev::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Brand domain or title to retrieve SIC code for. If a valid domain is provided, + # it will be used for classification, otherwise, we will search for the brand + # using the provided title. + input:, + # Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + max_results: nil, + # Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + min_results: nil, + # Optional timeout in milliseconds for the request. If the request takes longer + # than this value, it will be aborted with a 408 status code. Maximum allowed + # value is 300000ms (5 minutes). + timeout_ms: nil, + # Which SIC dataset to classify against. `original_sic` uses the 1987 Standard + # Industrial Classification system; `latest_sec` uses the current SIC list as + # published by the SEC. Defaults to `original_sic`. + type: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + input: String, + max_results: Integer, + min_results: Integer, + timeout_ms: Integer, + type: ContextDev::IndustryRetrieveSicParams::Type::OrSymbol, + request_options: ContextDev::RequestOptions + } + ) + end + def to_hash + end + + # Which SIC dataset to classify against. `original_sic` uses the 1987 Standard + # Industrial Classification system; `latest_sec` uses the current SIC list as + # published by the SEC. Defaults to `original_sic`. + module Type + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, ContextDev::IndustryRetrieveSicParams::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ORIGINAL_SIC = + T.let( + :original_sic, + ContextDev::IndustryRetrieveSicParams::Type::TaggedSymbol + ) + LATEST_SEC = + T.let( + :latest_sec, + ContextDev::IndustryRetrieveSicParams::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ContextDev::IndustryRetrieveSicParams::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/context_dev/models/industry_retrieve_sic_response.rbi b/rbi/context_dev/models/industry_retrieve_sic_response.rbi new file mode 100644 index 00000000..77f5cb43 --- /dev/null +++ b/rbi/context_dev/models/industry_retrieve_sic_response.rbi @@ -0,0 +1,292 @@ +# typed: strong + +module ContextDev + module Models + class IndustryRetrieveSicResponse < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::IndustryRetrieveSicResponse, + ContextDev::Internal::AnyHash + ) + end + + # Echoes back which SIC dataset was used to classify the brand. + sig do + returns( + T.nilable( + ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol + ) + ) + end + attr_reader :classification + + sig do + params( + classification: + ContextDev::Models::IndustryRetrieveSicResponse::Classification::OrSymbol + ).void + end + attr_writer :classification + + # Array of SIC codes with confidence scores. Extra fields depend on the requested + # classification: `original_sic` results include `majorGroup` and + # `majorGroupName`; `latest_sec` results include `office`. + sig do + returns( + T.nilable( + T::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code] + ) + ) + end + attr_reader :codes + + sig do + params( + codes: + T::Array[ + ContextDev::Models::IndustryRetrieveSicResponse::Code::OrHash + ] + ).void + end + attr_writer :codes + + # Domain found for the brand + sig { returns(T.nilable(String)) } + attr_reader :domain + + sig { params(domain: String).void } + attr_writer :domain + + # Status of the response, e.g., 'ok' + sig { returns(T.nilable(String)) } + attr_reader :status + + sig { params(status: String).void } + attr_writer :status + + # Industry classification type, for sic api it will be `sic` + sig { returns(T.nilable(String)) } + attr_reader :type + + sig { params(type: String).void } + attr_writer :type + + sig do + params( + classification: + ContextDev::Models::IndustryRetrieveSicResponse::Classification::OrSymbol, + codes: + T::Array[ + ContextDev::Models::IndustryRetrieveSicResponse::Code::OrHash + ], + domain: String, + status: String, + type: String + ).returns(T.attached_class) + end + def self.new( + # Echoes back which SIC dataset was used to classify the brand. + classification: nil, + # Array of SIC codes with confidence scores. Extra fields depend on the requested + # classification: `original_sic` results include `majorGroup` and + # `majorGroupName`; `latest_sec` results include `office`. + codes: nil, + # Domain found for the brand + domain: nil, + # Status of the response, e.g., 'ok' + status: nil, + # Industry classification type, for sic api it will be `sic` + type: nil + ) + end + + sig do + override.returns( + { + classification: + ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol, + codes: + T::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code], + domain: String, + status: String, + type: String + } + ) + end + def to_hash + end + + # Echoes back which SIC dataset was used to classify the brand. + module Classification + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::Models::IndustryRetrieveSicResponse::Classification + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ORIGINAL_SIC = + T.let( + :original_sic, + ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol + ) + LATEST_SEC = + T.let( + :latest_sec, + ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::IndustryRetrieveSicResponse::Classification::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Code < ContextDev::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + ContextDev::Models::IndustryRetrieveSicResponse::Code, + ContextDev::Internal::AnyHash + ) + end + + # SIC code (4-digit). + sig { returns(String) } + attr_accessor :code + + # Confidence level for how well this SIC code matches the company description. + sig do + returns( + ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol + ) + end + attr_accessor :confidence + + # SIC industry title. + sig { returns(String) } + attr_accessor :name + + # 2-digit major group identifier (the leading two digits of the code). Only + # present when `classification` is `original_sic`. + sig { returns(T.nilable(String)) } + attr_reader :major_group + + sig { params(major_group: String).void } + attr_writer :major_group + + # Description of the 2-digit major group. Only present when `classification` is + # `original_sic`. + sig { returns(T.nilable(String)) } + attr_reader :major_group_name + + sig { params(major_group_name: String).void } + attr_writer :major_group_name + + # SEC review office responsible for filings under this code. Only present when + # `classification` is `latest_sec`. + sig { returns(T.nilable(String)) } + attr_reader :office + + sig { params(office: String).void } + attr_writer :office + + sig do + params( + code: String, + confidence: + ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::OrSymbol, + name: String, + major_group: String, + major_group_name: String, + office: String + ).returns(T.attached_class) + end + def self.new( + # SIC code (4-digit). + code:, + # Confidence level for how well this SIC code matches the company description. + confidence:, + # SIC industry title. + name:, + # 2-digit major group identifier (the leading two digits of the code). Only + # present when `classification` is `original_sic`. + major_group: nil, + # Description of the 2-digit major group. Only present when `classification` is + # `original_sic`. + major_group_name: nil, + # SEC review office responsible for filings under this code. Only present when + # `classification` is `latest_sec`. + office: nil + ) + end + + sig do + override.returns( + { + code: String, + confidence: + ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol, + name: String, + major_group: String, + major_group_name: String, + office: String + } + ) + end + def to_hash + end + + # Confidence level for how well this SIC code matches the company description. + module Confidence + extend ContextDev::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + HIGH = + T.let( + :high, + ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol + ) + MEDIUM = + T.let( + :medium, + ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol + ) + LOW = + T.let( + :low, + ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end +end diff --git a/rbi/context_dev/resources/industry.rbi b/rbi/context_dev/resources/industry.rbi index 97516941..4b653879 100644 --- a/rbi/context_dev/resources/industry.rbi +++ b/rbi/context_dev/resources/industry.rbi @@ -31,6 +31,40 @@ module ContextDev ) end + # Classify any brand into Standard Industrial Classification (SIC) codes from its + # domain or name. Choose between the original 1987 SIC system (`original_sic`) or + # the latest SIC list maintained by the SEC (`latest_sec`). + sig do + params( + input: String, + max_results: Integer, + min_results: Integer, + timeout_ms: Integer, + type: ContextDev::IndustryRetrieveSicParams::Type::OrSymbol, + request_options: ContextDev::RequestOptions::OrHash + ).returns(ContextDev::Models::IndustryRetrieveSicResponse) + end + def retrieve_sic( + # Brand domain or title to retrieve SIC code for. If a valid domain is provided, + # it will be used for classification, otherwise, we will search for the brand + # using the provided title. + input:, + # Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + max_results: nil, + # Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + min_results: nil, + # Optional timeout in milliseconds for the request. If the request takes longer + # than this value, it will be aborted with a 408 status code. Maximum allowed + # value is 300000ms (5 minutes). + timeout_ms: nil, + # Which SIC dataset to classify against. `original_sic` uses the 1987 Standard + # Industrial Classification system; `latest_sec` uses the current SIC list as + # published by the SEC. Defaults to `original_sic`. + type: nil, + request_options: {} + ) + end + # @api private sig { params(client: ContextDev::Client).returns(T.attached_class) } def self.new(client:) diff --git a/sig/context_dev/models.rbs b/sig/context_dev/models.rbs index 992384f4..c5ab457d 100644 --- a/sig/context_dev/models.rbs +++ b/sig/context_dev/models.rbs @@ -21,6 +21,8 @@ module ContextDev class IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams + class IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams + class UtilityPrefetchByEmailParams = ContextDev::Models::UtilityPrefetchByEmailParams class UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams diff --git a/sig/context_dev/models/industry_retrieve_sic_params.rbs b/sig/context_dev/models/industry_retrieve_sic_params.rbs new file mode 100644 index 00000000..27129a68 --- /dev/null +++ b/sig/context_dev/models/industry_retrieve_sic_params.rbs @@ -0,0 +1,67 @@ +module ContextDev + module Models + type industry_retrieve_sic_params = + { + input: String, + max_results: Integer, + min_results: Integer, + timeout_ms: Integer, + type: ContextDev::Models::IndustryRetrieveSicParams::type_ + } + & ContextDev::Internal::Type::request_parameters + + class IndustryRetrieveSicParams < ContextDev::Internal::Type::BaseModel + extend ContextDev::Internal::Type::RequestParameters::Converter + include ContextDev::Internal::Type::RequestParameters + + attr_accessor input: String + + attr_reader max_results: Integer? + + def max_results=: (Integer) -> Integer + + attr_reader min_results: Integer? + + def min_results=: (Integer) -> Integer + + attr_reader timeout_ms: Integer? + + def timeout_ms=: (Integer) -> Integer + + attr_reader type: ContextDev::Models::IndustryRetrieveSicParams::type_? + + def type=: ( + ContextDev::Models::IndustryRetrieveSicParams::type_ + ) -> ContextDev::Models::IndustryRetrieveSicParams::type_ + + def initialize: ( + input: String, + ?max_results: Integer, + ?min_results: Integer, + ?timeout_ms: Integer, + ?type: ContextDev::Models::IndustryRetrieveSicParams::type_, + ?request_options: ContextDev::request_opts + ) -> void + + def to_hash: -> { + input: String, + max_results: Integer, + min_results: Integer, + timeout_ms: Integer, + type: ContextDev::Models::IndustryRetrieveSicParams::type_, + request_options: ContextDev::RequestOptions + } + + type type_ = :original_sic | :latest_sec + + module Type + extend ContextDev::Internal::Type::Enum + + ORIGINAL_SIC: :original_sic + LATEST_SEC: :latest_sec + + def self?.values: -> ::Array[ContextDev::Models::IndustryRetrieveSicParams::type_] + end + end + end +end diff --git a/sig/context_dev/models/industry_retrieve_sic_response.rbs b/sig/context_dev/models/industry_retrieve_sic_response.rbs new file mode 100644 index 00000000..d1e6068e --- /dev/null +++ b/sig/context_dev/models/industry_retrieve_sic_response.rbs @@ -0,0 +1,125 @@ +module ContextDev + module Models + type industry_retrieve_sic_response = + { + classification: ContextDev::Models::IndustryRetrieveSicResponse::classification, + codes: ::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code], + domain: String, + status: String, + type: String + } + + class IndustryRetrieveSicResponse < ContextDev::Internal::Type::BaseModel + attr_reader classification: ContextDev::Models::IndustryRetrieveSicResponse::classification? + + def classification=: ( + ContextDev::Models::IndustryRetrieveSicResponse::classification + ) -> ContextDev::Models::IndustryRetrieveSicResponse::classification + + attr_reader codes: ::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code]? + + def codes=: ( + ::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code] + ) -> ::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code] + + attr_reader domain: String? + + def domain=: (String) -> String + + attr_reader status: String? + + def status=: (String) -> String + + attr_reader type: String? + + def type=: (String) -> String + + def initialize: ( + ?classification: ContextDev::Models::IndustryRetrieveSicResponse::classification, + ?codes: ::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code], + ?domain: String, + ?status: String, + ?type: String + ) -> void + + def to_hash: -> { + classification: ContextDev::Models::IndustryRetrieveSicResponse::classification, + codes: ::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code], + domain: String, + status: String, + type: String + } + + type classification = :original_sic | :latest_sec + + module Classification + extend ContextDev::Internal::Type::Enum + + ORIGINAL_SIC: :original_sic + LATEST_SEC: :latest_sec + + def self?.values: -> ::Array[ContextDev::Models::IndustryRetrieveSicResponse::classification] + end + + type code = + { + code: String, + confidence: ContextDev::Models::IndustryRetrieveSicResponse::Code::confidence, + name: String, + major_group: String, + major_group_name: String, + office: String + } + + class Code < ContextDev::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor confidence: ContextDev::Models::IndustryRetrieveSicResponse::Code::confidence + + attr_accessor name: String + + attr_reader major_group: String? + + def major_group=: (String) -> String + + attr_reader major_group_name: String? + + def major_group_name=: (String) -> String + + attr_reader office: String? + + def office=: (String) -> String + + def initialize: ( + code: String, + confidence: ContextDev::Models::IndustryRetrieveSicResponse::Code::confidence, + name: String, + ?major_group: String, + ?major_group_name: String, + ?office: String + ) -> void + + def to_hash: -> { + code: String, + confidence: ContextDev::Models::IndustryRetrieveSicResponse::Code::confidence, + name: String, + major_group: String, + major_group_name: String, + office: String + } + + type confidence = :high | :medium | :low + + module Confidence + extend ContextDev::Internal::Type::Enum + + HIGH: :high + MEDIUM: :medium + LOW: :low + + def self?.values: -> ::Array[ContextDev::Models::IndustryRetrieveSicResponse::Code::confidence] + end + end + end + end +end diff --git a/sig/context_dev/resources/industry.rbs b/sig/context_dev/resources/industry.rbs index c0568529..1fbbe705 100644 --- a/sig/context_dev/resources/industry.rbs +++ b/sig/context_dev/resources/industry.rbs @@ -9,6 +9,15 @@ module ContextDev ?request_options: ContextDev::request_opts ) -> ContextDev::Models::IndustryRetrieveNaicsResponse + def retrieve_sic: ( + input: String, + ?max_results: Integer, + ?min_results: Integer, + ?timeout_ms: Integer, + ?type: ContextDev::Models::IndustryRetrieveSicParams::type_, + ?request_options: ContextDev::request_opts + ) -> ContextDev::Models::IndustryRetrieveSicResponse + def initialize: (client: ContextDev::Client) -> void end end diff --git a/test/context_dev/resources/industry_test.rb b/test/context_dev/resources/industry_test.rb index 78099a13..7a7cb7dd 100644 --- a/test/context_dev/resources/industry_test.rb +++ b/test/context_dev/resources/industry_test.rb @@ -21,4 +21,24 @@ def test_retrieve_naics_required_params } end end + + def test_retrieve_sic_required_params + skip("Mock server tests are disabled") + + response = @context_dev.industry.retrieve_sic(input: "input") + + assert_pattern do + response => ContextDev::Models::IndustryRetrieveSicResponse + end + + assert_pattern do + response => { + classification: ContextDev::Models::IndustryRetrieveSicResponse::Classification | nil, + codes: ^(ContextDev::Internal::Type::ArrayOf[ContextDev::Models::IndustryRetrieveSicResponse::Code]) | nil, + domain: String | nil, + status: String | nil, + type: String | nil + } + end + end end