Class: PagSeguro::TransactionRequest::ResponseSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/pagseguro/transaction_request/response_serializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ ResponseSerializer

Returns a new instance of ResponseSerializer.



6
7
8
# File 'lib/pagseguro/transaction_request/response_serializer.rb', line 6

def initialize(xml)
  @xml = xml
end

Instance Attribute Details

#xmlObject (readonly)

Returns the value of attribute xml.



4
5
6
# File 'lib/pagseguro/transaction_request/response_serializer.rb', line 4

def xml
  @xml
end

Instance Method Details

#serializeObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/pagseguro/transaction_request/response_serializer.rb', line 10

def serialize
  {}.tap do |data|
    serialize_general(data)
    serialize_amounts(data)
    serialize_dates(data)
    serialize_items(data)
    serialize_sender(data)
    serialize_shipping(data) if xml.css("shipping").any?
  end
end