Class: PagSeguro::SubscriptionChangeStatus::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, object) ⇒ Response

Returns a new instance of Response.



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

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

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



6
7
8
# File 'lib/pagseguro/subscription_change_status/response.rb', line 6

def object
  @object
end

#responseObject (readonly)

Returns the value of attribute response.



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

def response
  @response
end

Instance Method Details

#serializeObject



13
14
15
16
17
18
19
# File 'lib/pagseguro/subscription_change_status/response.rb', line 13

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

  object
end

#success?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/pagseguro/subscription_change_status/response.rb', line 21

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