redirect_follower 0.1.0 → 0.1.1

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.
@@ -5,7 +5,7 @@ out their destination url as well as the body.
5
5
 
6
6
  The code is mostly ripped from John Nunemaker's blog post "Following Redirects with Net/HTTP"
7
7
  (http://railstips.org/blog/archives/2009/03/04/following-redirects-with-nethttp/), but wrapped
8
- into a Rubygem
8
+ into a Rubygem and with automatic resolving
9
9
 
10
10
  Install with:
11
11
 
@@ -28,6 +28,15 @@ Then, either shorthand for the destination url only or for the full response:
28
28
  > redirect.response
29
29
  => # Full response object from Net::HTTP
30
30
 
31
+ Limiting the amount of redirects can be achieved by giving a second parameter to either
32
+ methods:
33
+
34
+ <code>RedirectFollower('http://is.gd/bNZYZ', 2)</code> will only follow two redirects before
35
+ raising <code>RedirectFollower::TooManyRedirects</code>. Same thing for
36
+ <code>RedirectFollower.new('http://is.gd/bNZYZ', 2)</code>. The default amount of redirects
37
+ is 5.
38
+
39
+ You can also check out my introductory blog post at http://colszowka.heroku.com/2010/04/30/redirectfollower-rubygem
31
40
 
32
41
  == Note on Patches/Pull Requests
33
42
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -4,8 +4,8 @@ require 'net/http'
4
4
  # Shorthand for RedirectFollower.new(url).resolve.url - just get the
5
5
  # destination url for given url
6
6
  #
7
- def RedirectFollower(url)
8
- RedirectFollower.new(url).url
7
+ def RedirectFollower(url, limit=5)
8
+ RedirectFollower.new(url, limit).url
9
9
  end
10
10
 
11
11
  #
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{redirect_follower}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Christoph Olszowka"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redirect_follower
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka