context.dev 1.8.0 → 1.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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +15 -1
  5. data/lib/context_dev/models/ai_extract_product_params.rb +11 -1
  6. data/lib/context_dev/models/ai_extract_products_params.rb +22 -2
  7. data/lib/context_dev/models/industry_retrieve_sic_params.rb +76 -0
  8. data/lib/context_dev/models/industry_retrieve_sic_response.rb +139 -0
  9. data/lib/context_dev/models.rb +2 -0
  10. data/lib/context_dev/resources/ai.rb +8 -7
  11. data/lib/context_dev/resources/industry.rb +40 -0
  12. data/lib/context_dev/resources/utility.rb +2 -6
  13. data/lib/context_dev/version.rb +1 -1
  14. data/lib/context_dev.rb +2 -0
  15. data/rbi/context_dev/models/ai_extract_product_params.rbi +15 -0
  16. data/rbi/context_dev/models/ai_extract_products_params.rbi +40 -2
  17. data/rbi/context_dev/models/industry_retrieve_sic_params.rbi +140 -0
  18. data/rbi/context_dev/models/industry_retrieve_sic_response.rbi +292 -0
  19. data/rbi/context_dev/models.rbi +2 -0
  20. data/rbi/context_dev/resources/ai.rbi +10 -6
  21. data/rbi/context_dev/resources/industry.rbi +34 -0
  22. data/rbi/context_dev/resources/utility.rbi +2 -6
  23. data/sig/context_dev/models/ai_extract_product_params.rbs +7 -1
  24. data/sig/context_dev/models/ai_extract_products_params.rbs +24 -2
  25. data/sig/context_dev/models/industry_retrieve_sic_params.rbs +67 -0
  26. data/sig/context_dev/models/industry_retrieve_sic_response.rbs +125 -0
  27. data/sig/context_dev/models.rbs +2 -0
  28. data/sig/context_dev/resources/ai.rbs +1 -0
  29. data/sig/context_dev/resources/industry.rbs +9 -0
  30. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 968dddadfbf1199743ee57bc82a47fd2d7b882da416170b13f41bf0574828d5d
4
- data.tar.gz: 5e35c5601c635fdc8182a81e5738418f4e4d879231cbaea89b1722ba5f28db00
3
+ metadata.gz: dd5277f504c21625472d556d7a4151a793e14e4721d603c2304b93fad9668631
4
+ data.tar.gz: 0c4141a438cd3acee423b2edf10563e58f95bf48ed107c0d4db14871e6f1dd52
5
5
  SHA512:
6
- metadata.gz: 9ffe4d5dde7376e41afd9607af63fcecd7ab97d8abf26a2adceef1a30594ec54dd10356c731c54dd97ebad44e00eb2d24132ebe27c25a95acfd8a568578557a9
7
- data.tar.gz: 2fc80f2bc42e75a0dc03f4c3692f45e6eadce167280695690d69bc408c87eb9504fb557cd661c33041bff9c59876a6f47bbd8ba360b092ab762e70221b79e3ff
6
+ metadata.gz: 17e11b02edc7b645b530ac42a76635525745050130a62b8cce21e07b11b583638df5063e242f14fd89467b198a79c0df344a3667eecedcaa5cce185cd5d9a28a
7
+ data.tar.gz: 6839a627ea33e8e1d2f95c260167ed208f327d90d362f771ed609d3986434b3d89b8ddf30d05a5f90b7b6e7fbecff282ba1a0d550dd9ad5bfa8738f7e86383ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.0 (2026-05-01)
4
+
5
+ Full Changelog: [v1.9.0...v1.10.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.9.0...v1.10.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([c74cbf3](https://github.com/context-dot-dev/context-ruby-sdk/commit/c74cbf354e15c2b56680b4248ed69462a1a84d23))
10
+ * **api:** api update ([cc57672](https://github.com/context-dot-dev/context-ruby-sdk/commit/cc576729ce6c522ee578e7dc5f99122463014515))
11
+ * support setting headers via env ([e625fee](https://github.com/context-dot-dev/context-ruby-sdk/commit/e625fee97a6d4f6ab25f69447b33521cac6a896c))
12
+
13
+ ## 1.9.0 (2026-04-25)
14
+
15
+ Full Changelog: [v1.8.0...v1.9.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.8.0...v1.9.0)
16
+
17
+ ### Features
18
+
19
+ * **api:** manual updates ([e1f12de](https://github.com/context-dot-dev/context-ruby-sdk/commit/e1f12de44bcadd047b5746fdddcd828a29107e1e))
20
+
3
21
  ## 1.8.0 (2026-04-24)
4
22
 
5
23
  Full Changelog: [v1.7.0...v1.8.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.7.0...v1.8.0)
data/README.md CHANGED
@@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
26
26
  <!-- x-release-please-start-version -->
27
27
 
28
28
  ```ruby
29
- gem "context.dev", "~> 1.8.0"
29
+ gem "context.dev", "~> 1.10.0"
30
30
  ```
31
31
 
32
32
  <!-- x-release-please-end -->
@@ -70,6 +70,19 @@ module ContextDev
70
70
  raise ArgumentError.new("api_key is required, and can be set via environ: \"CONTEXT_DEV_API_KEY\"")
71
71
  end
72
72
 
73
+ headers = {}
74
+ custom_headers_env = ENV["CONTEXT_DEV_CUSTOM_HEADERS"]
75
+ unless custom_headers_env.nil?
76
+ parsed = {}
77
+ custom_headers_env.split("\n").each do |line|
78
+ colon = line.index(":")
79
+ unless colon.nil?
80
+ parsed[line[0...colon].strip] = line[(colon + 1)..].strip
81
+ end
82
+ end
83
+ headers = parsed.merge(headers)
84
+ end
85
+
73
86
  @api_key = api_key.to_s
74
87
 
75
88
  super(
@@ -77,7 +90,8 @@ module ContextDev
77
90
  timeout: timeout,
78
91
  max_retries: max_retries,
79
92
  initial_retry_delay: initial_retry_delay,
80
- max_retry_delay: max_retry_delay
93
+ max_retry_delay: max_retry_delay,
94
+ headers: headers
81
95
  )
82
96
 
83
97
  @web = ContextDev::Resources::Web.new(client: self)
@@ -13,6 +13,14 @@ module ContextDev
13
13
  # @return [String]
14
14
  required :url, String
15
15
 
16
+ # @!attribute max_age_ms
17
+ # Return a cached result if a prior scrape for the same parameters exists and is
18
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
19
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
20
+ #
21
+ # @return [Integer, nil]
22
+ optional :max_age_ms, Integer, api_name: :maxAgeMs
23
+
16
24
  # @!attribute timeout_ms
17
25
  # Optional timeout in milliseconds for the request. Maximum allowed value is
18
26
  # 300000ms (5 minutes).
@@ -20,12 +28,14 @@ module ContextDev
20
28
  # @return [Integer, nil]
21
29
  optional :timeout_ms, Integer, api_name: :timeoutMS
22
30
 
23
- # @!method initialize(url:, timeout_ms: nil, request_options: {})
31
+ # @!method initialize(url:, max_age_ms: nil, timeout_ms: nil, request_options: {})
24
32
  # Some parameter documentations has been truncated, see
25
33
  # {ContextDev::Models::AIExtractProductParams} for more details.
26
34
  #
27
35
  # @param url [String] The product page URL to extract product data from.
28
36
  #
37
+ # @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
38
+ #
29
39
  # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. Maximum allowed value is 30000
30
40
  #
31
41
  # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
@@ -30,6 +30,14 @@ module ContextDev
30
30
  # @return [String]
31
31
  required :domain, String
32
32
 
33
+ # @!attribute max_age_ms
34
+ # Return a cached result if a prior scrape for the same parameters exists and is
35
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
36
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
37
+ #
38
+ # @return [Integer, nil]
39
+ optional :max_age_ms, Integer, api_name: :maxAgeMs
40
+
33
41
  # @!attribute max_products
34
42
  # Maximum number of products to extract.
35
43
  #
@@ -43,12 +51,14 @@ module ContextDev
43
51
  # @return [Integer, nil]
44
52
  optional :timeout_ms, Integer, api_name: :timeoutMS
45
53
 
46
- # @!method initialize(domain:, max_products: nil, timeout_ms: nil)
54
+ # @!method initialize(domain:, max_age_ms: nil, max_products: nil, timeout_ms: nil)
47
55
  # Some parameter documentations has been truncated, see
48
56
  # {ContextDev::Models::AIExtractProductsParams::Body::ByDomain} for more details.
49
57
  #
50
58
  # @param domain [String] The domain name to analyze.
51
59
  #
60
+ # @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
61
+ #
52
62
  # @param max_products [Integer] Maximum number of products to extract.
53
63
  #
54
64
  # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. Maximum allowed value is 30000
@@ -62,6 +72,14 @@ module ContextDev
62
72
  # @return [String]
63
73
  required :direct_url, String, api_name: :directUrl
64
74
 
75
+ # @!attribute max_age_ms
76
+ # Return a cached result if a prior scrape for the same parameters exists and is
77
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
78
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
79
+ #
80
+ # @return [Integer, nil]
81
+ optional :max_age_ms, Integer, api_name: :maxAgeMs
82
+
65
83
  # @!attribute max_products
66
84
  # Maximum number of products to extract.
67
85
  #
@@ -75,13 +93,15 @@ module ContextDev
75
93
  # @return [Integer, nil]
76
94
  optional :timeout_ms, Integer, api_name: :timeoutMS
77
95
 
78
- # @!method initialize(direct_url:, max_products: nil, timeout_ms: nil)
96
+ # @!method initialize(direct_url:, max_age_ms: nil, max_products: nil, timeout_ms: nil)
79
97
  # Some parameter documentations has been truncated, see
80
98
  # {ContextDev::Models::AIExtractProductsParams::Body::ByDirectURL} for more
81
99
  # details.
82
100
  #
83
101
  # @param direct_url [String] A specific URL to use directly as the starting point for extraction without doma
84
102
  #
103
+ # @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
104
+ #
85
105
  # @param max_products [Integer] Maximum number of products to extract.
86
106
  #
87
107
  # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. Maximum allowed value is 30000
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ # @see ContextDev::Resources::Industry#retrieve_sic
6
+ class IndustryRetrieveSicParams < ContextDev::Internal::Type::BaseModel
7
+ extend ContextDev::Internal::Type::RequestParameters::Converter
8
+ include ContextDev::Internal::Type::RequestParameters
9
+
10
+ # @!attribute input
11
+ # Brand domain or title to retrieve SIC code for. If a valid domain is provided,
12
+ # it will be used for classification, otherwise, we will search for the brand
13
+ # using the provided title.
14
+ #
15
+ # @return [String]
16
+ required :input, String
17
+
18
+ # @!attribute max_results
19
+ # Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5.
20
+ #
21
+ # @return [Integer, nil]
22
+ optional :max_results, Integer
23
+
24
+ # @!attribute min_results
25
+ # Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.
26
+ #
27
+ # @return [Integer, nil]
28
+ optional :min_results, Integer
29
+
30
+ # @!attribute timeout_ms
31
+ # Optional timeout in milliseconds for the request. If the request takes longer
32
+ # than this value, it will be aborted with a 408 status code. Maximum allowed
33
+ # value is 300000ms (5 minutes).
34
+ #
35
+ # @return [Integer, nil]
36
+ optional :timeout_ms, Integer
37
+
38
+ # @!attribute type
39
+ # Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
40
+ # Industrial Classification system; `latest_sec` uses the current SIC list as
41
+ # published by the SEC. Defaults to `original_sic`.
42
+ #
43
+ # @return [Symbol, ContextDev::Models::IndustryRetrieveSicParams::Type, nil]
44
+ optional :type, enum: -> { ContextDev::IndustryRetrieveSicParams::Type }
45
+
46
+ # @!method initialize(input:, max_results: nil, min_results: nil, timeout_ms: nil, type: nil, request_options: {})
47
+ # Some parameter documentations has been truncated, see
48
+ # {ContextDev::Models::IndustryRetrieveSicParams} for more details.
49
+ #
50
+ # @param input [String] Brand domain or title to retrieve SIC code for. If a valid domain is provided, i
51
+ #
52
+ # @param max_results [Integer] Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5.
53
+ #
54
+ # @param min_results [Integer] Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.
55
+ #
56
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
57
+ #
58
+ # @param type [Symbol, ContextDev::Models::IndustryRetrieveSicParams::Type] Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Ind
59
+ #
60
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
61
+
62
+ # Which SIC dataset to classify against. `original_sic` uses the 1987 Standard
63
+ # Industrial Classification system; `latest_sec` uses the current SIC list as
64
+ # published by the SEC. Defaults to `original_sic`.
65
+ module Type
66
+ extend ContextDev::Internal::Type::Enum
67
+
68
+ ORIGINAL_SIC = :original_sic
69
+ LATEST_SEC = :latest_sec
70
+
71
+ # @!method self.values
72
+ # @return [Array<Symbol>]
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,139 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ContextDev
4
+ module Models
5
+ # @see ContextDev::Resources::Industry#retrieve_sic
6
+ class IndustryRetrieveSicResponse < ContextDev::Internal::Type::BaseModel
7
+ # @!attribute classification
8
+ # Echoes back which SIC dataset was used to classify the brand.
9
+ #
10
+ # @return [Symbol, ContextDev::Models::IndustryRetrieveSicResponse::Classification, nil]
11
+ optional :classification, enum: -> { ContextDev::Models::IndustryRetrieveSicResponse::Classification }
12
+
13
+ # @!attribute codes
14
+ # Array of SIC codes with confidence scores. Extra fields depend on the requested
15
+ # classification: `original_sic` results include `majorGroup` and
16
+ # `majorGroupName`; `latest_sec` results include `office`.
17
+ #
18
+ # @return [Array<ContextDev::Models::IndustryRetrieveSicResponse::Code>, nil]
19
+ optional :codes,
20
+ -> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::IndustryRetrieveSicResponse::Code] }
21
+
22
+ # @!attribute domain
23
+ # Domain found for the brand
24
+ #
25
+ # @return [String, nil]
26
+ optional :domain, String
27
+
28
+ # @!attribute status
29
+ # Status of the response, e.g., 'ok'
30
+ #
31
+ # @return [String, nil]
32
+ optional :status, String
33
+
34
+ # @!attribute type
35
+ # Industry classification type, for sic api it will be `sic`
36
+ #
37
+ # @return [String, nil]
38
+ optional :type, String
39
+
40
+ # @!method initialize(classification: nil, codes: nil, domain: nil, status: nil, type: nil)
41
+ # Some parameter documentations has been truncated, see
42
+ # {ContextDev::Models::IndustryRetrieveSicResponse} for more details.
43
+ #
44
+ # @param classification [Symbol, ContextDev::Models::IndustryRetrieveSicResponse::Classification] Echoes back which SIC dataset was used to classify the brand.
45
+ #
46
+ # @param codes [Array<ContextDev::Models::IndustryRetrieveSicResponse::Code>] Array of SIC codes with confidence scores. Extra fields depend on the requested
47
+ #
48
+ # @param domain [String] Domain found for the brand
49
+ #
50
+ # @param status [String] Status of the response, e.g., 'ok'
51
+ #
52
+ # @param type [String] Industry classification type, for sic api it will be `sic`
53
+
54
+ # Echoes back which SIC dataset was used to classify the brand.
55
+ #
56
+ # @see ContextDev::Models::IndustryRetrieveSicResponse#classification
57
+ module Classification
58
+ extend ContextDev::Internal::Type::Enum
59
+
60
+ ORIGINAL_SIC = :original_sic
61
+ LATEST_SEC = :latest_sec
62
+
63
+ # @!method self.values
64
+ # @return [Array<Symbol>]
65
+ end
66
+
67
+ class Code < ContextDev::Internal::Type::BaseModel
68
+ # @!attribute code
69
+ # SIC code (4-digit).
70
+ #
71
+ # @return [String]
72
+ required :code, String
73
+
74
+ # @!attribute confidence
75
+ # Confidence level for how well this SIC code matches the company description.
76
+ #
77
+ # @return [Symbol, ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence]
78
+ required :confidence, enum: -> { ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence }
79
+
80
+ # @!attribute name
81
+ # SIC industry title.
82
+ #
83
+ # @return [String]
84
+ required :name, String
85
+
86
+ # @!attribute major_group
87
+ # 2-digit major group identifier (the leading two digits of the code). Only
88
+ # present when `classification` is `original_sic`.
89
+ #
90
+ # @return [String, nil]
91
+ optional :major_group, String, api_name: :majorGroup
92
+
93
+ # @!attribute major_group_name
94
+ # Description of the 2-digit major group. Only present when `classification` is
95
+ # `original_sic`.
96
+ #
97
+ # @return [String, nil]
98
+ optional :major_group_name, String, api_name: :majorGroupName
99
+
100
+ # @!attribute office
101
+ # SEC review office responsible for filings under this code. Only present when
102
+ # `classification` is `latest_sec`.
103
+ #
104
+ # @return [String, nil]
105
+ optional :office, String
106
+
107
+ # @!method initialize(code:, confidence:, name:, major_group: nil, major_group_name: nil, office: nil)
108
+ # Some parameter documentations has been truncated, see
109
+ # {ContextDev::Models::IndustryRetrieveSicResponse::Code} for more details.
110
+ #
111
+ # @param code [String] SIC code (4-digit).
112
+ #
113
+ # @param confidence [Symbol, ContextDev::Models::IndustryRetrieveSicResponse::Code::Confidence] Confidence level for how well this SIC code matches the company description.
114
+ #
115
+ # @param name [String] SIC industry title.
116
+ #
117
+ # @param major_group [String] 2-digit major group identifier (the leading two digits of the code). Only presen
118
+ #
119
+ # @param major_group_name [String] Description of the 2-digit major group. Only present when `classification` is `o
120
+ #
121
+ # @param office [String] SEC review office responsible for filings under this code. Only present when `cl
122
+
123
+ # Confidence level for how well this SIC code matches the company description.
124
+ #
125
+ # @see ContextDev::Models::IndustryRetrieveSicResponse::Code#confidence
126
+ module Confidence
127
+ extend ContextDev::Internal::Type::Enum
128
+
129
+ HIGH = :high
130
+ MEDIUM = :medium
131
+ LOW = :low
132
+
133
+ # @!method self.values
134
+ # @return [Array<Symbol>]
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
@@ -61,6 +61,8 @@ module ContextDev
61
61
 
62
62
  IndustryRetrieveNaicsParams = ContextDev::Models::IndustryRetrieveNaicsParams
63
63
 
64
+ IndustryRetrieveSicParams = ContextDev::Models::IndustryRetrieveSicParams
65
+
64
66
  UtilityPrefetchByEmailParams = ContextDev::Models::UtilityPrefetchByEmailParams
65
67
 
66
68
  UtilityPrefetchParams = ContextDev::Models::UtilityPrefetchParams
@@ -39,14 +39,15 @@ module ContextDev
39
39
  # Some parameter documentations has been truncated, see
40
40
  # {ContextDev::Models::AIExtractProductParams} for more details.
41
41
  #
42
- # Beta feature: Given a single URL, determines if it is a product detail page,
43
- # classifies the platform/product type, and extracts the product information.
44
- # Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites.
42
+ # Given a single URL, determines if it is a product page and extracts the product
43
+ # information.
45
44
  #
46
- # @overload extract_product(url:, timeout_ms: nil, request_options: {})
45
+ # @overload extract_product(url:, max_age_ms: nil, timeout_ms: nil, request_options: {})
47
46
  #
48
47
  # @param url [String] The product page URL to extract product data from.
49
48
  #
49
+ # @param max_age_ms [Integer] Return a cached result if a prior scrape for the same parameters exists and is y
50
+ #
50
51
  # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. Maximum allowed value is 30000
51
52
  #
52
53
  # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -65,9 +66,9 @@ module ContextDev
65
66
  )
66
67
  end
67
68
 
68
- # Beta feature: Extract product information from a brand's website. We will
69
- # analyze the website and return a list of products with details such as name,
70
- # description, image, pricing, features, and more.
69
+ # Extract product information from a brand's website. We will analyze the website
70
+ # and return a list of products with details such as name, description, image,
71
+ # pricing, features, and more.
71
72
  #
72
73
  # @overload extract_products(body:, request_options: {})
73
74
  #
@@ -39,6 +39,46 @@ module ContextDev
39
39
  )
40
40
  end
41
41
 
42
+ # Some parameter documentations has been truncated, see
43
+ # {ContextDev::Models::IndustryRetrieveSicParams} for more details.
44
+ #
45
+ # Classify any brand into Standard Industrial Classification (SIC) codes from its
46
+ # domain or name. Choose between the original SIC system (`original_sic`) or the
47
+ # latest SIC list maintained by the SEC (`latest_sec`).
48
+ #
49
+ # @overload retrieve_sic(input:, max_results: nil, min_results: nil, timeout_ms: nil, type: nil, request_options: {})
50
+ #
51
+ # @param input [String] Brand domain or title to retrieve SIC code for. If a valid domain is provided, i
52
+ #
53
+ # @param max_results [Integer] Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5.
54
+ #
55
+ # @param min_results [Integer] Minimum number of SIC codes to return. Must be at least 1. Defaults to 1.
56
+ #
57
+ # @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
58
+ #
59
+ # @param type [Symbol, ContextDev::Models::IndustryRetrieveSicParams::Type] Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Ind
60
+ #
61
+ # @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
62
+ #
63
+ # @return [ContextDev::Models::IndustryRetrieveSicResponse]
64
+ #
65
+ # @see ContextDev::Models::IndustryRetrieveSicParams
66
+ def retrieve_sic(params)
67
+ parsed, options = ContextDev::IndustryRetrieveSicParams.dump_request(params)
68
+ query = ContextDev::Internal::Util.encode_query_params(parsed)
69
+ @client.request(
70
+ method: :get,
71
+ path: "web/sic",
72
+ query: query.transform_keys(
73
+ max_results: "maxResults",
74
+ min_results: "minResults",
75
+ timeout_ms: "timeoutMS"
76
+ ),
77
+ model: ContextDev::Models::IndustryRetrieveSicResponse,
78
+ options: options
79
+ )
80
+ end
81
+
42
82
  # @api private
43
83
  #
44
84
  # @param client [ContextDev::Client]
@@ -7,9 +7,7 @@ module ContextDev
7
7
  # {ContextDev::Models::UtilityPrefetchParams} for more details.
8
8
  #
9
9
  # Signal that you may fetch brand data for a particular domain soon to improve
10
- # latency. This endpoint does not charge credits and is available for paid
11
- # customers to optimize future requests. [You must be on a paid plan to use this
12
- # endpoint]
10
+ # latency.
13
11
  #
14
12
  # @overload prefetch(domain:, timeout_ms: nil, request_options: {})
15
13
  #
@@ -39,9 +37,7 @@ module ContextDev
39
37
  # Signal that you may fetch brand data for a particular domain soon to improve
40
38
  # latency. This endpoint accepts an email address, extracts the domain from it,
41
39
  # validates that it's not a disposable or free email provider, and queues the
42
- # domain for prefetching. This endpoint does not charge credits and is available
43
- # for paid customers to optimize future requests. [You must be on a paid plan to
44
- # use this endpoint]
40
+ # domain for prefetching.
45
41
  #
46
42
  # @overload prefetch_by_email(email:, timeout_ms: nil, request_options: {})
47
43
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ContextDev
4
- VERSION = "1.8.0"
4
+ VERSION = "1.10.0"
5
5
  end
data/lib/context_dev.rb CHANGED
@@ -74,6 +74,8 @@ require_relative "context_dev/models/brand_retrieve_simplified_params"
74
74
  require_relative "context_dev/models/brand_retrieve_simplified_response"
75
75
  require_relative "context_dev/models/industry_retrieve_naics_params"
76
76
  require_relative "context_dev/models/industry_retrieve_naics_response"
77
+ require_relative "context_dev/models/industry_retrieve_sic_params"
78
+ require_relative "context_dev/models/industry_retrieve_sic_response"
77
79
  require_relative "context_dev/models/utility_prefetch_by_email_params"
78
80
  require_relative "context_dev/models/utility_prefetch_by_email_response"
79
81
  require_relative "context_dev/models/utility_prefetch_params"
@@ -18,6 +18,15 @@ module ContextDev
18
18
  sig { returns(String) }
19
19
  attr_accessor :url
20
20
 
21
+ # Return a cached result if a prior scrape for the same parameters exists and is
22
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
23
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
24
+ sig { returns(T.nilable(Integer)) }
25
+ attr_reader :max_age_ms
26
+
27
+ sig { params(max_age_ms: Integer).void }
28
+ attr_writer :max_age_ms
29
+
21
30
  # Optional timeout in milliseconds for the request. Maximum allowed value is
22
31
  # 300000ms (5 minutes).
23
32
  sig { returns(T.nilable(Integer)) }
@@ -29,6 +38,7 @@ module ContextDev
29
38
  sig do
30
39
  params(
31
40
  url: String,
41
+ max_age_ms: Integer,
32
42
  timeout_ms: Integer,
33
43
  request_options: ContextDev::RequestOptions::OrHash
34
44
  ).returns(T.attached_class)
@@ -36,6 +46,10 @@ module ContextDev
36
46
  def self.new(
37
47
  # The product page URL to extract product data from.
38
48
  url:,
49
+ # Return a cached result if a prior scrape for the same parameters exists and is
50
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
51
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
52
+ max_age_ms: nil,
39
53
  # Optional timeout in milliseconds for the request. Maximum allowed value is
40
54
  # 300000ms (5 minutes).
41
55
  timeout_ms: nil,
@@ -47,6 +61,7 @@ module ContextDev
47
61
  override.returns(
48
62
  {
49
63
  url: String,
64
+ max_age_ms: Integer,
50
65
  timeout_ms: Integer,
51
66
  request_options: ContextDev::RequestOptions
52
67
  }
@@ -76,6 +76,15 @@ module ContextDev
76
76
  sig { returns(String) }
77
77
  attr_accessor :domain
78
78
 
79
+ # Return a cached result if a prior scrape for the same parameters exists and is
80
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
81
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
82
+ sig { returns(T.nilable(Integer)) }
83
+ attr_reader :max_age_ms
84
+
85
+ sig { params(max_age_ms: Integer).void }
86
+ attr_writer :max_age_ms
87
+
79
88
  # Maximum number of products to extract.
80
89
  sig { returns(T.nilable(Integer)) }
81
90
  attr_reader :max_products
@@ -94,6 +103,7 @@ module ContextDev
94
103
  sig do
95
104
  params(
96
105
  domain: String,
106
+ max_age_ms: Integer,
97
107
  max_products: Integer,
98
108
  timeout_ms: Integer
99
109
  ).returns(T.attached_class)
@@ -101,6 +111,10 @@ module ContextDev
101
111
  def self.new(
102
112
  # The domain name to analyze.
103
113
  domain:,
114
+ # Return a cached result if a prior scrape for the same parameters exists and is
115
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
116
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
117
+ max_age_ms: nil,
104
118
  # Maximum number of products to extract.
105
119
  max_products: nil,
106
120
  # Optional timeout in milliseconds for the request. Maximum allowed value is
@@ -111,7 +125,12 @@ module ContextDev
111
125
 
112
126
  sig do
113
127
  override.returns(
114
- { domain: String, max_products: Integer, timeout_ms: Integer }
128
+ {
129
+ domain: String,
130
+ max_age_ms: Integer,
131
+ max_products: Integer,
132
+ timeout_ms: Integer
133
+ }
115
134
  )
116
135
  end
117
136
  def to_hash
@@ -132,6 +151,15 @@ module ContextDev
132
151
  sig { returns(String) }
133
152
  attr_accessor :direct_url
134
153
 
154
+ # Return a cached result if a prior scrape for the same parameters exists and is
155
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
156
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
157
+ sig { returns(T.nilable(Integer)) }
158
+ attr_reader :max_age_ms
159
+
160
+ sig { params(max_age_ms: Integer).void }
161
+ attr_writer :max_age_ms
162
+
135
163
  # Maximum number of products to extract.
136
164
  sig { returns(T.nilable(Integer)) }
137
165
  attr_reader :max_products
@@ -150,6 +178,7 @@ module ContextDev
150
178
  sig do
151
179
  params(
152
180
  direct_url: String,
181
+ max_age_ms: Integer,
153
182
  max_products: Integer,
154
183
  timeout_ms: Integer
155
184
  ).returns(T.attached_class)
@@ -158,6 +187,10 @@ module ContextDev
158
187
  # A specific URL to use directly as the starting point for extraction without
159
188
  # domain resolution.
160
189
  direct_url:,
190
+ # Return a cached result if a prior scrape for the same parameters exists and is
191
+ # younger than this many milliseconds. Defaults to 7 days (604800000 ms) when
192
+ # omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.
193
+ max_age_ms: nil,
161
194
  # Maximum number of products to extract.
162
195
  max_products: nil,
163
196
  # Optional timeout in milliseconds for the request. Maximum allowed value is
@@ -168,7 +201,12 @@ module ContextDev
168
201
 
169
202
  sig do
170
203
  override.returns(
171
- { direct_url: String, max_products: Integer, timeout_ms: Integer }
204
+ {
205
+ direct_url: String,
206
+ max_age_ms: Integer,
207
+ max_products: Integer,
208
+ timeout_ms: Integer
209
+ }
172
210
  )
173
211
  end
174
212
  def to_hash