Skip to content

Commit 04e9cbd

Browse files
committed
Move to protocol-url gem.
1 parent ae2d8d2 commit 04e9cbd

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

async-rest.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
2525
spec.required_ruby_version = ">= 3.2"
2626

2727
spec.add_dependency "async-http", "~> 0.42"
28-
spec.add_dependency "protocol-http", "~> 0.45"
28+
spec.add_dependency "protocol-url", "~> 0.2"
2929
end

lib/async/rest/resource.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
require "async/http/endpoint"
99

1010
require "protocol/http/accept_encoding"
11-
require "protocol/http/reference"
11+
require "protocol/url/reference"
1212

1313
module Async
1414
module REST
@@ -20,9 +20,9 @@ class Resource < ::Protocol::HTTP::Middleware
2020

2121
# Connect to the given endpoint, returning the HTTP client and reference.
2222
# @parameter endpoint [Async::HTTP::Endpoint] used to connect to the remote system and specify the base path.
23-
# @returns [Tuple(Async::HTTP::Client, ::Protocol::HTTP::Reference)] the client and reference.
23+
# @returns [Tuple(Async::HTTP::Client, ::Protocol::URL::Reference)] the client and reference.
2424
def self.connect(endpoint)
25-
reference = ::Protocol::HTTP::Reference.parse(endpoint.path)
25+
reference = ::Protocol::URL::Reference.parse(endpoint.path)
2626

2727
return ::Protocol::HTTP::AcceptEncoding.new(HTTP::Client.new(endpoint)), reference
2828
end
@@ -54,9 +54,9 @@ def self.with(parent, headers: {}, **options)
5454
end
5555

5656
# @parameter delegate [Async::HTTP::Middleware] the delegate that will handle requests.
57-
# @parameter reference [::Protocol::HTTP::Reference] the resource identifier (base request path/parameters).
57+
# @parameter reference [::Protocol::URL::Reference] the resource identifier (base request path/parameters).
5858
# @parameter headers [::Protocol::HTTP::Headers] the default headers that will be supplied with the request.
59-
def initialize(delegate, reference = ::Protocol::HTTP::Reference.parse, headers = ::Protocol::HTTP::Headers.new)
59+
def initialize(delegate, reference = ::Protocol::URL::Reference.parse, headers = ::Protocol::HTTP::Headers.new)
6060
super(delegate)
6161

6262
@reference = reference

lib/async/rest/wrapper/form.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def prepare_request(request, payload)
2929
request.headers["content-type"] = URLEncoded::APPLICATION_FORM_URLENCODED
3030

3131
request.body = ::Protocol::HTTP::Body::Buffered.new([
32-
::Protocol::HTTP::URL.encode(payload)
32+
::Protocol::URL::Encoding.encode(payload)
3333
])
3434
end
3535
end

lib/async/rest/wrapper/url_encoded.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ def prepare_request(request, payload)
3333
request.headers["content-type"] = @content_type
3434

3535
request.body = ::Protocol::HTTP::Body::Buffered.new([
36-
::Protocol::HTTP::URL.encode(payload)
36+
::Protocol::URL::Encoding.encode(payload)
3737
])
3838
end
3939
end
4040

4141
class Parser < ::Protocol::HTTP::Body::Wrapper
4242
def join
43-
::Protocol::HTTP::URL.decode(super, symbolize_keys: true)
43+
::Protocol::URL::Encoding.decode(super, symbolize_keys: true)
4444
end
4545
end
4646

0 commit comments

Comments
 (0)