Class: PagSeguro::AuthorizationRequest::Response
- Inherits:
-
Object
- Object
- PagSeguro::AuthorizationRequest::Response
- Defined in:
- lib/pagseguro/authorization_request/response.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #serialize ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
4 5 6 |
# File 'lib/pagseguro/authorization_request/response.rb', line 4 def initialize(response) @response = response end |
Instance Method Details
#serialize ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/pagseguro/authorization_request/response.rb', line 8 def serialize if success? xml = Nokogiri::XML(response.body).css('authorizationRequest').first ResponseSerializer.new(xml).serialize else { errors: Errors.new(response) } end end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/pagseguro/authorization_request/response.rb', line 17 def success? response.success? && response.xml? end |