Class: Remit::PipelineResponse
- Inherits:
-
Object
- Object
- Remit::PipelineResponse
- Defined in:
- lib/remit2/pipeline_response.rb
Instance Method Summary collapse
-
#initialize(uri, secret_key) ⇒ PipelineResponse
constructor
A new instance of PipelineResponse.
-
#method_missing(method, *args) ⇒ Object
:nodoc:.
-
#successful? ⇒ Boolean
Returns
true
if the response returns a successful state. -
#valid? ⇒ Boolean
Returns
true
if the response is correctly signed (awsSignature).
Constructor Details
#initialize(uri, secret_key) ⇒ PipelineResponse
Returns a new instance of PipelineResponse.
3 4 5 6 |
# File 'lib/remit2/pipeline_response.rb', line 3 def initialize(uri, secret_key) @uri = URI.parse(uri) @secret_key = secret_key end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
:nodoc:
29 30 31 32 33 34 35 |
# File 'lib/remit2/pipeline_response.rb', line 29 def method_missing(method, *args) #:nodoc: if request_query.has_key?(method.to_sym) request_query[method.to_sym] else super end end |
Instance Method Details
#successful? ⇒ Boolean
Returns true
if the response returns a successful state.
20 21 22 23 24 25 26 27 |
# File 'lib/remit2/pipeline_response.rb', line 20 def successful? [ Remit::PipelineStatusCode::SUCCESS_ABT, Remit::PipelineStatusCode::SUCCESS_ACH, Remit::PipelineStatusCode::SUCCESS_CC, Remit::PipelineStatusCode::SUCCESS_RECIPIENT_TOKEN_INSTALLED ].include?(request_query[:status]) end |
#valid? ⇒ Boolean
Returns true
if the response is correctly signed (awsSignature).
– The unescape_value method is used here because the awsSignature value pulled from the request is filtered through the same method. ++
14 15 16 17 |
# File 'lib/remit2/pipeline_response.rb', line 14 def valid? return false unless given_signature Relax::Query.unescape_value(correct_signature) == given_signature end |