Class: Nunchaku::Checker
- Inherits:
-
Object
- Object
- Nunchaku::Checker
- Defined in:
- lib/nunchaku/checker.rb
Instance Attribute Summary collapse
-
#checker_uri ⇒ Object
readonly
Returns the value of attribute checker_uri.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(url, options = {}) ⇒ Checker
constructor
A new instance of Checker.
- #messages ⇒ Object
- #raw ⇒ Object
- #warnings ⇒ Object
Constructor Details
#initialize(url, options = {}) ⇒ Checker
Returns a new instance of Checker.
8 9 10 11 12 13 14 |
# File 'lib/nunchaku/checker.rb', line 8 def initialize(url, = {}) = defaults.merge() @url = url @checker_uri = [:checker_uri] @user_agent = [:user_agent] end |
Instance Attribute Details
#checker_uri ⇒ Object (readonly)
Returns the value of attribute checker_uri.
6 7 8 |
# File 'lib/nunchaku/checker.rb', line 6 def checker_uri @checker_uri end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/nunchaku/checker.rb', line 6 def url @url end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
6 7 8 |
# File 'lib/nunchaku/checker.rb', line 6 def user_agent @user_agent end |
Instance Method Details
#errors ⇒ Object
24 25 26 |
# File 'lib/nunchaku/checker.rb', line 24 def errors .select { || .type == 'error' } end |
#messages ⇒ Object
20 21 22 |
# File 'lib/nunchaku/checker.rb', line 20 def @messages ||= raw['messages'].map { || Nunchaku::Message.new() } end |
#raw ⇒ Object
16 17 18 |
# File 'lib/nunchaku/checker.rb', line 16 def raw @raw ||= JSON.parse vnu_request end |
#warnings ⇒ Object
28 29 30 |
# File 'lib/nunchaku/checker.rb', line 28 def warnings .select { || .subtype == 'warning' } end |