Sha256: ea389b2cfad322f8df1466df832bf70bdb04b423b7ad7067d9a3c559180f66d0
Contents?: true
Size: 963 Bytes
Versions: 6
Compression:
Stored size: 963 Bytes
Contents
module StripeLocal class Transfer < ActiveRecord::Base include ObjectAdapter has_one :transaction, as: :source self.primary_key = :id time_writer :date def metadata= hash MultiJson.dump hash end 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 ->(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
6 entries across 6 versions & 1 rubygems