Class: SteelWheel::Response
- Inherits:
-
Object
- Object
- SteelWheel::Response
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/steel_wheel/response.rb
Overview
Base class for responses
Instance Attribute Summary collapse
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
22 23 24 |
# File 'lib/steel_wheel/response.rb', line 22 def initialize @status = :ok end |
Instance Attribute Details
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/steel_wheel/response.rb', line 6 def status @status end |
Class Method Details
.generic_validation_keys(*keys) ⇒ Object
11 12 13 |
# File 'lib/steel_wheel/response.rb', line 11 def self.generic_validation_keys(*keys) include SteelWheel::SkipActiveModelErrorsKeys[*keys] end |
.name ⇒ Object
18 19 20 |
# File 'lib/steel_wheel/response.rb', line 18 def self.name 'SteelWheel::Response' end |
Instance Method Details
#success? ⇒ Boolean
26 27 28 |
# File 'lib/steel_wheel/response.rb', line 26 def success? errors.empty? end |
#valid? ⇒ Boolean
30 31 32 |
# File 'lib/steel_wheel/response.rb', line 30 def valid? success? end |