hugs 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ pkg/
2
+ .bundle/
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm ruby-1.9.2-p0@hugs
1
+ rvm ruby-1.9.2-p136@hugs
data/Gemfile CHANGED
@@ -1,13 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "yajl-ruby", "~> 0.7.8"
4
- gem "nokogiri", "~> 1.4.4"
5
- gem "net-http-persistent", "~> 1.4.1"
6
- gem "multipart-post", "~> 1.0.1"
7
-
8
- group :development, :test do
9
- gem "rake"
10
- gem "jeweler", "~> 1.5.1"
11
- gem "minitest", "~> 2.0.0"
12
- gem "webmock", "1.6.1"
13
- end
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,13 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hugs (2.3.0)
5
+ multipart-post (~> 1.0.1)
6
+ net-http-persistent (~> 1.4.1)
7
+ nokogiri (~> 1.4.4)
8
+ yajl-ruby (~> 0.7.9)
9
+
1
10
  GEM
2
11
  remote: http://rubygems.org/
3
12
  specs:
4
13
  addressable (2.2.2)
5
14
  crack (0.1.8)
6
- git (1.2.5)
7
- jeweler (1.5.2)
8
- bundler (~> 1.0.0)
9
- git (>= 1.2.5)
10
- rake
11
15
  minitest (2.0.2)
12
16
  multipart-post (1.0.1)
13
17
  net-http-persistent (1.4.1)
@@ -16,17 +20,13 @@ GEM
16
20
  webmock (1.6.1)
17
21
  addressable (>= 2.2.2)
18
22
  crack (>= 0.1.7)
19
- yajl-ruby (0.7.8)
23
+ yajl-ruby (0.7.9)
20
24
 
21
25
  PLATFORMS
22
26
  ruby
23
27
 
24
28
  DEPENDENCIES
25
- jeweler (~> 1.5.1)
26
- minitest (~> 2.0.0)
27
- multipart-post (~> 1.0.1)
28
- net-http-persistent (~> 1.4.1)
29
- nokogiri (~> 1.4.4)
29
+ hugs!
30
+ minitest
30
31
  rake
31
- webmock (= 1.6.1)
32
- yajl-ruby (~> 0.7.8)
32
+ webmock
data/README.md CHANGED
@@ -36,4 +36,4 @@ See the 'Examples' section in the [wiki](http://github.com/retr0h/hugs/wiki/).
36
36
 
37
37
  Tests can run offline thanks to [webmock](https://github.com/bblimke/webmock).
38
38
 
39
- $ rake
39
+ $ bundle exec rake
data/Rakefile CHANGED
@@ -1,23 +1,9 @@
1
- require "rubygems"
2
- require "rake"
3
-
4
- begin
5
- require "jeweler"
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "hugs"
8
- gem.summary = %Q{Hugs net-http-persistent with convenient get, delete, post, and put methods.}
9
- gem.email = "john@dewey.ws"
10
- gem.homepage = "http://github.com/retr0h/hugs"
11
- gem.authors = ["retr0h"]
12
- end
13
- Jeweler::GemcutterTasks.new
14
- rescue LoadError
15
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
16
- end
1
+ require "bundler"
2
+ Bundler::GemHelper.install_tasks
17
3
 
18
4
  require "rake/testtask"
19
5
  Rake::TestTask.new(:test) do |test|
20
- test.libs << "lib" << "test"
6
+ test.libs << "./lib" << "./test"
21
7
  test.pattern = "test/**/*_test.rb"
22
8
  test.verbose = true
23
9
  end
data/hugs.gemspec CHANGED
@@ -1,78 +1,29 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "hugs/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{hugs}
8
- s.version = "2.3.0"
6
+ s.name = "hugs"
7
+ s.version = Hugs::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["John Dewey"]
10
+ s.email = ["john@dewey.ws"]
11
+ s.homepage = %q{http://github.com/retr0h/hugs}
12
+ s.summary = %q{Hugs net-http-persistent with convenient get, delete, post, and put methods.}
9
13
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["retr0h"]
12
- s.date = %q{2011-01-13}
13
- s.email = %q{john@dewey.ws}
14
- s.extra_rdoc_files = [
15
- "LICENSE",
16
- "README.md"
17
- ]
18
- s.files = [
19
- ".rvmrc",
20
- "Gemfile",
21
- "Gemfile.lock",
22
- "LICENSE",
23
- "README.md",
24
- "Rakefile",
25
- "VERSION",
26
- "hugs.gemspec",
27
- "lib/hugs.rb",
28
- "lib/hugs/client.rb",
29
- "lib/hugs/errors.rb",
30
- "test/lib/hugs/client_test.rb",
31
- "test/lib/hugs/errors_test.rb",
32
- "test/test_helper.rb"
33
- ]
34
- s.homepage = %q{http://github.com/retr0h/hugs}
14
+ s.rubyforge_project = "hugs"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
35
19
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.3.7}
37
- s.summary = %q{Hugs net-http-persistent with convenient get, delete, post, and put methods.}
38
- s.test_files = [
39
- "test/lib/hugs/client_test.rb",
40
- "test/lib/hugs/errors_test.rb",
41
- "test/test_helper.rb"
42
- ]
43
20
 
44
- if s.respond_to? :specification_version then
45
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
- s.specification_version = 3
21
+ s.add_dependency "yajl-ruby", "~> 0.7.9"
22
+ s.add_dependency "nokogiri", "~> 1.4.4"
23
+ s.add_dependency "net-http-persistent", "~> 1.4.1"
24
+ s.add_dependency "multipart-post", "~> 1.0.1"
47
25
 
48
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
- s.add_runtime_dependency(%q<yajl-ruby>, ["~> 0.7.8"])
50
- s.add_runtime_dependency(%q<nokogiri>, ["~> 1.4.4"])
51
- s.add_runtime_dependency(%q<net-http-persistent>, ["~> 1.4.1"])
52
- s.add_runtime_dependency(%q<multipart-post>, ["~> 1.0.1"])
53
- s.add_development_dependency(%q<rake>, [">= 0"])
54
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
55
- s.add_development_dependency(%q<minitest>, ["~> 2.0.0"])
56
- s.add_development_dependency(%q<webmock>, ["= 1.6.1"])
57
- else
58
- s.add_dependency(%q<yajl-ruby>, ["~> 0.7.8"])
59
- s.add_dependency(%q<nokogiri>, ["~> 1.4.4"])
60
- s.add_dependency(%q<net-http-persistent>, ["~> 1.4.1"])
61
- s.add_dependency(%q<multipart-post>, ["~> 1.0.1"])
62
- s.add_dependency(%q<rake>, [">= 0"])
63
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
64
- s.add_dependency(%q<minitest>, ["~> 2.0.0"])
65
- s.add_dependency(%q<webmock>, ["= 1.6.1"])
66
- end
67
- else
68
- s.add_dependency(%q<yajl-ruby>, ["~> 0.7.8"])
69
- s.add_dependency(%q<nokogiri>, ["~> 1.4.4"])
70
- s.add_dependency(%q<net-http-persistent>, ["~> 1.4.1"])
71
- s.add_dependency(%q<multipart-post>, ["~> 1.0.1"])
72
- s.add_dependency(%q<rake>, [">= 0"])
73
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
74
- s.add_dependency(%q<minitest>, ["~> 2.0.0"])
75
- s.add_dependency(%q<webmock>, ["= 1.6.1"])
76
- end
26
+ s.add_development_dependency "rake"
27
+ s.add_development_dependency "webmock"
28
+ s.add_development_dependency "minitest"
77
29
  end
78
-
data/lib/hugs/client.rb CHANGED
@@ -1,10 +1,15 @@
1
- %w(hugs/errors net/http/persistent net/http/post/multipart yajl nokogiri).each { |r| require r }
1
+ require "hugs/errors"
2
+
3
+ require "net/http/persistent"
4
+ require "net/http/post/multipart"
5
+ require "nokogiri"
6
+ require "yajl"
2
7
 
3
8
  module Hugs
4
9
  class Client
5
10
  attr_accessor :headers
6
- attr_accessor :raise_4xx, :raise_5xx
7
- attr_writer :raise_4xx, :raise_5xx
11
+ attr_accessor :raise_4xx, :raise_5xx, :debug
12
+ attr_writer :raise_4xx, :raise_5xx, :debug
8
13
 
9
14
  Headers = {
10
15
  :json => "application/json",
@@ -79,6 +84,7 @@ module Hugs
79
84
  upload = params[:upload] && params.delete(:upload)
80
85
 
81
86
  @http ||= Net::HTTP::Persistent.new
87
+ @http.debug_output = $stdout if debug
82
88
  @url ||= URI.parse "#{@scheme}://#{@host}:#{@port}"
83
89
 
84
90
  full_path = path_with_query path, query
@@ -0,0 +1,3 @@
1
+ module Hugs
2
+ VERSION = "2.4.0"
3
+ end
@@ -1,232 +1,254 @@
1
- %w(test_helper base64).each { |r| require r }
1
+ require "test_helper"
2
+
3
+ require "base64"
2
4
 
3
5
  describe Hugs::Client do
4
6
  before do
5
7
  @instance = Hugs::Client.new valid_options
8
+ @request = Net::HTTP::Get
6
9
 
7
10
  WebMock.reset!
8
11
  end
9
12
 
10
- describe "#response_for" do
11
- before do
12
- @request = Net::HTTP::Get
13
- end
14
-
15
- describe "path" do
16
- it "is valid" do
17
- stub_request :get, url
13
+ describe "path" do
14
+ it "is valid" do
15
+ stub_request :get, url
18
16
 
19
- @instance.send :response_for, @request, "/", {}
17
+ @instance.send :response_for, @request, "/", {}
20
18
 
21
- assert_requested :get, url
22
- end
19
+ assert_requested :get, url
20
+ end
23
21
 
24
- it "is valid when an invalid :query is supplied" do
25
- stub_request :get, url
22
+ it "is valid when an invalid :query is supplied" do
23
+ stub_request :get, url
26
24
 
27
- @instance.send :response_for, @request, "/", :query => nil
25
+ @instance.send :response_for, @request, "/", :query => nil
28
26
 
29
- assert_requested :get, url
30
- end
27
+ assert_requested :get, url
28
+ end
31
29
 
32
- it "also has a query string" do
33
- stub_request(:get, url).with:query => {"foo" => "bar"}
30
+ it "also has a query string" do
31
+ stub_request(:get, url).with:query => {"foo" => "bar"}
34
32
 
35
- @instance.send :response_for, @request, "/", :query => "foo=bar"
33
+ @instance.send :response_for, @request, "/", :query => "foo=bar"
36
34
 
37
- assert_requested :get, url, :query => {"foo" => "bar"}
38
- end
35
+ assert_requested :get, url, :query => {"foo" => "bar"}
39
36
  end
37
+ end
40
38
 
41
- describe "multi-part" do
42
- Content_Type_Matcher = %r{multipart/form-data}
39
+ describe "multi-part" do
40
+ Content_Type_Matcher = %r{multipart/form-data}
43
41
 
44
- before do
45
- @request = Net::HTTP::Post
46
- end
42
+ before do
43
+ @request = Net::HTTP::Post
44
+ end
47
45
 
48
- it "uploads a file" do
49
- stub_request :post, url
50
- upload = {
51
- :upload => {
52
- :parts => { :file => "/dev/null" },
53
- :content_type => "type/subtype"
54
- }
46
+ it "uploads a file" do
47
+ stub_request :post, url
48
+ upload = {
49
+ :upload => {
50
+ :parts => { :file => "/dev/null" },
51
+ :content_type => "type/subtype"
55
52
  }
53
+ }
56
54
 
57
- @instance.send :response_for, @request, "/", upload
55
+ @instance.send :response_for, @request, "/", upload
58
56
 
59
- assert_requested :post, url, :body => %r{Content-Type: type/subtype}, :headers => {
60
- "Content-Type" => Content_Type_Matcher
61
- }
62
- end
57
+ assert_requested :post, url, :body => %r{Content-Type: type/subtype}, :headers => {
58
+ "Content-Type" => Content_Type_Matcher
59
+ }
60
+ end
63
61
 
64
- it "has parts" do
65
- stub_request :post, url
66
- upload = {
67
- :upload => {
68
- :parts => { :foo => :bar, :baz => :xyzzy },
69
- :content_type => "foo/bar"
70
- }
62
+ it "has parts" do
63
+ stub_request :post, url
64
+ upload = {
65
+ :upload => {
66
+ :parts => { :foo => :bar, :baz => :xyzzy },
67
+ :content_type => "foo/bar"
71
68
  }
69
+ }
72
70
 
73
- @instance.send :response_for, @request, "/", upload
71
+ @instance.send :response_for, @request, "/", upload
74
72
 
75
- ### wtf can't use mx together.
76
- content_disposition_matcher = %r{^Content-Disposition: form-data; name="foo".*^bar.*^Content-Disposition: form-data; name="baz".*^xyzzy.*}m
77
- assert_requested :post, url, :body => content_disposition_matcher, :headers => {
78
- "Content-Type" => Content_Type_Matcher
79
- }
80
- end
73
+ ### wtf can't use mx together.
74
+ content_disposition_matcher = %r{^Content-Disposition: form-data; name="foo".*^bar.*^Content-Disposition: form-data; name="baz".*^xyzzy.*}m
75
+ assert_requested :post, url, :body => content_disposition_matcher, :headers => {
76
+ "Content-Type" => Content_Type_Matcher
77
+ }
81
78
  end
79
+ end
82
80
 
83
- describe "body" do
84
- describe "parses response" do
85
- describe "json" do
86
- it "objectifies and returns a hash" do
87
- stub_request(:get, url).to_return :body => '{"foo":"bar"}'
88
- instance = Hugs::Client.new valid_options(:type => :json)
81
+ describe "body" do
82
+ describe "parses response" do
83
+ describe "json" do
84
+ it "objectifies and returns a hash" do
85
+ stub_request(:get, url).to_return :body => '{"foo":"bar"}'
86
+ instance = Hugs::Client.new valid_options(:type => :json)
89
87
 
90
- response = instance.get "/"
88
+ response = instance.get "/"
91
89
 
92
- response.body.must_be_kind_of Hash
93
- end
90
+ response.body.must_be_kind_of Hash
94
91
  end
92
+ end
95
93
 
96
- describe "xml" do
97
- it "parses and returns a Nokogiri object" do
98
- stub_request(:get, url).to_return :body => "<STORAGE></STORAGE>"
99
- instance = Hugs::Client.new valid_options(:type => :xml)
94
+ describe "xml" do
95
+ it "parses and returns a Nokogiri object" do
96
+ stub_request(:get, url).to_return :body => "<STORAGE></STORAGE>"
97
+ instance = Hugs::Client.new valid_options(:type => :xml)
100
98
 
101
- response = instance.get "/"
99
+ response = instance.get "/"
102
100
 
103
- response.body.must_be_kind_of Nokogiri::XML::Document
104
- end
101
+ response.body.must_be_kind_of Nokogiri::XML::Document
105
102
  end
106
103
  end
104
+ end
107
105
 
108
- describe "encodes request" do
109
- before do
110
- stub_request :get, url
111
- end
106
+ describe "encodes request" do
107
+ before do
108
+ stub_request :get, url
109
+ end
112
110
 
113
- it "is not set when :body invalid" do
114
- @instance.send :response_for, @request, "/", :body => nil
111
+ it "is not set when :body invalid" do
112
+ @instance.send :response_for, @request, "/", :body => nil
115
113
 
116
- assert_requested :get, url, :body => nil
117
- end
114
+ assert_requested :get, url, :body => nil
115
+ end
118
116
 
119
- it "is not set when :body is missing" do
120
- @instance.send :response_for, @request, "/", {}
117
+ it "is not set when :body is missing" do
118
+ @instance.send :response_for, @request, "/", {}
121
119
 
122
- assert_requested :get, url, {}
123
- end
120
+ assert_requested :get, url, {}
121
+ end
124
122
 
125
- describe "json" do
126
- it "is valid" do
127
- instance = Hugs::Client.new valid_options(:type => :json)
123
+ describe "json" do
124
+ it "is valid" do
125
+ instance = Hugs::Client.new valid_options(:type => :json)
128
126
 
129
- instance.send :response_for, @request, "/", :body => {:foo => :bar}
127
+ instance.send :response_for, @request, "/", :body => {:foo => :bar}
130
128
 
131
- assert_requested :get, url, :body => '{"foo":"bar"}'
132
- end
129
+ assert_requested :get, url, :body => '{"foo":"bar"}'
133
130
  end
131
+ end
134
132
 
135
- describe "xml" do
136
- it "is valid" do
137
- instance = Hugs::Client.new valid_options(:type => :xml)
133
+ describe "xml" do
134
+ it "is valid" do
135
+ instance = Hugs::Client.new valid_options(:type => :xml)
138
136
 
139
- instance.send :response_for, @request, "/", :body => "foo bar"
137
+ instance.send :response_for, @request, "/", :body => "foo bar"
140
138
 
141
- assert_requested :get, url, :body => "foo bar"
142
- end
139
+ assert_requested :get, url, :body => "foo bar"
143
140
  end
144
141
  end
145
142
  end
143
+ end
146
144
 
145
+ describe "headers" do
146
+ describe "authentication" do
147
+ it "uses basic auth when providing user and password" do
148
+ stub_request :get, url("/", "user:credentials")
149
+ instance = Hugs::Client.new valid_options(:user => "user", :password => "credentials")
147
150
 
148
- describe "headers" do
149
- describe "authentication" do
150
- it "uses basic auth when providing user and password" do
151
- stub_request :get, url("/", "user:credentials")
152
- instance = Hugs::Client.new valid_options(:user => "user", :password => "credentials")
153
-
154
- instance.send :response_for, @request, "/", {}
155
- assert_requested :get, url("/", "user:credentials")
156
- end
151
+ instance.send :response_for, @request, "/", {}
152
+ assert_requested :get, url("/", "user:credentials")
153
+ end
157
154
 
158
- it "doesn't use basic auth without a user" do
159
- assert_doesnt_use_basic_auth_without :user
160
- end
155
+ it "doesn't use basic auth without a user" do
156
+ assert_doesnt_use_basic_auth_without :user
157
+ end
161
158
 
162
- it "doesn't use basic auth without a password" do
163
- assert_doesnt_use_basic_auth_without :password
164
- end
159
+ it "doesn't use basic auth without a password" do
160
+ assert_doesnt_use_basic_auth_without :password
165
161
  end
162
+ end
166
163
 
167
- describe "JSON" do
168
- it "supports json GET" do
169
- assert_supports_http_verb :json, :get
170
- end
164
+ describe "JSON" do
165
+ it "supports json GET" do
166
+ assert_supports_http_verb :json, :get
167
+ end
171
168
 
172
- it "supports json DELETE" do
173
- assert_supports_http_verb :json, :delete
174
- end
169
+ it "supports json DELETE" do
170
+ assert_supports_http_verb :json, :delete
171
+ end
175
172
 
176
- it "supports json POST" do
177
- assert_supports_http_verb :json, :post
178
- end
173
+ it "supports json POST" do
174
+ assert_supports_http_verb :json, :post
175
+ end
179
176
 
180
- it "supports json PUT" do
181
- assert_supports_http_verb :json, :put
182
- end
177
+ it "supports json PUT" do
178
+ assert_supports_http_verb :json, :put
183
179
  end
180
+ end
184
181
 
185
- describe "XML" do
186
- it "supports xml GET" do
187
- assert_supports_http_verb :xml, :get
188
- end
182
+ describe "XML" do
183
+ it "supports xml GET" do
184
+ assert_supports_http_verb :xml, :get
185
+ end
189
186
 
190
- it "supports xml DELETE" do
191
- assert_supports_http_verb :xml, :delete
192
- end
187
+ it "supports xml DELETE" do
188
+ assert_supports_http_verb :xml, :delete
189
+ end
193
190
 
194
- it "supports xml POST" do
195
- assert_supports_http_verb :xml, :post
196
- end
191
+ it "supports xml POST" do
192
+ assert_supports_http_verb :xml, :post
193
+ end
197
194
 
198
- it "supports xml PUT" do
199
- assert_supports_http_verb :xml, :put
200
- end
195
+ it "supports xml PUT" do
196
+ assert_supports_http_verb :xml, :put
201
197
  end
202
198
  end
199
+ end
203
200
 
204
- def assert_supports_http_verb type, verb
205
- mimetype = {:xml => 'application/xml',
206
- :json => 'application/json'}[type]
201
+ describe "debug_output" do
202
+ before do
203
+ @instance = Hugs::Client.new valid_options(
204
+ :host => "gist.github.com",
205
+ :port => "80"
206
+ )
207
207
 
208
- assert mimetype, "Unsupported Mimetype '#{type}'"
208
+ WebMock.allow_net_connect!
209
+ end
209
210
 
210
- clazz = Net::HTTP.const_get verb.capitalize
211
+ it "outputs net/http debug data" do
212
+ @instance.debug = true
211
213
 
212
- stub_request verb, url
213
- instance = Hugs::Client.new valid_options(:type => type)
214
+ out, err = capture_io { @instance.send :response_for, Net::HTTP::Get, "/api/v1/json/374130", {} }
214
215
 
215
- instance.send :response_for, clazz, "/", {}
216
+ out.wont_be_empty
217
+ end
216
218
 
217
- headers = { "Accept" => ["*/*", mimetype] }
218
- headers["Content-Type"] = mimetype if [:put, :put].include? type
219
+ it "does not output net/http debug data" do
220
+ out, err = capture_io { @instance.send :response_for, Net::HTTP::Get, "/api/v1/json/374130", {} }
219
221
 
220
- assert_requested verb, url, :headers => headers
222
+ out.must_be_empty
221
223
  end
224
+ end
222
225
 
223
- def assert_doesnt_use_basic_auth_without option
224
- stub_request :get, url
225
- instance = Hugs::Client.new valid_options(option => "value")
226
226
 
227
- instance.send :response_for, @request, "/", {}
227
+ def assert_supports_http_verb type, verb
228
+ mimetype = {:xml => 'application/xml',
229
+ :json => 'application/json'}[type]
228
230
 
229
- assert_requested :get, url
230
- end
231
+ assert mimetype, "Unsupported Mimetype '#{type}'"
232
+
233
+ clazz = Net::HTTP.const_get verb.capitalize
234
+
235
+ stub_request verb, url
236
+ instance = Hugs::Client.new valid_options(:type => type)
237
+
238
+ instance.send :response_for, clazz, "/", {}
239
+
240
+ headers = { "Accept" => ["*/*", mimetype] }
241
+ headers["Content-Type"] = mimetype if [:put, :put].include? type
242
+
243
+ assert_requested verb, url, :headers => headers
244
+ end
245
+
246
+ def assert_doesnt_use_basic_auth_without option
247
+ stub_request :get, url
248
+ instance = Hugs::Client.new valid_options(option => "value")
249
+
250
+ instance.send :response_for, @request, "/", {}
251
+
252
+ assert_requested :get, url
231
253
  end
232
254
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,10 @@
1
- require "bundler"
2
1
  Bundler.setup :default, :test
3
2
 
4
- %w(minitest/spec webmock ./lib/hugs uri).each { |r| require r }
3
+ require "hugs"
4
+
5
+ require "minitest/spec"
6
+ require "uri"
7
+ require "webmock"
5
8
 
6
9
  class MiniTest::Unit::TestCase
7
10
  include WebMock::API
@@ -10,12 +13,12 @@ class MiniTest::Unit::TestCase
10
13
  {
11
14
  :host => "example.com",
12
15
  :port => 80,
13
- :scheme => "https"
16
+ :scheme => "http"
14
17
  }.merge opts
15
18
  end
16
19
 
17
20
  def url path = "/", credentials = nil
18
- URI::HTTPS.build(
21
+ URI::HTTP.build(
19
22
  valid_options(
20
23
  :path => path,
21
24
  :userinfo => credentials
metadata CHANGED
@@ -1,161 +1,117 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hugs
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 2
7
- - 3
8
- - 0
9
- version: 2.3.0
4
+ prerelease:
5
+ version: 2.4.0
10
6
  platform: ruby
11
7
  authors:
12
- - retr0h
8
+ - John Dewey
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-13 00:00:00 -08:00
13
+ date: 2011-02-20 00:00:00 -08:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
21
17
  name: yajl-ruby
18
+ prerelease: false
22
19
  requirement: &id001 !ruby/object:Gem::Requirement
23
20
  none: false
24
21
  requirements:
25
22
  - - ~>
26
23
  - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 7
30
- - 8
31
- version: 0.7.8
24
+ version: 0.7.9
32
25
  type: :runtime
33
- prerelease: false
34
26
  version_requirements: *id001
35
27
  - !ruby/object:Gem::Dependency
36
28
  name: nokogiri
29
+ prerelease: false
37
30
  requirement: &id002 !ruby/object:Gem::Requirement
38
31
  none: false
39
32
  requirements:
40
33
  - - ~>
41
34
  - !ruby/object:Gem::Version
42
- segments:
43
- - 1
44
- - 4
45
- - 4
46
35
  version: 1.4.4
47
36
  type: :runtime
48
- prerelease: false
49
37
  version_requirements: *id002
50
38
  - !ruby/object:Gem::Dependency
51
39
  name: net-http-persistent
40
+ prerelease: false
52
41
  requirement: &id003 !ruby/object:Gem::Requirement
53
42
  none: false
54
43
  requirements:
55
44
  - - ~>
56
45
  - !ruby/object:Gem::Version
57
- segments:
58
- - 1
59
- - 4
60
- - 1
61
46
  version: 1.4.1
62
47
  type: :runtime
63
- prerelease: false
64
48
  version_requirements: *id003
65
49
  - !ruby/object:Gem::Dependency
66
50
  name: multipart-post
51
+ prerelease: false
67
52
  requirement: &id004 !ruby/object:Gem::Requirement
68
53
  none: false
69
54
  requirements:
70
55
  - - ~>
71
56
  - !ruby/object:Gem::Version
72
- segments:
73
- - 1
74
- - 0
75
- - 1
76
57
  version: 1.0.1
77
58
  type: :runtime
78
- prerelease: false
79
59
  version_requirements: *id004
80
60
  - !ruby/object:Gem::Dependency
81
61
  name: rake
62
+ prerelease: false
82
63
  requirement: &id005 !ruby/object:Gem::Requirement
83
64
  none: false
84
65
  requirements:
85
66
  - - ">="
86
67
  - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
68
  version: "0"
90
69
  type: :development
91
- prerelease: false
92
70
  version_requirements: *id005
93
71
  - !ruby/object:Gem::Dependency
94
- name: jeweler
72
+ name: webmock
73
+ prerelease: false
95
74
  requirement: &id006 !ruby/object:Gem::Requirement
96
75
  none: false
97
76
  requirements:
98
- - - ~>
77
+ - - ">="
99
78
  - !ruby/object:Gem::Version
100
- segments:
101
- - 1
102
- - 5
103
- - 1
104
- version: 1.5.1
79
+ version: "0"
105
80
  type: :development
106
- prerelease: false
107
81
  version_requirements: *id006
108
82
  - !ruby/object:Gem::Dependency
109
83
  name: minitest
84
+ prerelease: false
110
85
  requirement: &id007 !ruby/object:Gem::Requirement
111
86
  none: false
112
87
  requirements:
113
- - - ~>
88
+ - - ">="
114
89
  - !ruby/object:Gem::Version
115
- segments:
116
- - 2
117
- - 0
118
- - 0
119
- version: 2.0.0
90
+ version: "0"
120
91
  type: :development
121
- prerelease: false
122
92
  version_requirements: *id007
123
- - !ruby/object:Gem::Dependency
124
- name: webmock
125
- requirement: &id008 !ruby/object:Gem::Requirement
126
- none: false
127
- requirements:
128
- - - "="
129
- - !ruby/object:Gem::Version
130
- segments:
131
- - 1
132
- - 6
133
- - 1
134
- version: 1.6.1
135
- type: :development
136
- prerelease: false
137
- version_requirements: *id008
138
93
  description:
139
- email: john@dewey.ws
94
+ email:
95
+ - john@dewey.ws
140
96
  executables: []
141
97
 
142
98
  extensions: []
143
99
 
144
- extra_rdoc_files:
145
- - LICENSE
146
- - README.md
100
+ extra_rdoc_files: []
101
+
147
102
  files:
103
+ - .gitignore
148
104
  - .rvmrc
149
105
  - Gemfile
150
106
  - Gemfile.lock
151
107
  - LICENSE
152
108
  - README.md
153
109
  - Rakefile
154
- - VERSION
155
110
  - hugs.gemspec
156
111
  - lib/hugs.rb
157
112
  - lib/hugs/client.rb
158
113
  - lib/hugs/errors.rb
114
+ - lib/hugs/version.rb
159
115
  - test/lib/hugs/client_test.rb
160
116
  - test/lib/hugs/errors_test.rb
161
117
  - test/test_helper.rb
@@ -173,21 +129,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
129
  requirements:
174
130
  - - ">="
175
131
  - !ruby/object:Gem::Version
176
- segments:
177
- - 0
178
132
  version: "0"
179
133
  required_rubygems_version: !ruby/object:Gem::Requirement
180
134
  none: false
181
135
  requirements:
182
136
  - - ">="
183
137
  - !ruby/object:Gem::Version
184
- segments:
185
- - 0
186
138
  version: "0"
187
139
  requirements: []
188
140
 
189
- rubyforge_project:
190
- rubygems_version: 1.3.7
141
+ rubyforge_project: hugs
142
+ rubygems_version: 1.5.0
191
143
  signing_key:
192
144
  specification_version: 3
193
145
  summary: Hugs net-http-persistent with convenient get, delete, post, and put methods.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 2.3.0