Skip to content

Commit

Permalink
Replace uri_template with addressable library
Browse files Browse the repository at this point in the history
`uri_template` was causing some load errors on test and had no new
releases for years, so we'd better use a newer library that does the
same job.
  • Loading branch information
mrcasals committed Jul 8, 2019
1 parent 48faa7d commit 9f8adfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hyperclient.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
gem.add_dependency 'faraday', '>= 0.9.0'
gem.add_dependency 'faraday_middleware'
gem.add_dependency 'faraday_hal_middleware'
gem.add_dependency 'uri_template'
gem.add_dependency 'addressable'
gem.add_dependency 'net-http-digest_auth'
gem.add_dependency 'faraday-digestauth'
end
6 changes: 3 additions & 3 deletions lib/hyperclient/link.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'uri_template'
require 'addressable'

module Hyperclient
# Internal: The Link is used to let a Resource interact with the API.
Expand Down Expand Up @@ -39,7 +39,7 @@ def _expand(uri_variables = {})
# Public: Returns the url of the Link.
def _url
return @link['href'] unless _templated?
@url ||= _uri_template.expand(@uri_variables || {})
@url ||= _uri_template.expand(@uri_variables || {}).to_s
end

# Public: Returns an array of variables from the URITemplate.
Expand Down Expand Up @@ -162,7 +162,7 @@ def to_ary

# Internal: Memoization for a URITemplate instance
def _uri_template
@uri_template ||= URITemplate.new(@link['href'])
@uri_template ||= Addressable::Template.new(@link['href'])
end

def http_method(method, body = nil)
Expand Down

0 comments on commit 9f8adfc

Please sign in to comment.