Class: PagSeguro::TransactionCancellation::RequestSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/pagseguro/transaction_cancellation/request_serializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transaction_cancellation) ⇒ RequestSerializer

Returns a new instance of RequestSerializer.



7
8
9
# File 'lib/pagseguro/transaction_cancellation/request_serializer.rb', line 7

def initialize(transaction_cancellation)
  @transaction_cancellation = transaction_cancellation
end

Instance Attribute Details

#transaction_cancellationObject (readonly)

The transaction_cancellation that will be serialized.



5
6
7
# File 'lib/pagseguro/transaction_cancellation/request_serializer.rb', line 5

def transaction_cancellation
  @transaction_cancellation
end

Instance Method Details

#to_paramsObject



11
12
13
14
15
# File 'lib/pagseguro/transaction_cancellation/request_serializer.rb', line 11

def to_params
  {}.tap do |data|
    data[:transactionCode] = transaction_cancellation.transaction_code
  end.delete_if { |_, value| value.nil? }
end