Class: PagSeguro::Subscription::Response
- Inherits:
-
Object
- Object
- PagSeguro::Subscription::Response
- Defined in:
- lib/pagseguro/subscription/response.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Set the object that will recive errors or updates.
-
#response ⇒ Object
readonly
The http response.
Instance Method Summary collapse
-
#initialize(response, object) ⇒ Response
constructor
A new instance of Response.
- #serialize(kind = :normal) ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(response, object) ⇒ Response
Returns a new instance of Response.
10 11 12 13 |
# File 'lib/pagseguro/subscription/response.rb', line 10 def initialize(response, object) @response = response @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Set the object that will recive errors or updates
8 9 10 |
# File 'lib/pagseguro/subscription/response.rb', line 8 def object @object end |
#response ⇒ Object (readonly)
The http response
5 6 7 |
# File 'lib/pagseguro/subscription/response.rb', line 5 def response @response end |
Instance Method Details
#serialize(kind = :normal) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pagseguro/subscription/response.rb', line 15 def serialize(kind = :normal) if success? case kind when :normal object.update_attributes(serialized_data) when :search object.update_attributes(serialized_data_from_search) end else object.errors.add response end object end |
#success? ⇒ Boolean
30 31 32 |
# File 'lib/pagseguro/subscription/response.rb', line 30 def success? response.success? && response.xml? end |