Exception: JSONAPI::Exceptions::InvalidField
- Defined in:
- lib/jsonapi/exceptions.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(type, field) ⇒ InvalidField
constructor
A new instance of InvalidField.
Constructor Details
#initialize(type, field) ⇒ InvalidField
Returns a new instance of InvalidField.
148 149 150 151 |
# File 'lib/jsonapi/exceptions.rb', line 148 def initialize(type, field) @field = field @type = type end |
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field.
147 148 149 |
# File 'lib/jsonapi/exceptions.rb', line 147 def field @field end |
#type ⇒ Object
Returns the value of attribute type.
147 148 149 |
# File 'lib/jsonapi/exceptions.rb', line 147 def type @type end |
Instance Method Details
#errors ⇒ Object
153 154 155 156 157 158 |
# File 'lib/jsonapi/exceptions.rb', line 153 def errors [JSONAPI::Error.new(code: JSONAPI::INVALID_FIELD, status: :bad_request, title: 'Invalid field', detail: "#{field} is not a valid field for #{type}.")] end |