ruboty-http_status 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d37d933ffeacc3ceeb6dff08310b0f7276e6a5f7
4
- data.tar.gz: 119ebb99add1d519cf72e49c82d97fe653450d6d
3
+ metadata.gz: 2bf81b097a9a1cf5475d31bbc02eb70f4b0b5206
4
+ data.tar.gz: 97ff7b34ad84f88c4af720bee958f6144004826e
5
5
  SHA512:
6
- metadata.gz: 2f4cc861d5258967a120e871b2c9c138336c50b5937b4b8568113a6f5746d3f706429e3b106a9137439abd0af4a0ba667d07a3cde1e2356b339dd484b065868d
7
- data.tar.gz: ee17242e4a42e3557443cdba709225321aab66d89f1b7d9af004d043de0eb45f23d718e0fe782237b2540b659c50230295ae75427484d86289fe1b4f564908ab
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(reason_phrase)
16
+ message.reply(result)
17
17
  end
18
18
 
19
- def reason_phrase
20
- doc = parse
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
- "https://httpstatus.com/#{code}"
24
+ "http://httpstat.us/#{code}"
44
25
  end
45
26
  end
46
27
  end
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module HttpStatus
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  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.0
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-16 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty