Class: Monri::Response

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Response

Returns a new instance of Response.



6
7
8
9
10
11
# File 'lib/monri/response.rb', line 6

def initialize(params = {})
  if params.has_key?(:exception)
    self[:exception] = params[:exception]
  end
  self.merge!(params)
end

Class Method Details

.exception(exception) ⇒ Object

Parameters:

  • exception (Exception)


28
29
30
31
32
# File 'lib/monri/response.rb', line 28

def self.exception(exception)
  rv = Response.new
  rv.exception = exception
  rv
end

Instance Method Details

#exceptionException, NilClass

Returns:

  • (Exception, NilClass)


14
15
16
# File 'lib/monri/response.rb', line 14

def exception
  self[:exception]
end

#exception=(val) ⇒ Object

Parameters:

  • val (Exception)


19
20
21
# File 'lib/monri/response.rb', line 19

def exception=(val)
  self[:exception] = val
end

#failed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/monri/response.rb', line 23

def failed?
  exception != nil
end