Class: Paypal::Masspay::ResponseParser
- Inherits:
-
Object
- Object
- Paypal::Masspay::ResponseParser
- Defined in:
- lib/paypal/masspay/response_parser.rb
Constant Summary collapse
- SUCCESS_ACK =
'Success'
- SUCCESS_WITH_WARN_ACK =
'SuccessWithWarning'
- SUCCESSFUL_ACKS =
[ SUCCESS_ACK, SUCCESS_WITH_WARN_ACK ]
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(response_body) ⇒ ResponseParser
constructor
A new instance of ResponseParser.
- #successful? ⇒ Boolean
Constructor Details
#initialize(response_body) ⇒ ResponseParser
Returns a new instance of ResponseParser.
10 11 12 13 |
# File 'lib/paypal/masspay/response_parser.rb', line 10 def initialize(response_body) @response_body = response_body @errors = [] end |
Instance Method Details
#errors ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/paypal/masspay/response_parser.rb', line 19 def errors @errors.tap do |errors| parsed_response.select { |k, v| k.match(/^L_ERRORCODE\d+$/) }.keys.count.times do |i| errors << Paypal::Masspay::Error.new( :code => error_code_for(i), :short_message => (i), :long_message => (i), :severity => severity_for(i)) end end end |
#successful? ⇒ Boolean
15 16 17 |
# File 'lib/paypal/masspay/response_parser.rb', line 15 def successful? SUCCESSFUL_ACKS.include?(ack) end |