Class: Services::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/services/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

Returns a new instance of Response.



6
7
8
9
# File 'lib/services/response.rb', line 6

def initialize
  @body = nil
  @errors = []
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/services/response.rb', line 3

def body
  @body
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/services/response.rb', line 4

def errors
  @errors
end

Instance Method Details

#add_errors(*errors) ⇒ Object



11
12
13
# File 'lib/services/response.rb', line 11

def add_errors(*errors)
  @errors.concat(Array(errors))
end

#success?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/services/response.rb', line 15

def success?
  errors.empty?
end