Class: PagSeguro::Session::Response
- Inherits:
-
Object
- Object
- PagSeguro::Session::Response
- Defined in:
- lib/pagseguro/session/response.rb
Instance Method Summary collapse
-
#initialize(response, session) ⇒ Response
constructor
A new instance of Response.
- #serialize ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response, session) ⇒ Response
Returns a new instance of Response.
4 5 6 7 |
# File 'lib/pagseguro/session/response.rb', line 4 def initialize(response, session) @response = response @session = session end |
Instance Method Details
#serialize ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pagseguro/session/response.rb', line 9 def serialize if success? xml = Nokogiri::XML(response.body).css("session").first session.update_attributes(ResponseSerializer.new(xml).serialize) else session.errors.add(response) end session end |
#success? ⇒ Boolean
20 21 22 |
# File 'lib/pagseguro/session/response.rb', line 20 def success? response.success? && response.xml? end |