lib/excon/hypermedia/response.rb in excon-hypermedia-0.5.0 vs lib/excon/hypermedia/response.rb in excon-hypermedia-0.5.1

- old
+ new

@@ -56,22 +56,23 @@ unless (link = resource._links[name]) raise UnknownRelationError, "unknown relation: #{name}" end - options = rel_params(params.first.to_h) + options = rel_params(name, params.first.to_h) link.respond_to?(:to_ary) ? link.map { |l| l.rel(options) } : link.rel(options) end - def rel_params(params) + def rel_params(name, params) params.merge( - hypermedia: true, hcp: (params[:hcp].nil? ? response.data[:hcp] : params[:hcp]), hcp_params: { content_type: response.headers['Content-Type'], - embedded: resource._embedded - } + embedded: resource._embedded.to_h, + relation: name + }, + hypermedia: true ) end end end end