redirect_follow_get 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/bin/console +2 -5
- data/lib/redirect_follow_get.rb +6 -8
- data/lib/redirect_follow_get/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a831dd9b5e01723a9bf1004b0c7d7a5424b95ab5
|
4
|
+
data.tar.gz: 5e45066b9389e50157be7101b1e9e7ad29746c5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8386e482f4590153095730a8dcdbfbaa08ca58f73ff16d7f571f09455decc51c9487af4d9583a9abb254da0ee56e8913ae52938f89d2dc06c6929e90a30778e0
|
7
|
+
data.tar.gz: 7ceb67ec8742f4bbbb8ec669696b8f88adc9171360f01383f02850d77209e728ce84a686e256d73fd3e71ebdf05747091a38ffb637f95e5007eabcc93ff21ef0
|
data/bin/console
CHANGED
@@ -7,8 +7,5 @@ require "redirect_follow_get"
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
data/lib/redirect_follow_get.rb
CHANGED
@@ -6,18 +6,16 @@ require 'net/http'
|
|
6
6
|
module RedirectFollowGet
|
7
7
|
class TooManyRedirects < StandardError; end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# fallback to Addressable::URI.parse() method.
|
15
|
-
Addressable::URI.parse(url).normalize
|
9
|
+
class << self
|
10
|
+
def parse_url(url)
|
11
|
+
url = Addressable::URI.parse(url).normalize.to_s unless url.ascii_only?
|
12
|
+
URI.parse(url)
|
13
|
+
end
|
16
14
|
end
|
17
15
|
end
|
18
16
|
|
19
17
|
def redirect_follow_get(url, limit: 10)
|
20
|
-
raise RedirectFollowGet::TooManyRedirects, 'too many HTTP redirects'
|
18
|
+
raise RedirectFollowGet::TooManyRedirects, 'too many HTTP redirects' unless limit > 0
|
21
19
|
|
22
20
|
uri = RedirectFollowGet.parse_url(url)
|
23
21
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redirect_follow_get
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshimaru
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|