Sha256: 4e1364e8a520eaccc2815e8f9c6e3fbcdd67a2d08a9d6616e473b3dce09a4e78
Contents?: true
Size: 988 Bytes
Versions: 4
Compression:
Stored size: 988 Bytes
Contents
module StripeLocal class Transfer < ActiveRecord::Base include ObjectAdapter has_one :transaction, as: :source self.primary_key = :id time_writer :date def metadata MultiJson.load read_attribute( :metadata ), symbolize_keys: true end class<<self def create object super normalize( object ) end def normalize attrs attrs.each_with_object({}) do |(k,v),h| key = case k.to_sym when :balance_transaction then :transaction_id when :date then h[:date] = Time.at(v) and next when :metadata then h[:metadata] = MultiJson.dump( v.to_hash ) and next when ->(x){attribute_method? x} then k.to_sym else next end h[key] = v end end end #=!=#>>> # string :id # integer :amount # datetime :date # string :status # string :transaction_id # string :description # text :metadata #=ยก=#>>> end end
Version data entries
4 entries across 4 versions & 1 rubygems