Class: WebInspector::Request
- Inherits:
-
Object
- Object
- WebInspector::Request
- Defined in:
- lib/web_inspector/request.rb
Instance Method Summary collapse
- #domain ⇒ Object
- #error_message ⇒ Object
- #host ⇒ Object
-
#initialize(url) ⇒ Request
constructor
A new instance of Request.
- #port ⇒ Object
- #scheme ⇒ Object
- #ssl? ⇒ Boolean
- #url ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ Request
Returns a new instance of Request.
7 8 9 |
# File 'lib/web_inspector/request.rb', line 7 def initialize(url) @url = url end |
Instance Method Details
#domain ⇒ Object
19 20 21 |
# File 'lib/web_inspector/request.rb', line 19 def domain suffix_domain end |
#error_message ⇒ Object
41 42 43 44 45 |
# File 'lib/web_inspector/request.rb', line 41 def return nil if valid? 'Invalid URL: Unable to parse the provided URL' end |
#host ⇒ Object
15 16 17 |
# File 'lib/web_inspector/request.rb', line 15 def host uri.host end |
#port ⇒ Object
27 28 29 |
# File 'lib/web_inspector/request.rb', line 27 def port URI(normalized_uri).port end |
#scheme ⇒ Object
23 24 25 |
# File 'lib/web_inspector/request.rb', line 23 def scheme uri.scheme end |
#ssl? ⇒ Boolean
37 38 39 |
# File 'lib/web_inspector/request.rb', line 37 def ssl? scheme == 'https' end |
#url ⇒ Object
11 12 13 |
# File 'lib/web_inspector/request.rb', line 11 def url normalized_uri end |
#valid? ⇒ Boolean
31 32 33 34 35 |
# File 'lib/web_inspector/request.rb', line 31 def valid? !uri.nil? && !uri.host.nil? rescue StandardError false end |