Class: ActivePayment::Payone::Response
- Inherits:
-
Object
- Object
- ActivePayment::Payone::Response
show all
- Defined in:
- lib/activepayment/payone/response.rb
Instance Method Summary
collapse
Constructor Details
#initialize(content) ⇒ Response
Returns a new instance of Response.
5
6
7
|
# File 'lib/activepayment/payone/response.rb', line 5
def initialize(content)
@content = content
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/activepayment/payone/response.rb', line 30
def method_missing(method, *args)
value = self[method]
unless value.blank?
value
else
super
end
end
|
Instance Method Details
#[](key) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/activepayment/payone/response.rb', line 13
def [](key)
@content.split("\n").each do |param|
param_key, param_value = param.scan(/([^=]+)=(.+)/).first
if param_key.eql?(key.to_s)
return param_value
end
end
end
|
#failed? ⇒ Boolean
26
27
28
|
# File 'lib/activepayment/payone/response.rb', line 26
def failed?
self.status.eql?('ERROR')
end
|
#successful? ⇒ Boolean
22
23
24
|
# File 'lib/activepayment/payone/response.rb', line 22
def successful?
self.status.eql?('APPROVED') || self.status.eql?('REDIRECT') || self.status.eql?('OK')
end
|
#to_s ⇒ Object
9
10
11
|
# File 'lib/activepayment/payone/response.rb', line 9
def to_s
@content.to_s
end
|