def object_to_hash(object, keys_case=:underscore)

			# Nil safe
			return nil if object.nil?
			
			# In case of hash, we only normalize the keys values
			return normalize_hash_keys(object, keys_case) if object.is_a?(Hash)
			# In case of array, we make hasheable each element
			return object.collect{ |item| object_to_hash(item, keys_case) } if object.is_a?(Array)
			# In case of number or string, this methods return the object
			return object if object.is_a?(String) || object.is_a?(Numeric)

			hash={}
			object.instance_variables.each do |var| 
				if !object.instance_variable_get(var).nil?
					value = object.instance_variable_get(var)
					hashed_value = case value.class.to_s
						when "Hash" then normalize_hash_keys(value, keys_case)
						when "Array" then value.collect{ |item| object_to_hash(item, keys_case) }
						else value
					end
					hash[get_attribute_key(var, keys_case)] = hashed_value 
				end 
			end
			return hash
		end
def object_to_hash(object, keys_case=:underscore)

			# Nil safe
			return nil if object.nil?
			
			# In case of hash, we only normalize the keys values
			return normalize_hash_keys(object, keys_case) if object.is_a?(Hash)
			# In case of array, we make hasheable each element
			return object.collect{ |item| object_to_hash(item, keys_case) } if object.is_a?(Array)
			# In case of number or string, this methods return the object
			return object if object.is_a?(String) || object.is_a?(Numeric)

			hash={}
			object.instance_variables.each do |var| 
				if !object.instance_variable_get(var).nil?
					value = object.instance_variable_get(var)
					hashed_value = case value.class.to_s
						when "Hash" then normalize_hash_keys(value, keys_case)
						when "Array" then value.collect{ |item| object_to_hash(item, keys_case) }
						else value
					end
					hash[get_attribute_key(var, keys_case)] = hashed_value 
				end 
			end
			return hash
		end
Internal: Internal method to return an object as a SOAP Request alike hash
 If the object is an array, this methods executes object_to_hash for each item.
 If the object is a Hash, this methods normalize the keys according to +keys_case+ and executes object_to_hash for each value
 If the object is a String or Numeric, returns the object

 Author::  asaavedrab@neonline.cl, jlopezn@neonline.cl

 === Parameters
 * +object+    - object instance to be hashed
 * +keys_case+ - specifies the hash keys case, default 'underscore'
 ==== keys_case
 * :camelcase  - CamelCase
 * :underscore - underscore_case

 === Example:
   a=Person.new
   a.to_hash(:underscore)
   # => {'id' => 1, 'full_name' => "John Doe"}

   a=Person.new
   a.to_hash(:camelcase)
   # => {'Id' => 1, 'FullName' => "John Doe"}

   a=[<Person>, <Person>, <Cat>]
   a.to_hash(:underscore)
   # => [{'id' => 1, 'full_name' => "John Doe"}, {'id' => 2, 'full_name' => "Ms Mary"}, {'id' => 3, 'name' => "Mr Whiskers", 'color' => "Gray"}]

 Returns:: Hash