zephyr 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2da1fdc225a123d196f1f6b320e9b03f3e99da2
4
+ data.tar.gz: ddf77cb8b1997645cf1e67f82fb25ec0d1c83587
5
+ SHA512:
6
+ metadata.gz: 73c4c9e71b6ccd8ff8ffcea565dc7a341eba07f2c2e8f12fb13abe0b5f7a67a80a4e6aa0679331bdba291412f61dcffaaee8074e0eb88e094198d3a82c0bf21d
7
+ data.tar.gz: 6bf7bf3257eef7f2414f15cbd3dac22879ee1d019f10806b0f70d8e0b710c0be2f063c663f7dc0b0dce57e8c50a40a78f301efc7e0950d68104814ca70f36e86
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zephyr (1.2.1)
4
+ zephyr (1.2.2)
5
5
  typhoeus (~> 0.4.2)
6
6
  yajl-ruby
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- ffi (1.2.0)
11
+ ffi (1.7.0)
12
12
  git (1.2.5)
13
13
  jeweler (1.6.4)
14
14
  bundler (~> 1.0)
15
15
  git (>= 1.2.5)
16
16
  rake
17
17
  metaclass (0.0.1)
18
- mime-types (1.19)
18
+ mime-types (1.22)
19
19
  mocha (0.12.0)
20
20
  metaclass (~> 0.0.1)
21
21
  rake (0.9.2.2)
@@ -29,7 +29,7 @@ PLATFORMS
29
29
  ruby
30
30
 
31
31
  DEPENDENCIES
32
- bundler (~> 1.1.0)
32
+ bundler (~> 1.3.0)
33
33
  jeweler (~> 1.6.4)
34
34
  mocha (~> 0.12.0)
35
35
  shoulda (~> 2.11.3)
data/README.md CHANGED
@@ -11,12 +11,14 @@ unfortunate choice of naming our library Http and suddenly fighting with http_pa
11
11
 
12
12
  * Coda Hale
13
13
  * Benjamin Kudria
14
+ * Brian Morton
14
15
  * Jordi Bunster
15
16
  * Matthew Knopp
16
17
  * Mohammed Rafiq
17
18
  * Ryan Kennedy
18
19
  * Vidit Drolia
20
+ * Vivek Aggarwal
19
21
 
20
22
  ### References
21
23
 
22
- * Ruby Riak Client: https://bitbucket.org/basho/riak-ruby-client/src
24
+ * Ruby Riak Client: https://bitbucket.org/basho/riak-ruby-client/src
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -247,6 +247,7 @@ class Zephyr
247
247
  def uri(given_parts = [])
248
248
  @root_uri.dup.tap do |uri|
249
249
  parts = given_parts.dup.unshift(uri.path) # URI#merge is broken.
250
+ uri.query = Zephyr.build_query_string(parts.pop) if parts.last.is_a? Hash
250
251
  uri.path = ('/%s' % parts.join('/')).gsub(/\/+/, '/')
251
252
  end
252
253
  end
@@ -289,7 +290,11 @@ class Zephyr
289
290
  params[:headers] = headers
290
291
  params[:timeout] = timeout
291
292
  params[:follow_location] = false
292
- params[:params] = path_components.pop if path_components.last.is_a?(Hash)
293
+
294
+ if path_components.last.is_a?(Hash) && (!data || data.empty?)
295
+ params[:params] = path_components.pop
296
+ end
297
+
293
298
  params[:method] = method
294
299
 
295
300
  # seriously, why is this on by default
@@ -31,6 +31,27 @@ class TestZephyr < Test::Unit::TestCase
31
31
  zephyr = Zephyr.new
32
32
  assert_equal 'a=1&a=2', Zephyr.build_query_string(:a => [ 2, 1 ])
33
33
  end
34
+
35
+ should "be present when POST and body is present" do
36
+ z = Zephyr.new("http://www.example.com")
37
+ Typhoeus::Request.expects(:run).with do |uri, params|
38
+ params[:method] == :post && !params[:params] &&
39
+ uri == 'http://www.example.com/users/1?something=true' &&
40
+ params[:body] == 'body present'
41
+ end.returns(TYPHOEUS_RESPONSE)
42
+ z.post(200, 1, ["users", 1, {:something => 'true'}], 'body present')
43
+ end
44
+
45
+ should "use form data from path when POST and no body present" do
46
+ z = Zephyr.new("http://www.example.com")
47
+ Typhoeus::Request.expects(:run).with do |uri, params|
48
+ params[:method] == :post &&
49
+ params[:params] == {:something => 'true'}
50
+ uri == 'http://www.example.com/users/1' &&
51
+ !params[:body]
52
+ end.returns(TYPHOEUS_RESPONSE)
53
+ z.post(200, 1, ["users", 1, {:something => 'true'}], '')
54
+ end
34
55
  end
35
56
 
36
57
  context "percent encoding" do
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "zephyr"
5
- s.version = "1.2.1"
5
+ s.version = "1.2.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Matt Knopp"]
@@ -42,21 +42,21 @@ Gem::Specification.new do |s|
42
42
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
43
  s.add_runtime_dependency(%q<typhoeus>, ["~> 0.4.2"])
44
44
  s.add_runtime_dependency(%q<yajl-ruby>, [">= 0"])
45
- s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
45
+ s.add_development_dependency(%q<bundler>, ["~> 1.3.0"])
46
46
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
47
47
  s.add_development_dependency(%q<shoulda>, ["~> 2.11.3"])
48
48
  s.add_development_dependency(%q<mocha>, ["~> 0.12.0"])
49
49
  else
50
50
  s.add_dependency(%q<typhoeus>, ["~> 0.4.2"])
51
51
  s.add_dependency(%q<yajl-ruby>, [">= 0"])
52
- s.add_dependency(%q<bundler>, ["~> 1.1.0"])
52
+ s.add_dependency(%q<bundler>, ["~> 1.3.0"])
53
53
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
54
54
  s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
55
55
  end
56
56
  else
57
57
  s.add_dependency(%q<typhoeus>, ["~> 0.4.2"])
58
58
  s.add_dependency(%q<yajl-ruby>, [">= 0"])
59
- s.add_dependency(%q<bundler>, ["~> 1.1.0"])
59
+ s.add_dependency(%q<bundler>, ["~> 1.3.0"])
60
60
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
61
61
  s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
62
62
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zephyr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
5
- prerelease:
4
+ version: 1.2.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Matt Knopp
@@ -14,7 +13,6 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: typhoeus
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,39 +27,34 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: yajl-ruby
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: 1.1.0
47
+ version: 1.3.0
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
61
- version: 1.1.0
54
+ version: 1.3.0
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: jeweler
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: shoulda
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: mocha
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ~>
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ~>
108
95
  - !ruby/object:Gem::Version
@@ -133,25 +120,24 @@ files:
133
120
  homepage: http://github.com/mhat/zephyr
134
121
  licenses:
135
122
  - MIT
123
+ metadata: {}
136
124
  post_install_message:
137
125
  rdoc_options: []
138
126
  require_paths:
139
127
  - lib
140
128
  required_ruby_version: !ruby/object:Gem::Requirement
141
- none: false
142
129
  requirements:
143
- - - ! '>='
130
+ - - '>='
144
131
  - !ruby/object:Gem::Version
145
132
  version: '0'
146
133
  required_rubygems_version: !ruby/object:Gem::Requirement
147
- none: false
148
134
  requirements:
149
- - - ! '>='
135
+ - - '>='
150
136
  - !ruby/object:Gem::Version
151
137
  version: '0'
152
138
  requirements: []
153
139
  rubyforge_project:
154
- rubygems_version: 1.8.24
140
+ rubygems_version: 2.0.0
155
141
  signing_key:
156
142
  specification_version: 3
157
143
  summary: Battle-tested HTTP client using Typhoeus, derived from the Riak client