Skip to content

Commit

Permalink
Replace uri_template with addressable library (#141)
Browse files Browse the repository at this point in the history
Replace `uri_template` with `addressable` library
  • Loading branch information
mrcasals authored Jul 8, 2019
2 parents 48faa7d + 8f3ab1c commit 2f701bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [#136](https://github.com/codegram/hyperclient/pull/136): Fix danger warnings for changelog - [@ivoanjo](https://github.com/ivoanjo).
* [#135](https://github.com/codegram/hyperclient/pull/135): Fix validation for empty body responses - [@paulocdf](https://github.com/paulocdf).
* [#139](https://github.com/codegram/hyperclient/pull/139): Test `hyperclient` against newer versions of MRI Ruby, up until 2.6.x - [@mrcasals](https://github.com/mrcasals).
* [#141](https://github.com/codegram/hyperclient/pull/141): Replace `uri_template` with `addressable` library - [@mrcasals](https://github.com/mrcasals).

### 0.9.0 (2018/01/10)

Expand Down
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 2f701bc

Please sign in to comment.