Class: InfinumJsonApiSetup::Error::Base
- Inherits:
-
Object
- Object
- InfinumJsonApiSetup::Error::Base
show all
- Defined in:
- lib/infinum_json_api_setup/error.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(object: nil, message: nil) ⇒ Base
Returns a new instance of Base.
13
14
15
16
17
|
# File 'lib/infinum_json_api_setup/error.rb', line 13
def initialize(object: nil, message: nil)
@details =
details_from_object(object) || message || I18n.t("json_api.errors.#{http_status}.detail")
@title = I18n.t("json_api.errors.#{http_status}.title")
end
|
Instance Attribute Details
#details ⇒ String
5
6
7
|
# File 'lib/infinum_json_api_setup/error.rb', line 5
def details
@details
end
|
#title ⇒ String
8
9
10
|
# File 'lib/infinum_json_api_setup/error.rb', line 8
def title
@title
end
|
Instance Method Details
#code ⇒ String
20
21
22
|
# File 'lib/infinum_json_api_setup/error.rb', line 20
def code
self.class.name.demodulize.underscore.upcase
end
|
#http_status ⇒ Symbol
25
26
27
|
# File 'lib/infinum_json_api_setup/error.rb', line 25
def http_status
self.class.name.demodulize.underscore.to_sym
end
|