web 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,7 @@ module Net
68
68
  response[name] = value
69
69
  end
70
70
  end
71
- response.extend Web::HTTPResponse
71
+ response.extend Web::ReadableHTTPResponse
72
72
  response.instance_variable_set(:@body, web_response.body)
73
73
  response.instance_variable_set(:@read, true)
74
74
  yield response if block_given?
@@ -83,7 +83,7 @@ module Net
83
83
  response.each do |key, value|
84
84
  headers[key] = value
85
85
  end
86
- response.extend Web::HTTPResponse
86
+ response.extend Web::ReadableHTTPResponse
87
87
  web.record response.code.to_i, response.body, headers
88
88
  yield response if block_given?
89
89
  response
data/lib/web/faker.rb CHANGED
@@ -18,7 +18,8 @@ module Web
18
18
  # whether or not this is a key we want
19
19
  def desired?
20
20
  @match = Web.registered.detect do |opt|
21
- opt[:regex] =~ @url && opt[:method] === @method
21
+ opt[:regex] =~ @url &&
22
+ (opt[:method] === @method || opt[:method] == :any)
22
23
  end
23
24
  end
24
25
 
@@ -8,4 +8,15 @@ module Web
8
8
 
9
9
  end
10
10
 
11
+ module ReadableHTTPResponse
12
+
13
+ include HTTPResponse
14
+
15
+ def read_body(dest = nil, &block)
16
+ yield @body if block_given?
17
+ @body
18
+ end
19
+
20
+ end
21
+
11
22
  end
data/lib/web/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Web
2
2
 
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-21 00:00:00.000000000 -04:00
12
+ date: 2011-08-22 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &2153441020 !ruby/object:Gem::Requirement
17
+ requirement: &2154099420 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2153441020
25
+ version_requirements: *2154099420
26
26
  description: web is a library for caching HTTP responses
27
27
  email: john.crepezzi@gmail.com
28
28
  executables: []