Sha256: 1ed0b8fcb66168ab36b88f940dc77202ea48b2d00f62f5aa117d80201e19db1a

Contents?: true

Size: 433 Bytes

Versions: 3

Compression:

Stored size: 433 Bytes

Contents

require 'active_model/serializer'

module SpreeSignifyd
  class CreditCardSerializer < ActiveModel::Serializer
    self.root = false

    attributes :cardHolderName, :last4, :expiryMonth, :expiryYear

    def cardHolderName
      "#{object.first_name} #{object.last_name}"
    end

    def last4
      object.last_digits
    end

    def expiryMonth
      object.month
    end

    def expiryYear
      object.year
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_signifyd-1.0.1 app/serializers/spree_signifyd/credit_card_serializer.rb
solidus_signifyd-1.0.0 app/serializers/spree_signifyd/credit_card_serializer.rb
solidus_signifyd-0.1.1 app/serializers/spree_signifyd/credit_card_serializer.rb