diff --git a/modules/swagger-codegen/src/main/resources/ruby/api.mustache b/modules/swagger-codegen/src/main/resources/ruby/api.mustache index 488bcbeb16..43481184f5 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api.mustache @@ -29,7 +29,7 @@ class {{classname}} }.merge(opts) #resource path - path = "{{path}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}) + path = "{{path}}".sub('{format}','json'){{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s) {{/pathParams}}{{newline}} # pull querystring keys from options diff --git a/samples/client/petstore/ruby/lib/pet_api.rb b/samples/client/petstore/ruby/lib/pet_api.rb index c48cf0c2c0..3e91297a99 100644 --- a/samples/client/petstore/ruby/lib/pet_api.rb +++ b/samples/client/petstore/ruby/lib/pet_api.rb @@ -225,7 +225,7 @@ class PetApi }.merge(opts) #resource path - path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id) + path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s) # pull querystring keys from options @@ -271,7 +271,7 @@ class PetApi }.merge(opts) #resource path - path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id) + path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s) # pull querystring keys from options @@ -316,7 +316,7 @@ class PetApi }.merge(opts) #resource path - path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id) + path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s) # pull querystring keys from options @@ -361,7 +361,7 @@ class PetApi }.merge(opts) #resource path - path = "/pet/{petId}/uploadImage".sub('{format}','json').sub('{' + 'petId' + '}', pet_id) + path = "/pet/{petId}/uploadImage".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s) # pull querystring keys from options diff --git a/samples/client/petstore/ruby/lib/store_api.rb b/samples/client/petstore/ruby/lib/store_api.rb index 2606213ee0..1b355de8df 100644 --- a/samples/client/petstore/ruby/lib/store_api.rb +++ b/samples/client/petstore/ruby/lib/store_api.rb @@ -122,7 +122,7 @@ class StoreApi }.merge(opts) #resource path - path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id) + path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id.to_s) # pull querystring keys from options @@ -164,7 +164,7 @@ class StoreApi }.merge(opts) #resource path - path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id) + path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id.to_s) # pull querystring keys from options diff --git a/samples/client/petstore/ruby/lib/user_api.rb b/samples/client/petstore/ruby/lib/user_api.rb index ffa90a4e8f..efb37d6768 100644 --- a/samples/client/petstore/ruby/lib/user_api.rb +++ b/samples/client/petstore/ruby/lib/user_api.rb @@ -282,7 +282,7 @@ class UserApi }.merge(opts) #resource path - path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username) + path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s) # pull querystring keys from options @@ -326,7 +326,7 @@ class UserApi }.merge(opts) #resource path - path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username) + path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s) # pull querystring keys from options @@ -387,7 +387,7 @@ class UserApi }.merge(opts) #resource path - path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username) + path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s) # pull querystring keys from options diff --git a/samples/client/petstore/ruby/spec/request_spec.rb b/samples/client/petstore/ruby/spec/request_spec.rb index 015f04c7db..61389eddc9 100644 --- a/samples/client/petstore/ruby/spec/request_spec.rb +++ b/samples/client/petstore/ruby/spec/request_spec.rb @@ -73,20 +73,18 @@ describe Swagger::Request do describe "path" do it "accounts for a total absence of format in the path string" do - @request = Swagger::Request.new(:get, "/word.{format}/{word}/entries", @default_params.merge({ + @request = Swagger::Request.new(:get, "/word.{format}/cat/entries", @default_params.merge({ :format => "xml", :params => { - :word => "cat" } })) @request.url.should == "http://petstore.swagger.io/v2/word.xml/cat/entries" end - it "does string substitution on path params" do - @request = Swagger::Request.new(:get, "/word.{format}/{word}/entries", @default_params.merge({ + it "does string substitution (format) on path params" do + @request = Swagger::Request.new(:get, "/word.{format}/cat/entries", @default_params.merge({ :format => "xml", :params => { - :word => "cat" } })) @request.url.should == "http://petstore.swagger.io/v2/word.xml/cat/entries" @@ -123,7 +121,7 @@ describe Swagger::Request do end it "URI encodes the path" do - @request = Swagger::Request.new(:get, "word.{format}/{word}/definitions", @default_params.merge({ + @request = Swagger::Request.new(:get, "word.{format}/bill gates/definitions", @default_params.merge({ :params => { :word => "bill gates" } @@ -200,4 +198,4 @@ describe Swagger::Request do end -end \ No newline at end of file +end