Class: ActiveFulfillment::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success, message, params = {}, options = {}) ⇒ Response

Returns a new instance of Response.



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

def initialize(success, message, params = {}, options = {})
  @success, @message, @params = success, message, params.stringify_keys
  @test = options[:test] || false
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



21
22
23
# File 'lib/active_fulfillment/response.rb', line 21

def method_missing(method, *args)
  @params[method.to_s] || super
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#paramsObject (readonly)

Returns the value of attribute params.



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

def params
  @params
end

#testObject (readonly)

Returns the value of attribute test.



5
6
7
# File 'lib/active_fulfillment/response.rb', line 5

def test
  @test
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  @success
end

#test?Boolean

Returns:

  • (Boolean)


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

def test?
  @test
end