From 3de9b4bfc84ba973aec6492d408e3752eaa3b8e7 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 17 May 2015 23:47:55 +0800 Subject: [PATCH] remove (duplicated) object_to_http_body and object_to_hash from swagger.rb --- .../src/main/resources/ruby/swagger.mustache | 25 ------------------- samples/client/petstore/ruby/lib/swagger.rb | 25 ------------------- 2 files changed, 50 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/ruby/swagger.mustache b/modules/swagger-codegen/src/main/resources/ruby/swagger.mustache index 273d8d343d9..f393330b148 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/swagger.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/swagger.mustache @@ -75,31 +75,6 @@ module Swagger Swagger.configuration.auth_token = response_body['token'] end - # static method to convert object (array, hash, object, etc) to JSON string - # @param model object to be converted into JSON string - # @return string JSON string representation of the object - def self.object_to_http_body model - return if model.nil? - _body = nil - if model.is_a?(Array) - _body = model.map{|m| object_to_hash(m) } - else - _body = object_to_hash(model) - end - _body.to_json - end - - # static method to convert object(non-array) to hash - # @param obj object to be converted into JSON string - # @return string JSON string representation of the object - def self.object_to_hash obj - if obj.respond_to?(:to_hash) - obj.to_hash - else - obj - end - end - end end diff --git a/samples/client/petstore/ruby/lib/swagger.rb b/samples/client/petstore/ruby/lib/swagger.rb index 273d8d343d9..f393330b148 100644 --- a/samples/client/petstore/ruby/lib/swagger.rb +++ b/samples/client/petstore/ruby/lib/swagger.rb @@ -75,31 +75,6 @@ module Swagger Swagger.configuration.auth_token = response_body['token'] end - # static method to convert object (array, hash, object, etc) to JSON string - # @param model object to be converted into JSON string - # @return string JSON string representation of the object - def self.object_to_http_body model - return if model.nil? - _body = nil - if model.is_a?(Array) - _body = model.map{|m| object_to_hash(m) } - else - _body = object_to_hash(model) - end - _body.to_json - end - - # static method to convert object(non-array) to hash - # @param obj object to be converted into JSON string - # @return string JSON string representation of the object - def self.object_to_hash obj - if obj.respond_to?(:to_hash) - obj.to_hash - else - obj - end - end - end end