remove (duplicated) object_to_http_body and object_to_hash from swagger.rb

This commit is contained in:
William Cheng 2015-05-17 23:47:55 +08:00
parent 92a2011207
commit 3de9b4bfc8
2 changed files with 0 additions and 50 deletions

View File

@ -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

View File

@ -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