httpadapter 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.0.1
2
+
3
+ * mock adapter set up to use a closure instead
4
+
1
5
  == 1.0.0
2
6
 
3
7
  * rewrite to expose important implementation-specific configuration stuff
data/README.md CHANGED
@@ -7,22 +7,22 @@
7
7
  <dt>License</dt><dd>Apache 2.0</dd>
8
8
  </dl>
9
9
 
10
- # Description
10
+ ## Description
11
11
 
12
12
  A library for translating HTTP request and response objects for various clients
13
13
  into a common representation.
14
14
 
15
- # Reference
15
+ ## Reference
16
16
 
17
17
  - {HTTPAdapter}
18
18
 
19
- # Adapters
19
+ ## Adapters
20
20
 
21
21
  - {HTTPAdapter::NetHTTPAdapter}
22
22
  - {HTTPAdapter::RackAdapter}
23
23
  - {HTTPAdapter::TyphoeusAdapter}
24
24
 
25
- # Example Usage
25
+ ## Example Usage
26
26
 
27
27
  adapter = HTTPAdapter::NetHTTPAdapter.new
28
28
  response = Net::HTTP.start('www.google.com', 80) { |http| http.get('/') }
@@ -43,6 +43,6 @@ into a common representation.
43
43
  # ["<snip>"]
44
44
  # ]
45
45
 
46
- # Install
46
+ ## Install
47
47
 
48
48
  * sudo gem install httpadapter
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'httpadapter/version'
16
17
  require 'httpadapter/connection'
17
18
 
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'httpadapter'
16
17
 
17
18
  module HTTPAdapter
@@ -29,10 +30,8 @@ module HTTPAdapter
29
30
  adapter = Class.new do
30
31
  include HTTPAdapter
31
32
 
32
- @@block = block
33
-
34
- def fetch_resource(*params)
35
- response = @@block.call(*params)
33
+ define_method('fetch_resource') do |*params|
34
+ response = block.call(*params)
36
35
  if response.respond_to?(:each)
37
36
  return response
38
37
  else
@@ -12,12 +12,13 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'httpadapter'
16
17
  require 'httpadapter/connection'
17
18
  require 'net/http'
18
19
  require 'addressable/uri'
19
20
 
20
- module HTTPAdapter #:nodoc:
21
+ module HTTPAdapter
21
22
  class NetHTTPAdapter
22
23
  include HTTPAdapter
23
24
 
@@ -12,13 +12,14 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'httpadapter'
16
17
  require 'rack'
17
18
  require 'rack/request'
18
19
  require 'rack/response'
19
20
  require 'addressable/uri'
20
21
 
21
- module HTTPAdapter #:nodoc:
22
+ module HTTPAdapter
22
23
  class RackAdapter
23
24
  include HTTPAdapter
24
25
 
@@ -12,13 +12,14 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'httpadapter'
16
17
  require 'typhoeus'
17
18
  require 'typhoeus/request'
18
19
  require 'typhoeus/response'
19
20
  require 'addressable/uri'
20
21
 
21
- module HTTPAdapter #:nodoc:
22
+ module HTTPAdapter
22
23
  class TyphoeusAdapter
23
24
  include HTTPAdapter
24
25
 
@@ -11,8 +11,10 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
+ #
14
15
 
15
- module HTTPAdapter #:nodoc:
16
+
17
+ module HTTPAdapter
16
18
  class Connection
17
19
  def initialize(host, port, connection, options={})
18
20
  if !host.respond_to?(:to_str)
@@ -12,13 +12,14 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  # Used to prevent the class/module from being loaded more than once
16
17
  unless defined? HTTPAdapter::VERSION
17
- module HTTPAdapter #:nodoc:
18
- module VERSION #:nodoc:
18
+ module HTTPAdapter
19
+ module VERSION
19
20
  MAJOR = 1
20
21
  MINOR = 0
21
- TINY = 0
22
+ TINY = 1
22
23
 
23
24
  STRING = [MAJOR, MINOR, TINY].join('.')
24
25
  end
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'spec_helper'
16
17
  require 'spec/httpadapter/adapter_type_checking_spec'
17
18
 
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'spec_helper'
16
17
  require 'spec/httpadapter/adapter_type_checking_spec'
17
18
 
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'spec_helper'
16
17
  require 'spec/httpadapter/adapter_type_checking_spec'
17
18
 
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+
15
16
  require 'spec_helper'
16
17
  require 'spec/httpadapter/adapter_type_checking_spec'
17
18
 
@@ -41,6 +41,21 @@ namespace :gem do
41
41
  p.need_zip = true
42
42
  end
43
43
 
44
+ desc "Generates .gemspec file"
45
+ task :gemspec do
46
+ spec_string = GEM_SPEC.to_ruby
47
+
48
+ begin
49
+ Thread.new { eval("$SAFE = 3\n#{spec_string}", binding) }.join
50
+ rescue
51
+ abort "unsafe gemspec: #{$!}"
52
+ else
53
+ File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file|
54
+ file.write spec_string
55
+ end
56
+ end
57
+ end
58
+
44
59
  desc "Show information about the gem"
45
60
  task :debug do
46
61
  puts GEM_SPEC.to_ruby
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpadapter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
5
+ version: 1.0.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Bob Aman
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-03-11 00:00:00 -08:00
19
- default_executable:
13
+ date: 2011-11-16 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: addressable
@@ -26,11 +20,6 @@ dependencies:
26
20
  requirements:
27
21
  - - ~>
28
22
  - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 2
32
- - 2
33
- - 0
34
23
  version: 2.2.0
35
24
  type: :runtime
36
25
  version_requirements: *id001
@@ -42,11 +31,6 @@ dependencies:
42
31
  requirements:
43
32
  - - ~>
44
33
  - !ruby/object:Gem::Version
45
- hash: 57
46
- segments:
47
- - 0
48
- - 8
49
- - 3
50
34
  version: 0.8.3
51
35
  type: :development
52
36
  version_requirements: *id002
@@ -58,11 +42,6 @@ dependencies:
58
42
  requirements:
59
43
  - - ~>
60
44
  - !ruby/object:Gem::Version
61
- hash: 5
62
- segments:
63
- - 1
64
- - 1
65
- - 11
66
45
  version: 1.1.11
67
46
  type: :development
68
47
  version_requirements: *id003
@@ -74,11 +53,6 @@ dependencies:
74
53
  requirements:
75
54
  - - ~>
76
55
  - !ruby/object:Gem::Version
77
- hash: 23
78
- segments:
79
- - 0
80
- - 3
81
- - 2
82
56
  version: 0.3.2
83
57
  type: :development
84
58
  version_requirements: *id004
@@ -90,11 +64,6 @@ dependencies:
90
64
  requirements:
91
65
  - - ~>
92
66
  - !ruby/object:Gem::Version
93
- hash: 23
94
- segments:
95
- - 1
96
- - 1
97
- - 2
98
67
  version: 1.1.2
99
68
  type: :development
100
69
  version_requirements: *id005
@@ -106,11 +75,6 @@ dependencies:
106
75
  requirements:
107
76
  - - ~>
108
77
  - !ruby/object:Gem::Version
109
- hash: 37
110
- segments:
111
- - 0
112
- - 1
113
- - 31
114
78
  version: 0.1.31
115
79
  type: :development
116
80
  version_requirements: *id006
@@ -122,11 +86,6 @@ dependencies:
122
86
  requirements:
123
87
  - - ~>
124
88
  - !ruby/object:Gem::Version
125
- hash: 31
126
- segments:
127
- - 1
128
- - 2
129
- - 0
130
89
  version: 1.2.0
131
90
  type: :development
132
91
  version_requirements: *id007
@@ -170,7 +129,6 @@ files:
170
129
  - LICENSE
171
130
  - Rakefile
172
131
  - README.md
173
- has_rdoc: true
174
132
  homepage: http://httpadapter.rubyforge.org/
175
133
  licenses: []
176
134
 
@@ -185,23 +143,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
143
  requirements:
186
144
  - - ">="
187
145
  - !ruby/object:Gem::Version
188
- hash: 3
189
- segments:
190
- - 0
191
146
  version: "0"
192
147
  required_rubygems_version: !ruby/object:Gem::Requirement
193
148
  none: false
194
149
  requirements:
195
150
  - - ">="
196
151
  - !ruby/object:Gem::Version
197
- hash: 3
198
- segments:
199
- - 0
200
152
  version: "0"
201
153
  requirements: []
202
154
 
203
155
  rubyforge_project: httpadapter
204
- rubygems_version: 1.4.1
156
+ rubygems_version: 1.8.11
205
157
  signing_key:
206
158
  specification_version: 3
207
159
  summary: Package Summary