Class: PagSeguro::SubscriptionCanceller::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/pagseguro/subscription_canceller/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, object) ⇒ Response

Returns a new instance of Response.



10
11
12
13
# File 'lib/pagseguro/subscription_canceller/response.rb', line 10

def initialize(response, object)
  @response = response
  @object = object
end

Instance Attribute Details

#objectObject (readonly)

Set the object that will receive errors or updates



8
9
10
# File 'lib/pagseguro/subscription_canceller/response.rb', line 8

def object
  @object
end

#responseObject (readonly)

The http response.



5
6
7
# File 'lib/pagseguro/subscription_canceller/response.rb', line 5

def response
  @response
end

Instance Method Details

#serializeObject



15
16
17
18
19
20
21
# File 'lib/pagseguro/subscription_canceller/response.rb', line 15

def serialize
  unless success?
    object.errors.add response
  end

  object
end

#success?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/pagseguro/subscription_canceller/response.rb', line 23

def success?
  response.success? && response.xml?
end