class PagSeguro::SubscriptionPlan::Response

Attributes

object[R]

Set the boject that will receive errors or updates

response[R]

The http response.

Public Class Methods

new(response, object) click to toggle source
# File lib/pagseguro/subscription_plan/response.rb, line 10
def initialize(response, object)
  @response = response
  @object = object
end

Public Instance Methods

serialize() click to toggle source
# File lib/pagseguro/subscription_plan/response.rb, line 15
def serialize
  if success?
    object.update_attributes(ResponseSerializer.new(xml).serialize)
  else
    object.errors.add response
  end

  object
end
success?() click to toggle source
# File lib/pagseguro/subscription_plan/response.rb, line 25
def success?
  response.success? && response.xml?
end

Private Instance Methods

xml() click to toggle source
# File lib/pagseguro/subscription_plan/response.rb, line 31
def xml
  Nokogiri::XML(response.body)
end