Class: ActiveMerchant::Billing::MultiResponse
- Inherits:
-
Response
- Object
- Response
- ActiveMerchant::Billing::MultiResponse
show all
- Defined in:
- lib/active_merchant/billing/response.rb
Instance Attribute Summary collapse
Attributes inherited from Response
#authorization, #avs_result, #cvv_result, #message, #params, #test
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Response
#fraud_review?, #test?
Constructor Details
Returns a new instance of MultiResponse.
48
49
50
|
# File 'lib/active_merchant/billing/response.rb', line 48
def initialize
@responses = []
end
|
Instance Attribute Details
#responses ⇒ Object
Returns the value of attribute responses.
46
47
48
|
# File 'lib/active_merchant/billing/response.rb', line 46
def responses
@responses
end
|
Class Method Details
.run(&block) ⇒ Object
42
43
44
|
# File 'lib/active_merchant/billing/response.rb', line 42
def self.run(&block)
new.tap(&block)
end
|
Instance Method Details
#<<(response) ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/active_merchant/billing/response.rb', line 56
def <<(response)
if response.is_a?(MultiResponse)
response.responses.each{|r| @responses << r}
else
@responses << response
end
end
|
#process ⇒ Object
52
53
54
|
# File 'lib/active_merchant/billing/response.rb', line 52
def process
self << yield if(responses.empty? || success?)
end
|
#success? ⇒ Boolean
64
65
66
|
# File 'lib/active_merchant/billing/response.rb', line 64
def success?
@responses.all?{|r| r.success?}
end
|