Class: PagSeguro::Transaction::Response
- Inherits:
-
Object
- Object
- PagSeguro::Transaction::Response
- Defined in:
- lib/pagseguro/transaction/response.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Set the that will receive errors or updates.
-
#response ⇒ Object
readonly
The http response.
Instance Method Summary collapse
-
#initialize(response, object) ⇒ Response
constructor
A new instance of Response.
- #serialize ⇒ Object
- #serialize_statuses ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response, object) ⇒ Response
Returns a new instance of Response.
4 5 6 7 |
# File 'lib/pagseguro/transaction/response.rb', line 4 def initialize(response, object) @response = response @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Set the that will receive errors or updates
37 38 39 |
# File 'lib/pagseguro/transaction/response.rb', line 37 def object @object end |
#response ⇒ Object (readonly)
The http response.
34 35 36 |
# File 'lib/pagseguro/transaction/response.rb', line 34 def response @response end |
Instance Method Details
#serialize ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/pagseguro/transaction/response.rb', line 9 def serialize if success? object.update_attributes(Serializer.new(xml).serialize) else object.errors.add response end object end |
#serialize_statuses ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/pagseguro/transaction/response.rb', line 19 def serialize_statuses if success? object.statuses = Serializer.new(xml).serialize_status_history else object.errors.add(response) end object end |
#success? ⇒ Boolean
29 30 31 |
# File 'lib/pagseguro/transaction/response.rb', line 29 def success? response.success? && response.xml? end |