Class: WebHookDispatcher::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/webhook-dispatcher/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Response

Returns a new instance of Response.

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
10
11
# File 'lib/webhook-dispatcher/response.rb', line 3

def initialize(options = {})
  options = options.dup
  @success   = (options.delete(:success) == true)
  @status    = options.delete(:status)    || :unknown
  @http_code = options.delete(:http_code) || nil
  @message   = options.delete(:message)   || nil
  @exception = options.delete(:exception) || nil
  raise(ArgumentError, "invalid parameter") unless options.empty?
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



13
14
15
# File 'lib/webhook-dispatcher/response.rb', line 13

def exception
  @exception
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



13
14
15
# File 'lib/webhook-dispatcher/response.rb', line 13

def http_code
  @http_code
end

#messageObject (readonly)

Returns the value of attribute message.



13
14
15
# File 'lib/webhook-dispatcher/response.rb', line 13

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status.



13
14
15
# File 'lib/webhook-dispatcher/response.rb', line 13

def status
  @status
end

#successObject (readonly)

Returns the value of attribute success.



13
14
15
# File 'lib/webhook-dispatcher/response.rb', line 13

def success
  @success
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/webhook-dispatcher/response.rb', line 15

def success?
  return self.success
end