Sha256: 8ecd65282c1f5e6e5b7a582e039ec9d389714edad423e6002ccf318cbcb98d51
Contents?: true
Size: 819 Bytes
Versions: 3
Compression:
Stored size: 819 Bytes
Contents
module StripeLocal class Card < ActiveRecord::Base primary_key = :id has_many :charges, inverse_of: :card belongs_to :customer, inverse_of: :cards class<<self def create attrs_hash super normalize( attrs_hash ) end def normalize hash hash.each_with_object({}) do |(k,v),h| key = case k.to_sym when :customer then :customer_id when :type then :brand when ->(x){attribute_method? x} then k.to_sym else next end h[key] = v end end end # =!=#>>> # string :id # string :customer_id # string :name # integer :exp_month # integer :exp_year # string :brand # string :last4 # string :cvc_check # string :fingerprint # =ยก=#>>> end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
stripe_local-0.1.1 | app/models/stripe_local/card.rb |
stripe_local-0.1.0 | app/models/stripe_local/card.rb |
stripe_local-0.0.2 | app/models/stripe_local/card.rb |