Class: SteelWheel::Response

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/steel_wheel/response.rb

Overview

Base class for responses

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

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

#statusObject

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

.nameObject



18
19
20
# File 'lib/steel_wheel/response.rb', line 18

def self.name
  'SteelWheel::Response'
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/steel_wheel/response.rb', line 26

def success?
  errors.empty?
end

#valid?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/steel_wheel/response.rb', line 30

def valid?
  success?
end