lib/finix.rb in finix-0.16 vs lib/finix.rb in finix-1.0.0
- old
+ new
@@ -1,8 +1,8 @@
require_relative 'finix/version' unless defined? Finix::VERSION
-require_relative 'finix/client'
-require_relative 'finix/errors'
+require_relative 'finix/client'
+require_relative 'finix/errors'
module Finix
@client = nil
@config = {:root_url => 'https://localhost/processing'}
@@ -41,11 +41,12 @@
def split_the_href(href)
URI.parse(href).path.sub(/\/$/, '').split('/')
end
def get_href(cls)
- href = hypermedia_registry.key(cls)
+ href = (not cls.nil? and not cls.hypermedia_types.nil?) ? cls.hypermedia_types.last : hypermedia_registry.key(cls)
+
sps = cls
while href.nil?
sps = sps.superclass
break if sps.nil?
clss = Finix::Utils.eval_class cls, sps
@@ -63,9 +64,10 @@
Finix::Utils.eval_class self, UnknownResource
end
def find_resource_cls(resource, attributes={})
cls = hypermedia_registry[resource]
+ # cls = hypermedia_registry["__stub__#{resource}"] if cls.nil?
cls = cls.send :hypermedia_subtype, attributes if not cls.nil? and cls.respond_to?(:hypermedia_subtype)
cls
end
def get(*args, &block)
\ No newline at end of file