Class: Solon::SagepayCallback
- Inherits:
-
SagepayResponse
- Object
- SagepayResponse
- Solon::SagepayCallback
- Defined in:
- lib/solon/sagepay_callback.rb
Instance Method Summary collapse
- #error? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(response) ⇒ SagepayCallback
constructor
A new instance of SagepayCallback.
-
#st(status_check) ⇒ Object
Generic status checker method.
Methods inherited from SagepayResponse
#[], #[]=, #approved?, #method_missing, #verify!
Constructor Details
#initialize(response) ⇒ SagepayCallback
Returns a new instance of SagepayCallback.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/solon/sagepay_callback.rb', line 3 def initialize(response) @response = response if @response.is_a?(String) response.split("&").each do |line| key, *value = line.split("=") value = value.join("=") self[key] = value end elsif @response.is_a?(Hash) response.each do |key, value| self[key] = value end else raise Solon::Error, "Cannot parse response of type #{@response.class}" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Solon::SagepayResponse
Instance Method Details
#error? ⇒ Boolean
24 25 26 |
# File 'lib/solon/sagepay_callback.rb', line 24 def error? SolonGateway::ERRORS.include?(self.status.to_sym) end |
#failed? ⇒ Boolean
20 21 22 |
# File 'lib/solon/sagepay_callback.rb', line 20 def failed? SolonGateway::FAILURES.include?(self.status.to_sym) end |
#st(status_check) ⇒ Object
Generic status checker method
29 30 31 |
# File 'lib/solon/sagepay_callback.rb', line 29 def st(status_check) status_check.to_s == self.status.to_s end |