sawyer 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6486ef818a2c154d9689334ec7f58ac3c31d7e9
4
- data.tar.gz: ed05b3d65f572314eab8caf2e18ff37d47942e6a
3
+ metadata.gz: dfd4d1232630a874ef6148436ec032cd58ccbcda
4
+ data.tar.gz: 1548f8adc99856f383bc8b3ebc1d6501c2b62d2f
5
5
  SHA512:
6
- metadata.gz: 20e8d49cf6d7c293273694c50219398a9608afdf6ed1bd29d065224f7bdcf7915492ee3a4f97fe9ddfd3fe9938c3e63fad62887cd2247c7c17fee9083cd94764
7
- data.tar.gz: 015da8b80b1851daad32fa3e0679ac9e7f9eb80fa5b96518ffa41714524d7459d20837abc63f4f0463746907d23511128e146683bf5080420db44958139d969b
6
+ metadata.gz: 9507fe98ea69328e2932fde6adce2432d8a2566ed30020f692f98933e7f7d54758fa69663ef322dc3931829cbda6b4f46a202174edf66fdb7bf2cdf99908ac37
7
+ data.tar.gz: 71f6df7b3be49de481986689e0fd210cf46f0b44ad3dd2b7955560b0d66e4e09ae31df0a2f0c2f9972855fc4131325328d4f7fa3b63027d52b9898e74f508792
data/lib/sawyer.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Sawyer
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
 
4
4
  class Error < StandardError; end
5
5
  end
data/lib/sawyer/agent.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'faraday'
2
- require 'uri_template'
2
+ require 'addressable/template'
3
3
 
4
4
  module Sawyer
5
5
  class Agent
@@ -128,9 +128,8 @@ module Sawyer
128
128
  end
129
129
 
130
130
  def expand_url(url, options = nil)
131
- tpl = url.respond_to?(:expand) ? url : URITemplate.new(url.to_s)
132
- expand = tpl.method(:expand)
133
- options ? expand.call(options) : expand.call
131
+ tpl = url.respond_to?(:expand) ? url : Addressable::Template.new(url.to_s)
132
+ tpl.expand(options || {}).to_s
134
133
  end
135
134
 
136
135
  def allow_undefined_methods?
@@ -148,4 +147,3 @@ module Sawyer
148
147
 
149
148
  end
150
149
  end
151
-
@@ -100,10 +100,7 @@ module Sawyer
100
100
  @agent = agent
101
101
  @name = name.to_sym
102
102
  @href = href
103
- begin
104
- @href_template = URITemplate.new(href.to_s)
105
- rescue URITemplate::RFC6570::Invalid => e
106
- end
103
+ @href_template = Addressable::Template.new(href.to_s)
107
104
 
108
105
  methods = nil
109
106
 
@@ -235,8 +232,7 @@ module Sawyer
235
232
 
236
233
  def href(options = nil)
237
234
  return @href if @href_template.nil?
238
- method = @href_template.method(:expand)
239
- options ? method.call(options) : method.call
235
+ @href_template.expand(options || {}).to_s
240
236
  end
241
237
 
242
238
  # Public: Makes an API request with the curent Relation.
@@ -265,4 +261,3 @@ module Sawyer
265
261
  end
266
262
  end
267
263
  end
268
-
data/sawyer.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.licenses = ['MIT']
19
19
 
20
20
  spec.add_dependency 'faraday', ['~> 0.8', '< 0.10']
21
- spec.add_dependency 'uri_template', ['~> 0.5.0']
21
+ spec.add_dependency 'addressable', ['~> 2.3.5']
22
22
 
23
23
  spec.files = %w(Gemfile LICENSE.md README.md Rakefile)
24
24
  spec.files << "#{lib}.gemspec"
@@ -30,4 +30,3 @@ Gem::Specification.new do |spec|
30
30
  git_files = `git ls-files -z 2>#{dev_null}`
31
31
  spec.files &= git_files.split("\0") if $?.success?
32
32
  end
33
-
@@ -25,7 +25,7 @@ module Sawyer
25
25
  assert_equal '/comments', rel.href
26
26
  assert_equal :get, rel.method
27
27
  assert_equal [:get, :post], rel.available_methods.to_a
28
- assert_kind_of URITemplate, rel.href_template
28
+ assert_kind_of Addressable::Template, rel.href_template
29
29
  end
30
30
 
31
31
  def test_builds_rels_from_hash
@@ -42,7 +42,7 @@ module Sawyer
42
42
  assert_equal '/users/1', rel.href
43
43
  assert_equal :get, rel.method
44
44
  assert_equal [:get], rel.available_methods.to_a
45
- assert_kind_of URITemplate, rel.href_template
45
+ assert_kind_of Addressable::Template, rel.href_template
46
46
  end
47
47
 
48
48
  def test_builds_rels_from_hash_index
@@ -59,7 +59,7 @@ module Sawyer
59
59
  assert_equal '/users/1', rel.href
60
60
  assert_equal :get, rel.method
61
61
  assert_equal [:get], rel.available_methods.to_a
62
- assert_kind_of URITemplate, rel.href_template
62
+ assert_kind_of Addressable::Template, rel.href_template
63
63
  end
64
64
 
65
65
  def test_builds_rels_from_nil
@@ -163,4 +163,3 @@ module Sawyer
163
163
  end
164
164
  end
165
165
  end
166
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sawyer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Olson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-18 00:00:00.000000000 Z
12
+ date: 2013-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -32,19 +32,19 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.10'
34
34
  - !ruby/object:Gem::Dependency
35
- name: uri_template
35
+ name: addressable
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 0.5.0
40
+ version: 2.3.5
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.0
47
+ version: 2.3.5
48
48
  description:
49
49
  email: technoweenie@gmail.com
50
50
  executables: []