lib/hyper_resource/adapter/hal_json.rb in hyperresource-0.2.0 vs lib/hyper_resource/adapter/hal_json.rb in hyperresource-0.2.1

- old
+ new

@@ -66,15 +66,21 @@ return unless resp['_links'] rsrc.links = rsrc._hr_response_class::Links.new(rsrc) links = rsrc.links resp['_links'].each do |rel, link_spec| - if link_spec.is_a? Array - links[rel] = link_spec.map do |link| - new_link_from_spec(rsrc, link) + keys = [rel] + if m=rel.match(/.+:(.+)/) + keys << m[1] + end + keys.each do |key| + if link_spec.is_a? Array + links[key] = link_spec.map do |link| + new_link_from_spec(rsrc, link) + end + else + links[key] = new_link_from_spec(rsrc, link_spec) end - else - links[rel] = new_link_from_spec(rsrc, link_spec) end end links._hr_create_methods! end