ruboty-http_status 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/ruboty/http_status/actions/http_status.rb +4 -23
- data/lib/ruboty/http_status/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: 2bf81b097a9a1cf5475d31bbc02eb70f4b0b5206
|
|
4
|
+
data.tar.gz: 97ff7b34ad84f88c4af720bee958f6144004826e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af24dce20d2b1a5c38ffcc4834d2f6943c0e0aaaff2e382ae0e8266684c6857ab7f2a2cdcf3694dc0af21fd56ddd3892bc9f7b7ed6342e83e5e4e7acb858a26f
|
|
7
|
+
data.tar.gz: 651ad51ffc12d923bd36b28e4239aa68f7b0eaffcb27abe185d976f7b0d608add2d60eca114fb63441dd4f0f739d55aded3d005020b0eef96b7fc903c77484a6
|
|
@@ -13,34 +13,15 @@ module Ruboty
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def call
|
|
16
|
-
message.reply(
|
|
16
|
+
message.reply(result)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# If url doesn't exist,
|
|
23
|
-
# httpstatus.es returns 500 Internal Server Error
|
|
24
|
-
if doc == '500'
|
|
25
|
-
"HTTP Status Code #{code} doesn't exist."
|
|
26
|
-
else
|
|
27
|
-
doc.at_xpath(xpath).text
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def xpath
|
|
32
|
-
'//div[@id="wrapper"]/div[@class="header"]/span[@class="status_title"]'
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def parse
|
|
36
|
-
html = open(url) { |f| f.read }
|
|
37
|
-
Nokogiri::HTML.parse(html, nil, nil)
|
|
38
|
-
rescue OpenURI::HTTPError => error
|
|
39
|
-
error.io.status.first
|
|
19
|
+
def result
|
|
20
|
+
`curl -sS #{url}`
|
|
40
21
|
end
|
|
41
22
|
|
|
42
23
|
def url
|
|
43
|
-
"
|
|
24
|
+
"http://httpstat.us/#{code}"
|
|
44
25
|
end
|
|
45
26
|
end
|
|
46
27
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruboty-http_status
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Takahiro OKUMURA
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-11-
|
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ruboty
|