Class: ActiveMerchant::Billing::PaypalPermissions::Parsers::GetAccessTokenNVParser
- Inherits:
-
CommonNVParser
- Object
- CommonNVParser
- ActiveMerchant::Billing::PaypalPermissions::Parsers::GetAccessTokenNVParser
- Defined in:
- lib/paypal_permissions/parsers/get_access_token.rb
Class Method Summary collapse
Methods inherited from CommonNVParser
process_envelope_pair, process_error_idx, process_error_pair
Class Method Details
.parse(nvp_response) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/paypal_permissions/parsers/get_access_token.rb', line 7 def parse nvp_response super pairs = nvp_response.split "&" pairs.each do |pair| n,v = pair.split "=" v ||= "" n = CGI.unescape n v = CGI.unescape v case n # envelope when /^responseEnvelope/ process_envelope_pair n, v # successful token response when "token" @response[:token] = v when "tokenSecret" @response[:token_secret] = v # error with index when /^error\((\d+)\)/ process_error_pair n, v end end @response end |