web_stat 0.4.2 → 0.4.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/web_stat/fetch/fetch_as_web.rb +8 -7
- data/lib/web_stat/version.rb +2 -2
- data/spec/web_stat/fetch_spec.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beb43ff474210a7d97855aa4f0df4c0083b8560302b20debd27ecce87434e6af
|
4
|
+
data.tar.gz: ef3a1f8077801a2e0f55dda383f03bbea94b7fadaf1d83b3bc120582180794ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3408516abee8fb1e422dcbfc29af4c2ad31d0a1a80dc15fdd893073f39408a3e797ce080bc2a28557031d64acd72431b89e82586ded7e1d64f90656c36793e61
|
7
|
+
data.tar.gz: 1003e6bb4d6824ae72e6ada48040b84758dc7002ce7258828f5764ae13224fc0818dc52fda533a2cd58c11c1194f31f807a37ae4e1237adc7d67038a6108dbba
|
data/Gemfile.lock
CHANGED
@@ -5,7 +5,7 @@ module WebStat
|
|
5
5
|
# initialize class
|
6
6
|
# @param [String] url
|
7
7
|
def initialize(url)
|
8
|
-
unless url_valid?(url)
|
8
|
+
unless FetchAsWeb.url_valid?(url)
|
9
9
|
raise WebStat::INVALID_URL, url
|
10
10
|
end
|
11
11
|
@url = original_url(url)
|
@@ -36,11 +36,12 @@ module WebStat
|
|
36
36
|
end
|
37
37
|
@nokogiri = ::Nokogiri::HTML(@html)
|
38
38
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
class << self
|
40
|
+
# Validation url
|
41
|
+
def url_valid?(url)
|
42
|
+
regexp = Regexp.new("^https?://([a-z0-9][a-z0-9\\\-\.]{0,61})\\\.([a-z]{2,})(.*)?$", Regexp::IGNORECASE)
|
43
|
+
regexp.match?(url)
|
44
|
+
end
|
45
|
+
end
|
45
46
|
end
|
46
47
|
end
|
data/lib/web_stat/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module WebStat
|
2
|
-
VERSION = "0.4.
|
3
|
-
end
|
2
|
+
VERSION = "0.4.3"
|
3
|
+
end
|
data/spec/web_stat/fetch_spec.rb
CHANGED
@@ -197,11 +197,11 @@ RSpec.describe WebStat::Fetch do
|
|
197
197
|
end
|
198
198
|
|
199
199
|
it "valid url" do
|
200
|
-
|
201
|
-
expect(
|
202
|
-
expect(
|
203
|
-
expect(
|
204
|
-
expect(
|
205
|
-
expect(
|
200
|
+
expect(WebStat::FetchAsWeb.url_valid?("http://status.aws.amazon.com/#cloudfront_12345")).to be true
|
201
|
+
expect(WebStat::FetchAsWeb.url_valid?("https://findy-code.io?h=NWsZey5UgJ51u&t=omikuji-22")).to be true
|
202
|
+
expect(WebStat::FetchAsWeb.url_valid?("https://www.meetup.com/pro/docker")).to be true
|
203
|
+
expect(WebStat::FetchAsWeb.url_valid?("https://gxyt4.app.goo.gl/Mn64U")).to be true
|
204
|
+
expect(WebStat::FetchAsWeb.url_valid?("https://status.cloud.google.com/incident/cloud-functions/19010")).to be true
|
205
|
+
expect(WebStat::FetchAsWeb.url_valid?("http://g.co/arts/SK1jZHJpT8N1BGaM7")).to be true
|
206
206
|
end
|
207
207
|
end
|