lib/excon/hypermedia/resource_object.rb in excon-hypermedia-0.4.3 vs lib/excon/hypermedia/resource_object.rb in excon-hypermedia-0.5.0

- old
+ new

@@ -13,18 +13,10 @@ class ResourceObject RESERVED_PROPERTIES = %w(_links _embedded).freeze def initialize(data) @data = data - - _properties.each do |key, value| - key = key.downcase - next unless /[@$"]/ !~ key.to_sym.inspect - - singleton_class.class_eval { attr_reader key } - instance_variable_set("@#{key}", value.respond_to?(:keys) ? Properties.new(value) : value) - end end def _properties @_properties ||= Properties.new(@data.reject { |k, _| RESERVED_PROPERTIES.include?(k) }) end @@ -61,9 +53,13 @@ @_embedded ||= Embedded.new(@data['_embedded']) end def [](key) _properties[key] + end + + def method_missing(method_name, *_) + _properties.send(method_name) end end end end