dm-rest-adapter 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -35,8 +35,7 @@ Spec::Rake::SpecTask.new(:spec) do |t|
35
35
  if File.exists?('spec/spec.opts')
36
36
  t.spec_opts << '--options' << 'spec/spec.opts'
37
37
  end
38
- t.spec_files =
39
- Pathname.glob(Pathname.new(__FILE__).dirname + 'spec/**/*_spec.rb')
38
+ t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
40
39
  end
41
40
 
42
41
  desc "Run all stories"
data/lib/rest_adapter.rb CHANGED
@@ -149,19 +149,35 @@ module DataMapper
149
149
  end
150
150
 
151
151
  def http_put(uri, data = nil)
152
- request { |http| http.put(uri, data, {"Content-Type", "application/xml"}) }
152
+ request do |http|
153
+ request = Net::HTTP::Put.new(uri, data)
154
+ request.basic_auth(@uri[:login], @uri[:password]) unless @uri[:login].blank?
155
+ http.request(request)
156
+ end
153
157
  end
154
158
 
155
159
  def http_post(uri, data)
156
- request { |http| http.post(uri, data, {"Content-Type", "application/xml"}) }
160
+ request do |http|
161
+ request = Net::HTTP::Post.new(uri, data, {"Content-Type", "application/xml"})
162
+ request.basic_auth(@uri[:login], @uri[:password]) unless @uri[:login].blank?
163
+ http.request(request)
164
+ end
157
165
  end
158
166
 
159
167
  def http_get(uri)
160
- request { |http| http.get(uri, {"Content-Type", "application/xml"}) }
168
+ request do |http|
169
+ request = Net::HTTP::Get.new(uri)
170
+ request.basic_auth(@uri[:login], @uri[:password]) unless @uri[:login].blank?
171
+ http.request(request)
172
+ end
161
173
  end
162
174
 
163
175
  def http_delete(uri)
164
- request { |http| http.delete(uri, {"Content-Type", "application/xml"}) }
176
+ request do |http|
177
+ request = Net::HTTP::Delete.new(uri)
178
+ request.basic_auth(@uri[:login], @uri[:password]) unless @uri[:login].blank?
179
+ http.request(request)
180
+ end
165
181
  end
166
182
 
167
183
  def request(&block)
@@ -1,7 +1,7 @@
1
1
  module DataMapper
2
2
  module More
3
3
  class RestAdapter
4
- VERSION = "0.9.5"
4
+ VERSION = "0.9.6"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-rest-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Potomac Ruby Hackers
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-26 00:00:00 -05:00
12
+ date: 2008-10-12 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.5
23
+ version: 0.9.6
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hoe