Class: Headhunter::CssValidator::Response
- Inherits:
-
Object
- Object
- Headhunter::CssValidator::Response
- Defined in:
- lib/headhunter/css_validator.rb
Defined Under Namespace
Classes: Error
Instance Method Summary collapse
- #[](key) ⇒ Object
- #errors ⇒ Object
-
#initialize(response = nil) ⇒ Response
constructor
A new instance of Response.
- #uri ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(response = nil) ⇒ Response
Returns a new instance of Response.
82 83 84 |
# File 'lib/headhunter/css_validator.rb', line 82 def initialize(response = nil) @dom = Nokogiri::XML(convert_soap_to_xml(response)) if response end |
Instance Method Details
#[](key) ⇒ Object
86 87 88 |
# File 'lib/headhunter/css_validator.rb', line 86 def [](key) @dom[key] # TODO: still needed? end |
#errors ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/headhunter/css_validator.rb', line 94 def errors @dom.css('errors error').map do |error| Error.new( error.css('line').text.strip.to_i, error.css('message').text.strip[0..-3], errortype: error.css('errortype').text.strip, context: error.css('context').text.strip, errorsubtype: error.css('errorsubtype').text.strip, skippedstring: error.css('skippedstring').text.strip ) end end |
#uri ⇒ Object
106 107 108 |
# File 'lib/headhunter/css_validator.rb', line 106 def uri @dom.css('cssvalidationresponse > uri').text end |
#valid? ⇒ Boolean
90 91 92 |
# File 'lib/headhunter/css_validator.rb', line 90 def valid? @dom.css('validity').text == 'true' end |