Sha256: 850a0f8187f0626bd4481947a74bfb858f736f96015f3bcdfa41461e57940da1
Contents?: true
Size: 557 Bytes
Versions: 1
Compression:
Stored size: 557 Bytes
Contents
require 'active_model/serializer' module SpreeSignifyd class CreditCardSerializer < ActiveModel::Serializer self.root = false attributes :cardHolderName, :last4 # this is how to conditionally include attributes in AMS def attributes(*args) hash = super hash[:expiryMonth] = object.month.to_i if object.month hash[:expiryYear] = object.year.to_i if object.year hash end def cardHolderName "#{object.first_name} #{object.last_name}" end def last4 object.last_digits end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_signifyd-1.1.0 | app/serializers/spree_signifyd/credit_card_serializer.rb |