Class: Continuum::AccessibilityConcern
- Inherits:
-
Object
- Object
- Continuum::AccessibilityConcern
- Defined in:
- src/lib/continuum/accessibility_concern.rb
Overview
This class represents an accessibility concern identified by Access Engine. At minimum, it contains both information about the concern that was identified and well as where on the page the problem is located. It may also include best practice data from AMP, e.g. how severe or noticeable the issue might be, along with an AMP URL that can be visited for more info.
Instance Attribute Summary collapse
-
#attribute ⇒ String
Gets a brief human-readable description of this accessibility concern.
-
#best_practice_description ⇒ String
Gets the name of the best practice that corresponds to this accessibility concern.
-
#best_practice_details_url ⇒ String
Gets the URL of the best practice page in AMP that corresponds to this accessibility concern.
-
#best_practice_id ⇒ Integer
Gets the best practice ID that corresponds to this accessibility concern.
-
#best_practice_standards ⇒ Array<Standard>
Gets the set of accessibility standards associated with the best practice that corresponds to this accessibility concern, ordered alphabetically by name.
-
#element ⇒ String?
Gets the source code of the offending HTML node of this accessibility concern.
-
#engine_test_id ⇒ Integer
Gets the automatic Access Engine test ID that failed and produced this accessibility concern.
-
#fix_type ⇒ FixType
Gets the remediation steps suggested by Access Engine for resolving this accessibility concern.
-
#needs_review ⇒ Boolean
Gets whether or not this accessibility concern requires manual review, i.e.
-
#noticeability ⇒ Integer
Gets the noticeability of this accessibility concern on a scale of 1 to 10, where 1 is the least noticeable and 10 is the most noticeable.
-
#path ⇒ String
Gets a CSS selector to the element with this accessibility concern.
-
#raw_engine_json_object ⇒ Hash
Gets the raw JSON object from Access Engine that was originally used to build this accessibility concern.
-
#severity ⇒ Integer
Gets the severity of this accessibility concern on a scale of 1 to 10, where 1 is the least severe and 10 is the most severe.
-
#tractability ⇒ Integer
Gets the tractability of this accessibility concern on a scale of 1 to 10, where 1 is the least tractable and 10 is the most tractable.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path, engine_test_id, attribute, best_practice_id, element, fix_type, needs_review, raw_engine_json_object, best_practice_description, severity, noticeability, tractability, best_practice_details_url, best_practice_standards) ⇒ AccessibilityConcern
constructor
A new instance of AccessibilityConcern.
Constructor Details
#initialize(path, engine_test_id, attribute, best_practice_id, element, fix_type, needs_review, raw_engine_json_object, best_practice_description, severity, noticeability, tractability, best_practice_details_url, best_practice_standards) ⇒ AccessibilityConcern
Returns a new instance of AccessibilityConcern.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'src/lib/continuum/accessibility_concern.rb', line 122 def initialize(path, engine_test_id, attribute, best_practice_id, element, fix_type, needs_review, raw_engine_json_object, best_practice_description, severity, noticeability, tractability, best_practice_details_url, best_practice_standards) @path = path @engine_test_id = engine_test_id @attribute = attribute @best_practice_id = best_practice_id @element = element @fix_type = fix_type @needs_review = needs_review @raw_engine_json_object = raw_engine_json_object @best_practice_description = best_practice_description @severity = severity @noticeability = noticeability @tractability = tractability @best_practice_details_url = best_practice_details_url @best_practice_standards = best_practice_standards end |
Instance Attribute Details
#attribute ⇒ String
Gets a brief human-readable description of this accessibility concern. Visit the URL returned by #best_practice_details_url for more information.
32 33 34 |
# File 'src/lib/continuum/accessibility_concern.rb', line 32 def attribute @attribute end |
#best_practice_description ⇒ String
Gets the name of the best practice that corresponds to this accessibility concern. Visit the URL returned by #best_practice_details_url for more information.
72 73 74 |
# File 'src/lib/continuum/accessibility_concern.rb', line 72 def best_practice_description @best_practice_description end |
#best_practice_details_url ⇒ String
Gets the URL of the best practice page in AMP that corresponds to this accessibility concern. An AMP license is not required to visit this URL, but if you’re logged into AMP, you’ll be presented with additional information beyond what’s publicly available.
97 98 99 |
# File 'src/lib/continuum/accessibility_concern.rb', line 97 def best_practice_details_url @best_practice_details_url end |
#best_practice_id ⇒ Integer
Gets the best practice ID that corresponds to this accessibility concern. Visit the URL returned by #best_practice_details_url for more information.
38 39 40 |
# File 'src/lib/continuum/accessibility_concern.rb', line 38 def best_practice_id @best_practice_id end |
#best_practice_standards ⇒ Array<Standard>
Gets the set of accessibility standards associated with the best practice that corresponds to this accessibility concern, ordered alphabetically by name. Visit the URL returned by #best_practice_details_url for more information.
105 106 107 |
# File 'src/lib/continuum/accessibility_concern.rb', line 105 def best_practice_standards @best_practice_standards end |
#element ⇒ String?
Gets the source code of the offending HTML node of this accessibility concern. If the presence of an offending element is not applicable to this accessibility concern, this will be nil.
44 45 46 |
# File 'src/lib/continuum/accessibility_concern.rb', line 44 def element @element end |
#engine_test_id ⇒ Integer
Gets the automatic Access Engine test ID that failed and produced this accessibility concern. Visit the URL returned by #best_practice_details_url for more information.
26 27 28 |
# File 'src/lib/continuum/accessibility_concern.rb', line 26 def engine_test_id @engine_test_id end |
#fix_type ⇒ FixType
Gets the remediation steps suggested by Access Engine for resolving this accessibility concern.
49 50 51 |
# File 'src/lib/continuum/accessibility_concern.rb', line 49 def fix_type @fix_type end |
#needs_review ⇒ Boolean
Gets whether or not this accessibility concern requires manual review, i.e. whether the user should manually use AMP to determine whether or not this accessibility concern is actually a legitimate violation given the context of the offending element (See #element). If this returns true, visit the URL returned by #best_practice_details_url for more information on how to manually validate the applicability of this accessibility concern relative to the offending element (#element); it may be that this accessibility concern is not applicable given this context. Accessibility concerns that require manual review will only ever be returned (and thus this function will only ever possibly return false for a given accessibility concern) if Configuration#include_potential_accessibility_concerns returns true.
61 62 63 |
# File 'src/lib/continuum/accessibility_concern.rb', line 61 def needs_review @needs_review end |
#noticeability ⇒ Integer
Gets the noticeability of this accessibility concern on a scale of 1 to 10, where 1 is the least noticeable and 10 is the most noticeable. Visit the URL returned by #best_practice_details_url for more information.
84 85 86 |
# File 'src/lib/continuum/accessibility_concern.rb', line 84 def noticeability @noticeability end |
#path ⇒ String
Gets a CSS selector to the element with this accessibility concern.
20 21 22 |
# File 'src/lib/continuum/accessibility_concern.rb', line 20 def path @path end |
#raw_engine_json_object ⇒ Hash
Gets the raw JSON object from Access Engine that was originally used to build this accessibility concern.
66 67 68 |
# File 'src/lib/continuum/accessibility_concern.rb', line 66 def raw_engine_json_object @raw_engine_json_object end |
#severity ⇒ Integer
Gets the severity of this accessibility concern on a scale of 1 to 10, where 1 is the least severe and 10 is the most severe. Visit the URL returned by #best_practice_details_url for more information.
78 79 80 |
# File 'src/lib/continuum/accessibility_concern.rb', line 78 def severity @severity end |
#tractability ⇒ Integer
Gets the tractability of this accessibility concern on a scale of 1 to 10, where 1 is the least tractable and 10 is the most tractable. Visit the URL returned by #best_practice_details_url for more information.
90 91 92 |
# File 'src/lib/continuum/accessibility_concern.rb', line 90 def tractability @tractability end |
Class Method Details
.from_json(json_data) ⇒ AccessibilityConcern
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'src/lib/continuum/accessibility_concern.rb', line 144 def self.from_json(json_data) parsed = DataUtil.parse_json(json_data) || {} return new( parsed['path'], parsed['engineTestId'].to_i, parsed['attribute'], parsed['bestPracticeId'].to_i, parsed['element'], FixType.from_json(parsed['fixType']), parsed['needsReview'], parsed['rawEngineJsonObject'], parsed['bestPracticeDescription'], parsed['severity'].to_i, parsed['noticeability'].to_i, parsed['tractability'].to_i, parsed['bestPracticeDetailsUrl'], parsed['bestPracticeStandards'].nil? ? nil : parsed['bestPracticeStandards'].map { |standard| Standard.from_json(standard) } ) end |