ruboty-http_status 0.3.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4763a997f0b14ec03b009983b7d060adedc3923d
4
- data.tar.gz: c0eccb16548af21669318470520622570489f74f
3
+ metadata.gz: 4de93532a0547334aeafc3a92085d1cb6790fa46
4
+ data.tar.gz: 536359e3da0b81368d214bf891f6e682b29f02ed
5
5
  SHA512:
6
- metadata.gz: 2befb5dbbf4ebd1c78c6b4e0e2fbbd57c940de07ecd0a4f8bd78d2c8b519e088e18bcd0cd658bff57676c0704d8f041d31f2cc5701559cad0ef8a61103650f6f
7
- data.tar.gz: eb9ac85f3176a914a90db351cc2261b210b6b284c3848d68e3ee32e69780ff7f4993ca364f9a12ce6f50dbebf88780d10cc76d93d50b256f14d4129b4f6d5c48
6
+ metadata.gz: 44cd148a612d4b5038f3e1dd0b33e08b08635dc7c70fb4fad5d647b172a483b399d88ada645119a1e4af891ab9514e2025e5d6bfdf92117e75e758f0ce62565e
7
+ data.tar.gz: 30c6a580339910b53415ef8105025cf2c9c59f870037eced162828ac2abb7233ce48caa0bde0416767f19848d194be20023c0cb2f72cdf4258196219d11ba964
data/README.md CHANGED
@@ -15,10 +15,17 @@ gem 'ruboty-http_status'
15
15
 
16
16
  ## Usage
17
17
 
18
- ```
18
+ ```rb
19
19
  http <code>
20
20
  ```
21
21
 
22
+ or
23
+
24
+ ```rb
25
+ # bot name
26
+ @ruboty <code>
27
+ ```
28
+
22
29
  ## Contributing
23
30
 
24
31
  1. Fork it ( https://github.com/[my-github-username]/ruboty-http_status/fork )
@@ -1,6 +1,3 @@
1
- require 'nokogiri'
2
- require 'open-uri'
3
-
4
1
  module Ruboty
5
2
  module HttpStatus
6
3
  module Actions
@@ -9,19 +6,88 @@ module Ruboty
9
6
 
10
7
  def initialize(message)
11
8
  @message = message
12
- @code = message[:code]
9
+ @code = message[:code].to_i
13
10
  end
14
11
 
15
12
  def call
16
- message.reply(result)
13
+ message.reply(status[code])
17
14
  end
18
15
 
19
- def result
20
- `curl -sS -I #{url} | head -1 | cut -d' ' -f2-`.chomp
21
- end
16
+ def status
17
+ {
18
+ 100 => 'Continue',
19
+ 101 => 'Switching Protocols',
20
+ 102 => 'Processing (WebDAV)',
21
+
22
+ 200 => 'OK',
23
+ 201 => 'Created',
24
+ 202 => 'Accepted',
25
+ 203 => 'Non-Authoritative Information',
26
+ 204 => 'No Content',
27
+ 205 => 'Reset Content',
28
+ 206 => 'Partial Content',
29
+ 207 => 'Multi-Status (WebDAV)',
30
+ 208 => 'Already Reported (WebDAV)',
31
+ 226 => 'IM Used',
32
+
33
+ 300 => 'Multiple Choices',
34
+ 301 => 'Moved Permanently',
35
+ 302 => 'Found',
36
+ 303 => 'See Other',
37
+ 304 => 'Not Modified',
38
+ 305 => 'Use Proxy',
39
+ 306 => 'Switch Proxy (Unused)',
40
+ 307 => 'Temporary Redirect',
41
+ 308 => 'Permanent Redirect',
42
+
43
+ 400 => 'Bad Request',
44
+ 401 => 'Unauthorized',
45
+ 402 => 'Payment Required',
46
+ 403 => 'Forbidden',
47
+ 404 => 'Not Found',
48
+ 405 => 'Method Not Allowed',
49
+ 406 => 'Not Acceptable',
50
+ 407 => 'Proxy Authentication Required',
51
+ 408 => 'Request Timeout',
52
+ 409 => 'Conflict',
53
+ 410 => 'Gone',
54
+ 411 => 'Length Required',
55
+ 412 => 'Precondition Failed',
56
+ 413 => 'Payload Too Large',
57
+ 414 => 'URI Too Long',
58
+ 415 => 'Unsupported Media Type',
59
+ 416 => 'Range Not Satisfiable',
60
+ 417 => 'Expectation Failed',
61
+ 418 => 'I\'m a teapot',
62
+ 420 => 'Enhance Your Calm (Twitter)',
63
+ 421 => 'Misdirected Request',
64
+ 422 => 'Unprocessable Entity (WebDAV)',
65
+ 423 => 'Locked (WebDAV)',
66
+ 424 => 'Failed Dependency (WebDAV)',
67
+ 426 => 'Upgrade Required',
68
+ 428 => 'Precondition Required',
69
+ 429 => 'Too Many Requests',
70
+ 431 => 'Request Header Fields Too Large',
71
+ 444 => 'No Response (nginx)',
72
+ 451 => 'Unavailable For Legal Reasons',
73
+ 495 => 'SSL Certificate Error (nginx)',
74
+ 496 => 'SSL Certificate Required (nginx)',
75
+ 497 => 'HTTP Request Sent to HTTPS Port (nginx)',
76
+ 499 => 'Client Closed Request (nginx)',
22
77
 
23
- def url
24
- "http://httpstat.us/#{code}"
78
+ 500 => 'Internal Server Error',
79
+ 501 => 'Not Implemented',
80
+ 502 => 'Bad Gateway',
81
+ 503 => 'Service Unavailable',
82
+ 504 => 'Gateway Timeout',
83
+ 505 => 'HTTP Version Not Supported',
84
+ 506 => 'Variant Also Negotiates',
85
+ 507 => 'Insufficient Storage (WebDAV)',
86
+ 508 => 'Loop Detected (WebDAV)',
87
+ 509 => 'Bandwidth Limit Exceeded (Apache)',
88
+ 510 => 'Not Extended',
89
+ 511 => 'Network Authentication Required',
90
+ }
25
91
  end
26
92
  end
27
93
  end
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module HttpStatus
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_runtime_dependency 'ruboty'
23
- spec.add_runtime_dependency 'nokogiri'
24
23
  spec.add_development_dependency 'bundler', '~> 1.9'
25
24
  spec.add_development_dependency 'rake', '~> 10.0'
26
25
  spec.add_development_dependency 'test-unit'
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro OKUMURA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-30 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: nokogiri
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -124,7 +110,6 @@ files:
124
110
  - bin/setup
125
111
  - lib/ruboty/handlers/http_status.rb
126
112
  - lib/ruboty/http_status.rb
127
- - lib/ruboty/http_status/actions/http-status-codes.csv
128
113
  - lib/ruboty/http_status/actions/http_status.rb
129
114
  - lib/ruboty/http_status/version.rb
130
115
  - ruboty-http_status.gemspec
@@ -1,82 +0,0 @@
1
- value,description
2
- 100,Continue
3
- 101,Switching Protocols
4
- 102,Processing
5
- 200,OK
6
- 201,Created
7
- 202,Accepted
8
- 203,Non-Authoritative Information
9
- 204,No Content
10
- 205,Reset Content
11
- 206,Partial Content
12
- 207,Multi-Status
13
- 208,Already Reported
14
- 226,IM Used
15
- 300,Multiple Choices
16
- 301,Moved Permanently
17
- 302,Found
18
- 303,See Other
19
- 304,Not Modified
20
- 305,Use Proxy
21
- 306,Switch Proxy (Unused)
22
- 307,Temporary Redirect
23
- 308,Permanent Redirect
24
- 400,Bad Request
25
- 401,Unauthorized
26
- 402,Payment Required
27
- 403,Forbidden
28
- 404,Not Found
29
- 405,Method Not Allowed
30
- 406,Not Acceptable
31
- 407,Proxy Authentication Required
32
- 408,Request Timeout
33
- 409,Conflict
34
- 410,Gone
35
- 411,Length Required
36
- 412,Precondition Failed
37
- 413,Payload Too Large
38
- 414,URI Too Long
39
- 415,Unsupported Media Type
40
- 416,Range Not Satisfiable
41
- 417,Expectation Failed
42
- 418,I'm a teapot
43
- 419,Authentication Timeout
44
- 420,Method Failure or Enhance Your Calm
45
- 421,Misdirected Request
46
- 422,Unprocessable Entity
47
- 423,Locked
48
- 424,Failed Dependency
49
- 425,Unassigned
50
- 426,Upgrade Required
51
- 427,Unassigned
52
- 428,Precondition Required
53
- 429,Too Many Requests
54
- 430,Unassigned
55
- 431,Request Header Fields Too Large
56
- 440,Login Timeout
57
- 444,No Response
58
- 449,Retry With
59
- 450,Blocked by Windows Parental Controls
60
- 451,Unavailable For Legal Reasons
61
- 451,Redirect
62
- 494,Request Header Too Large
63
- 495,Cert Error
64
- 496,No Cert
65
- 497,HTTP to HTTPS
66
- 498,Token expired/invalid
67
- 499,Client Closed Request
68
- 499,Token required
69
- 500,Internal Server Error
70
- 501,Not Implemented
71
- 502,Bad Gateway
72
- 503,Service Unavailable
73
- 504,Gateway Timeout
74
- 505,HTTP Version Not Supported
75
- 506,Variant Also Negotiates
76
- 507,Insufficient Storage
77
- 508,Loop Detected
78
- 509,Unassigned
79
- 510,Not Extended
80
- 511,Network Authentication Required
81
- 598,Network read timeout error
82
- 599,Network connect timeout error