httpsimple 1.0.2 → 1.0.3
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.
- data/README.md +2 -2
- data/lib/httpsimple.rb +2 -2
- metadata +2 -2
data/README.md
CHANGED
@@ -61,10 +61,10 @@ should accept three arguments:
|
|
61
61
|
|
62
62
|
```Ruby
|
63
63
|
simple = HttpSimple.new
|
64
|
-
simple.
|
64
|
+
simple.handle(200) do |http, req, res|
|
65
65
|
puts res.code # 200
|
66
66
|
end
|
67
|
-
simple.
|
67
|
+
simple.handle(301, 302) do |http, req, res|
|
68
68
|
puts "#{req.path} was redirected to #{res['location']}!"
|
69
69
|
end
|
70
70
|
res = simple.get("http://www.example.com")
|
data/lib/httpsimple.rb
CHANGED
@@ -2,7 +2,7 @@ require 'net/http'
|
|
2
2
|
require 'uri'
|
3
3
|
|
4
4
|
module HttpSimple
|
5
|
-
VERSION='1.0.
|
5
|
+
VERSION='1.0.3'
|
6
6
|
def self.get(url, data=nil, &block)
|
7
7
|
request(url, :get, data, &block)
|
8
8
|
end
|
@@ -46,7 +46,7 @@ module HttpSimple
|
|
46
46
|
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
49
|
+
def handle(*status_codes, &handler)
|
50
50
|
# Add response handle for http status code. ie 200, 302, 400
|
51
51
|
if block_given?
|
52
52
|
status_codes.each { |code| @handlers[code.to_s.to_sym] = handler }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpsimple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! " Simple wrapper around Ruby's net/http library. It supports \n redirects
|
15
15
|
and HTTPS.\n"
|