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.6.0"
".": "1.6.1"
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 1.6.1 (2026-04-01)

Full Changelog: [v1.6.0...v1.6.1](https://github.com/OneBusAway/ruby-sdk/compare/v1.6.0...v1.6.1)

### Bug Fixes

* align path encoding with RFC 3986 section 3.3 ([73f0f2d](https://github.com/OneBusAway/ruby-sdk/commit/73f0f2dde7c4d13aab4cf681aa68ecc022dca33b))
* variable name typo ([0bb2581](https://github.com/OneBusAway/ruby-sdk/commit/0bb2581f24d20b6ffff39e630aea058bebb6e668))


### Chores

* **tests:** bump steady to v0.20.1 ([c40fb01](https://github.com/OneBusAway/ruby-sdk/commit/c40fb01c82c735d6ed0a97ea9e9521a83e820199))
* **tests:** bump steady to v0.20.2 ([5e538f6](https://github.com/OneBusAway/ruby-sdk/commit/5e538f6d606d5d01f11e3c1cdec4402b81b02034))

## 1.6.0 (2026-03-29)

Full Changelog: [v1.5.6...v1.6.0](https://github.com/OneBusAway/ruby-sdk/compare/v1.5.6...v1.6.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:
onebusaway-sdk (1.6.0)
onebusaway-sdk (1.6.1)
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 @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "onebusaway-sdk", "~> 1.6.0"
gem "onebusaway-sdk", "~> 1.6.1"
```

<!-- x-release-please-end -->
Expand Down
22 changes: 18 additions & 4 deletions lib/onebusaway_sdk/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 #{OnebusawaySDK::Internal::Type::BaseModel}, got #{data.inspect}"
message = "Expected a #{Hash} or #{OnebusawaySDK::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(OnebusawaySDK::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 OnebusawaySDK::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
2 changes: 1 addition & 1 deletion lib/onebusaway_sdk/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module OnebusawaySDK
VERSION = "1.6.0"
VERSION = "1.6.1"
end
8 changes: 8 additions & 0 deletions rbi/onebusaway_sdk/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,20 @@ module OnebusawaySDK
end
end

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

class << self
# @api private
sig { params(uri: URI::Generic).returns(String) }
def uri_origin(uri)
end

# @api private
sig { params(path: T.any(String, Integer)).returns(String) }
def encode_path(path)
end

# @api private
sig { params(path: T.any(String, T::Array[String])).returns(String) }
def interpolate_path(path)
Expand Down
6 changes: 3 additions & 3 deletions scripts/mock
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}"
# Run steady mock on the given spec
if [ "$1" == "--daemon" ]; then
# Pre-install the package so the download doesn't eat into the startup timeout
npm exec --package=@stdy/cli@0.19.7 -- steady --version
npm exec --package=@stdy/cli@0.20.2 -- steady --version

npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log &
npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log &

# Wait for server to come online via health endpoint (max 30s)
echo -n "Waiting for server"
Expand All @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then

echo
else
npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL"
npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL"
fi
2 changes: 1 addition & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ elif ! steady_is_running ; then
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the steady command:"
echo
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}"
echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.2 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}"
echo

exit 1
Expand Down
4 changes: 4 additions & 0 deletions sig/onebusaway_sdk/internal/util.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ module OnebusawaySDK
-> top?
} -> top?

RFC_3986_NOT_PCHARS: Regexp

def self?.uri_origin: (URI::Generic uri) -> String

def self?.encode_path: (String | Integer path) -> String

def self?.interpolate_path: (String | ::Array[String] path) -> String

def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]]
Expand Down