lib/hello_sign/resource/base_resource.rb in hellosign-ruby-sdk-3.0.3 vs lib/hello_sign/resource/base_resource.rb in hellosign-ruby-sdk-3.0.4

- old
+ new

@@ -6,31 +6,29 @@ # # @author [hellosign] # class BaseResource - # # recursively convert hash data into BaseResource. # # @param hash [Hash] data of the resource # @param key [String] (nil) key of the hash, point to where resource data is. If nil then the hash itself # # @return [HelloSign::Resource::BaseResource] a new BaseResource def initialize(hash, key=nil) @raw_data = key ? hash[key] : hash - @data = @raw_data.inject({}) do |data, (key,value)| + @data = @raw_data.inject({}) do |data, (key, value)| data[key.to_s] = if value.is_a? Hash value = BaseResource.new(value) elsif ((value.is_a? Array) && (value[0].is_a? Hash)) value = value.map {|v| BaseResource.new(v)} else value end data end end - # # Magic method, give class dynamic methods based on hash keys. # # If initialized hash has a key which matches the method name, return value of that key.