gateway-http 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/gateway-http.gemspec +3 -3
  3. data/lib/gateway/http.rb +15 -1
  4. metadata +18 -18
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
data/gateway-http.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gateway-http"
8
- s.version = "0.1.2"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron Qian"]
12
- s.date = "2012-02-15"
12
+ s.date = "2012-06-18"
13
13
  s.description = " Gateway wrapper client for Net::HTTP "
14
14
  s.email = "aq1018@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.homepage = "http://github.com/aq1018/gateway-http"
34
34
  s.licenses = ["MIT"]
35
35
  s.require_paths = ["lib"]
36
- s.rubygems_version = "1.8.10"
36
+ s.rubygems_version = "1.8.15"
37
37
  s.summary = "Gateway wrapper client for Net::HTTP"
38
38
 
39
39
  if s.respond_to? :specification_version then
data/lib/gateway/http.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  module Gateway
2
2
  class HTTP < Gateway::Base
3
3
  # purge connection that is stuck in bad state
4
- # PipelineError should never happen in ATTI
5
4
  categorize_error(Net::HTTP::Pipeline::PipelineError, {
6
5
  :as => :retry,
7
6
  :for => :pipeline
@@ -68,6 +67,11 @@ module Gateway
68
67
  address + req.path
69
68
  end
70
69
 
70
+ def head(path, header=nil, opts={})
71
+ req = prepare_request(:head, path, nil, header)
72
+ request(req, opts)
73
+ end
74
+
71
75
  def get(path, header=nil, opts={})
72
76
  req = prepare_request(:get, path, nil, header)
73
77
  request(req, opts)
@@ -137,11 +141,21 @@ module Gateway
137
141
  req.is_a?(Net::HTTP::Post) || req.is_a?(Net::HTTP::Put)
138
142
  end
139
143
 
144
+ def read_timeout
145
+ options[:read_timeout]
146
+ end
147
+
148
+ def open_timeout
149
+ options[:open_timeout]
150
+ end
151
+
140
152
  protected
141
153
 
142
154
  def connect
143
155
  conn = Net::HTTP.new(host, port)
144
156
  conn.use_ssl = use_ssl
157
+ conn.read_timeout = read_timeout if read_timeout
158
+ conn.open_timeout = open_timeout if open_timeout
145
159
  conn
146
160
  end
147
161
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gateway-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-15 00:00:00.000000000 Z
12
+ date: 2012-06-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gateway
16
- requirement: &22209500 !ruby/object:Gem::Requirement
16
+ requirement: &21662820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *22209500
24
+ version_requirements: *21662820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: net-http-pipeline
27
- requirement: &22224720 !ruby/object:Gem::Requirement
27
+ requirement: &21662120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *22224720
35
+ version_requirements: *21662120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &22223400 !ruby/object:Gem::Requirement
38
+ requirement: &21661340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.8.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *22223400
46
+ version_requirements: *21661340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard
49
- requirement: &22222280 !ruby/object:Gem::Requirement
49
+ requirement: &21660660 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.7'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *22222280
57
+ version_requirements: *21660660
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rdoc
60
- requirement: &22221260 !ruby/object:Gem::Requirement
60
+ requirement: &21659960 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.12'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *22221260
68
+ version_requirements: *21659960
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &22219400 !ruby/object:Gem::Requirement
71
+ requirement: &21659280 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *22219400
79
+ version_requirements: *21659280
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &22217700 !ruby/object:Gem::Requirement
82
+ requirement: &21658560 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 1.8.3
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *22217700
90
+ version_requirements: *21658560
91
91
  description: ! ' Gateway wrapper client for Net::HTTP '
92
92
  email: aq1018@gmail.com
93
93
  executables: []
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  segments:
125
125
  - 0
126
- hash: -1390503096420622121
126
+ hash: -4041742029558167106
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  requirements: []
134
134
  rubyforge_project:
135
- rubygems_version: 1.8.10
135
+ rubygems_version: 1.8.15
136
136
  signing_key:
137
137
  specification_version: 3
138
138
  summary: Gateway wrapper client for Net::HTTP