Class: SpreeSignifyd::CreditCardSerializer

Inherits:
ActiveModel::Serializer
  • Object
show all
Defined in:
app/serializers/spree_signifyd/credit_card_serializer.rb

Instance Method Summary collapse

Instance Method Details

#attributes(*args) ⇒ Object

this is how to conditionally include attributes in AMS



10
11
12
13
14
15
# File 'app/serializers/spree_signifyd/credit_card_serializer.rb', line 10

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

#cardHolderNameObject



17
18
19
# File 'app/serializers/spree_signifyd/credit_card_serializer.rb', line 17

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

#last4Object



21
22
23
# File 'app/serializers/spree_signifyd/credit_card_serializer.rb', line 21

def last4
  object.last_digits
end