Class: ActiveMerchant::Billing::MultiResponse
- Defined in:
- lib/active_merchant/billing/response.rb
Instance Attribute Summary collapse
-
#responses ⇒ Object
readonly
Returns the value of attribute responses.
Attributes inherited from Response
#authorization, #avs_result, #cvv_result, #message, #params, #test
Instance Method Summary collapse
- #<<(response) ⇒ Object
-
#initialize ⇒ MultiResponse
constructor
A new instance of MultiResponse.
- #process ⇒ Object
- #success? ⇒ Boolean
Methods inherited from Response
Constructor Details
#initialize ⇒ MultiResponse
Returns a new instance of MultiResponse.
35 36 37 |
# File 'lib/active_merchant/billing/response.rb', line 35 def initialize @responses = [] end |
Instance Attribute Details
#responses ⇒ Object (readonly)
Returns the value of attribute responses.
33 34 35 |
# File 'lib/active_merchant/billing/response.rb', line 33 def responses @responses end |
Instance Method Details
#<<(response) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/active_merchant/billing/response.rb', line 43 def <<(response) if response.is_a?(MultiResponse) response.responses.each{|r| @responses << r} else @responses << response end end |
#process ⇒ Object
39 40 41 |
# File 'lib/active_merchant/billing/response.rb', line 39 def process self << yield if(responses.empty? || success?) end |
#success? ⇒ Boolean
51 52 53 |
# File 'lib/active_merchant/billing/response.rb', line 51 def success? @responses.all?{|r| r.success?} end |