Class: RubyPsigate::Response
- Inherits:
-
Object
- Object
- RubyPsigate::Response
show all
- Defined in:
- lib/ruby_psigate/response.rb
Constant Summary
collapse
- ACCOUNT_SUCCESS_CODES =
%w(
RPA-0000
RPA-0001
RPA-0010
RPA-0015
RPA-0020
RPA-0022
RPA-0025
RPA-0040
RPA-0042
RPA-0046
RPA-0048
RPA-0058
PSI-0000
RRC-0000
RRC-0005
RRC-0050
RRC-0060
RRC-0065
RRC-0072
RRC-0075
RRC-0082
RRC-0090
RRC-0092
RRC-0095
RRC-0098
RRC-0190
CTL-0000
CTL-0005
CTL-0050
CTL-0060
CTL-0065
CTL-0072
CTL-0075
CTL-0082
CTL-0090
CTL-0092
CTL-0098
CTL-0190
CTL-0192
RIV-0050
RIV-0060
RIV-0072
RIV-0090
RIV-0190
RIV-0197
RIV-0198
EMR-0000
EMR-0005
EMR-0050
EMR-0060
EMR-0072
EMR-0082
EMR-0090
EMR-0190
)
Instance Method Summary
collapse
Constructor Details
#initialize(xml_response) ⇒ Response
Returns a new instance of Response.
61
62
63
|
# File 'lib/ruby_psigate/response.rb', line 61
def initialize(xml_response)
@xml_response = Crack::XML.parse(xml_response)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
76
77
78
79
80
81
|
# File 'lib/ruby_psigate/response.rb', line 76
def method_missing(name, *args, &block)
@result = nil
name = name.downcase.to_sym
@result = find_value_in_hash(name, response)
@result
end
|
Instance Method Details
#response ⇒ Object
65
66
67
|
# File 'lib/ruby_psigate/response.rb', line 65
def response
@xml_response["Response"]
end
|
#success? ⇒ Boolean
69
70
71
72
|
# File 'lib/ruby_psigate/response.rb', line 69
def success?
return false unless @xml_response
ACCOUNT_SUCCESS_CODES.include?(self.returncode)
end
|