Class: Insights::API::Common::ErrorDocument
- Inherits:
-
Object
- Object
- Insights::API::Common::ErrorDocument
- Defined in:
- lib/insights/api/common/error_document.rb
Instance Method Summary collapse
- #add(status = 400, message) ⇒ Object
- #blank? ⇒ Boolean
- #errors ⇒ Object
- #status ⇒ Object
- #to_h ⇒ Object
Instance Method Details
#add(status = 400, message) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/insights/api/common/error_document.rb', line 5 def add(status = 400, ) @status = status = .to_s.encode('UTF-8', :invalid => :replace, :undef => :replace) errors << {"status" => status, "detail" => } self end |
#blank? ⇒ Boolean
20 21 22 |
# File 'lib/insights/api/common/error_document.rb', line 20 def blank? errors.blank? end |
#errors ⇒ Object
12 13 14 |
# File 'lib/insights/api/common/error_document.rb', line 12 def errors @errors ||= [] end |
#status ⇒ Object
16 17 18 |
# File 'lib/insights/api/common/error_document.rb', line 16 def status @status end |
#to_h ⇒ Object
24 25 26 |
# File 'lib/insights/api/common/error_document.rb', line 24 def to_h {"errors" => errors} end |