Skip to content

Commit

Permalink
Fix URI.encode error with newer rubies
Browse files Browse the repository at this point in the history
This updates the client code to remove `URI.encode` usage since it has
been removed from newer rubies. This is accomplished by updating the
swagger-codegen version.

#22
swagger-api/swagger-codegen#10445
  • Loading branch information
jason-o-matic committed May 27, 2021
1 parent 387bad3 commit b33323e
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.14
2.4.19
2 changes: 1 addition & 1 deletion .swagger-revision
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.4.14
v2.4.19
5 changes: 3 additions & 2 deletions docraptor.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand All @@ -25,10 +25,11 @@ Gem::Specification.new do |s|
s.summary = "A wrapper for the DocRaptor HTML to PDF/XLS service."
s.description = "A native client library for the DocRaptor HTML to PDF/XLS service."
s.license = 'MIT'
s.required_ruby_version = ">= 1.9"
s.required_ruby_version = ">= 2.3"

s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
s.add_runtime_dependency 'addressable', '~> 2.3', '>= 2.3.0'

s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
Expand Down
2 changes: 1 addition & 1 deletion lib/docraptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/docraptor/api/doc_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand Down
8 changes: 4 additions & 4 deletions lib/docraptor/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand All @@ -15,7 +15,7 @@
require 'logger'
require 'tempfile'
require 'typhoeus'
require 'uri'
require 'addressable/uri'

module DocRaptor
class ApiClient
Expand Down Expand Up @@ -63,7 +63,7 @@ def call_api(http_method, path, opts = {})
:message => response.return_message)
else
fail ApiError.new(:code => response.code,
:response_headers => response.headers,
:response_headers => response.headers.to_h,
:response_body => response.body),
response.status_message
end
Expand Down Expand Up @@ -266,7 +266,7 @@ def sanitize_filename(filename)
def build_request_url(path)
# Add leading and trailing slashes to path
path = "/#{path}".gsub(/\/+/, '/')
URI.encode(@config.base_url + path)
Addressable::URI.encode(@config.base_url + path)
end

# Builds the HTTP request body
Expand Down
2 changes: 1 addition & 1 deletion lib/docraptor/api_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand Down
6 changes: 3 additions & 3 deletions lib/docraptor/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

require 'uri'
require 'addressable/uri'

module DocRaptor
class Configuration
Expand Down Expand Up @@ -175,7 +175,7 @@ def base_path=(base_path)

def base_url
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
URI.encode(url)
Addressable::URI.encode(url)
end

# Gets API key (with prefix if set).
Expand Down
2 changes: 1 addition & 1 deletion lib/docraptor/models/async_doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/docraptor/models/doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/docraptor/models/doc_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/docraptor/models/prince_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand Down
2 changes: 1 addition & 1 deletion lib/docraptor/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
OpenAPI spec version: 1.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
Swagger Codegen version: 2.4.19
=end

Expand Down

0 comments on commit b33323e

Please sign in to comment.