Class: ActiveMerchant::Billing::AdaptivePaymentResponse
- Inherits:
-
Response
- Object
- Response
- ActiveMerchant::Billing::AdaptivePaymentResponse
- Defined in:
- lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb
Constant Summary collapse
- SUCCESS =
'Success'.freeze
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#json ⇒ Object
(also: #raw)
readonly
Returns the value of attribute json.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#xml_request ⇒ Object
(also: #raw_request)
readonly
Returns the value of attribute xml_request.
Instance Method Summary collapse
-
#ack ⇒ Object
def redirect_url_for Base.gateway_mode == :test ? (TEST_REDIRECT_URL + pay_key) : (REDIRECT_URL + pay_key) end.
- #build ⇒ Object
- #correlation_id ⇒ Object (also: #correlationId)
-
#initialize(json, xml_request = nil, action = nil) ⇒ AdaptivePaymentResponse
constructor
A new instance of AdaptivePaymentResponse.
- #method_missing(method, *args, &block) ⇒ Object
- #success? ⇒ Boolean
- #timestamp ⇒ Object
Constructor Details
#initialize(json, xml_request = nil, action = nil) ⇒ AdaptivePaymentResponse
Returns a new instance of AdaptivePaymentResponse.
14 15 16 17 18 19 20 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 14 def initialize(json, xml_request = nil, action = nil) @json = json @response = Hashie::Rash.new(MultiJson.decode(json)) @xml_request = xml_request @request = Hashie::Rash.from_xml(xml_request) @action = action end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
22 23 24 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 22 def method_missing(method, *args, &block) @response.send(method, *args, &block) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
10 11 12 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 10 def action @action end |
#json ⇒ Object (readonly) Also known as: raw
Returns the value of attribute json.
10 11 12 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 10 def json @json end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
10 11 12 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 10 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 10 def response @response end |
#xml_request ⇒ Object (readonly) Also known as: raw_request
Returns the value of attribute xml_request.
10 11 12 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 10 def xml_request @xml_request end |
Instance Method Details
#ack ⇒ Object
def redirect_url_for
Base.gateway_mode == :test ? (TEST_REDIRECT_URL + pay_key) : (REDIRECT_URL + pay_key)
end
30 31 32 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 30 def ack response_envelope.ack end |
#build ⇒ Object
38 39 40 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 38 def build response_envelope.build end |
#correlation_id ⇒ Object Also known as: correlationId
42 43 44 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 42 def correlation_id response_envelope.correlation_id end |
#success? ⇒ Boolean
47 48 49 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 47 def success? ack == SUCCESS end |
#timestamp ⇒ Object
34 35 36 |
# File 'lib/active_merchant/billing/gateways/paypal_adaptive_payments/adaptive_payment_response.rb', line 34 def response_envelope. end |