Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.1.0"
".": "1.2.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 20
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-2ddb6d73ec8831eee4cb4352b85843a1f6f444e48d8be837cfcd118eddd2a63e.yml
openapi_spec_hash: 1163122fba27e56fa5879bc98d32ee14
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-56a21db16ac3a797f86daca01a2ea115a0365db4b2f9d8accdec4f4d3ee2eb83.yml
openapi_spec_hash: bfcef090896da96023c4485a3d69e350
config_hash: 38268bb88fc4dcbb8f2f94dd138b5910
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 1.2.0 (2026-04-03)

Full Changelog: [v1.1.0...v1.2.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.1.0...v1.2.0)

### Features

* **api:** api update ([5f00bc0](https://github.com/context-dot-dev/context-ruby-sdk/commit/5f00bc076f0081065bc274ce9f28cd26a7daa944))


### Bug Fixes

* align path encoding with RFC 3986 section 3.3 ([2c4072d](https://github.com/context-dot-dev/context-ruby-sdk/commit/2c4072df7df531933f5352c611183b1d152e3ec2))
* variable name typo ([10e1853](https://github.com/context-dot-dev/context-ruby-sdk/commit/10e185365b3196732fc5e0649975ab696f80e893))

## 1.1.0 (2026-03-28)

Full Changelog: [v1.0.0...v1.1.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.0.0...v1.1.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
context.dev (1.1.0)
context.dev (1.2.0)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "context.dev", "~> 1.1.0"
gem "context.dev", "~> 1.2.0"
```

<!-- x-release-please-end -->
Expand Down
22 changes: 18 additions & 4 deletions lib/context_dev/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def coerce_hash!(input)
in Hash | nil => coerced
coerced
else
message = "Expected a #{Hash} or #{ContextDev::Internal::Type::BaseModel}, got #{data.inspect}"
message = "Expected a #{Hash} or #{ContextDev::Internal::Type::BaseModel}, got #{input.inspect}"
raise ArgumentError.new(message)
end
end
Expand Down Expand Up @@ -237,6 +237,11 @@ def dig(data, pick, &blk)
end
end

# @type [Regexp]
#
# https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/

class << self
# @api private
#
Expand All @@ -247,6 +252,15 @@ def uri_origin(uri)
"#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
end

# @api private
#
# @param path [String, Integer]
#
# @return [String]
def encode_path(path)
path.to_s.gsub(ContextDev::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
end

# @api private
#
# @param path [String, Array<String>]
Expand All @@ -259,7 +273,7 @@ def interpolate_path(path)
in []
""
in [String => p, *interpolations]
encoded = interpolations.map { ERB::Util.url_encode(_1) }
encoded = interpolations.map { encode_path(_1) }
format(p, *encoded)
end
end
Expand Down Expand Up @@ -576,10 +590,10 @@ def encode_query_params(query)

case val
in ContextDev::FilePart unless val.filename.nil?
filename = ERB::Util.url_encode(val.filename)
filename = encode_path(val.filename)
y << "; filename=\"#{filename}\""
in Pathname | IO
filename = ERB::Util.url_encode(::File.basename(val.to_path))
filename = encode_path(::File.basename(val.to_path))
y << "; filename=\"#{filename}\""
else
end
Expand Down
27 changes: 1 addition & 26 deletions lib/context_dev/models/style_extract_styleguide_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ class StyleExtractStyleguideParams < ContextDev::Internal::Type::BaseModel
# @return [String, nil]
optional :domain, String

# @!attribute prioritize
# Optional parameter to prioritize screenshot capture for styleguide extraction.
# If 'speed', optimizes for faster capture with basic quality. If 'quality',
# optimizes for higher quality with longer wait times. Defaults to 'quality' if
# not provided.
#
# @return [Symbol, ContextDev::Models::StyleExtractStyleguideParams::Prioritize, nil]
optional :prioritize, enum: -> { ContextDev::StyleExtractStyleguideParams::Prioritize }

# @!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
Expand All @@ -38,33 +29,17 @@ class StyleExtractStyleguideParams < ContextDev::Internal::Type::BaseModel
# @return [Integer, nil]
optional :timeout_ms, Integer

# @!method initialize(direct_url: nil, domain: nil, prioritize: nil, timeout_ms: nil, request_options: {})
# @!method initialize(direct_url: nil, domain: nil, timeout_ms: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {ContextDev::Models::StyleExtractStyleguideParams} for more details.
#
# @param direct_url [String] A specific URL to fetch the styleguide from directly, bypassing domain resolutio
#
# @param domain [String] Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
#
# @param prioritize [Symbol, ContextDev::Models::StyleExtractStyleguideParams::Prioritize] Optional parameter to prioritize screenshot capture for styleguide extraction. I
#
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
#
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]

# Optional parameter to prioritize screenshot capture for styleguide extraction.
# If 'speed', optimizes for faster capture with basic quality. If 'quality',
# optimizes for higher quality with longer wait times. Defaults to 'quality' if
# not provided.
module Prioritize
extend ContextDev::Internal::Type::Enum

SPEED = :speed
QUALITY = :quality

# @!method self.values
# @return [Array<Symbol>]
end
end
end
end
Loading
Loading