Exception: Scimitar::ErrorResponse

Inherits:
StandardError
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/scimitar/error_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#detailObject

Returns the value of attribute detail.



5
6
7
# File 'app/models/scimitar/error_response.rb', line 5

def detail
  @detail
end

#scimTypeObject

Returns the value of attribute scimType.



5
6
7
# File 'app/models/scimitar/error_response.rb', line 5

def scimType
  @scimType
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'app/models/scimitar/error_response.rb', line 5

def status
  @status
end

Instance Method Details

#as_json(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'app/models/scimitar/error_response.rb', line 9

def as_json(options = {})
  data = {
    'schemas': ['urn:ietf:params:scim:api:messages:2.0:Error'],
    'detail': detail,
    'status': "#{status}"
  }

  data['scimType'] = scimType if scimType
  data
end

#messageObject

Originally Scimitar used attribute “detail” for exception text; it was only for JSON responses at the time, but in hindsight was a bad choice. It should have been “message” given inheritance from StandardError, which then works properly with e.g. error reporting services.

The “detail” attribute is still present, for backwards compatibility with any client code that might be using this class.



28
29
30
# File 'app/models/scimitar/error_response.rb', line 28

def message
  self.detail
end