lib/finix.rb in finix-0.11 vs lib/finix.rb in finix-0.12
- old
+ new
@@ -42,20 +42,25 @@
end
def get_href(cls)
href = Finix.hypermedia_registry.key(cls)
href = Finix.hypermedia_registry.key(cls.superclass) if href.nil?
+ if href.nil? # support wrapper module
+ mod = cls.name.split('::').first
+ scls = cls.superclass.superclass.name.split('::').last
+ href = Finix.hypermedia_registry.key(self.instance_eval "#{mod}::#{scls}")
+ end
href
end
def from_hypermedia_registry(href, attributes={})
split_uri = split_the_href(href)
split_uri.reverse!.each do |resource|
cls = Finix.hypermedia_registry[resource]
cls = cls.send :hypermedia_subtype, attributes if not cls.nil? and cls.respond_to?(:hypermedia_subtype)
return cls unless cls.nil?
end
- Finix::UnknownResource
+ Finix::Utils.eval_class self, 'UnknownResource'
end
def get(*args, &block)
self.client.get *args
end
\ No newline at end of file