Sha256: d951b46c94f8fe750c07ca559e66a34154d21f5c014d14966a533ef64d4b15a4
Contents?: true
Size: 780 Bytes
Versions: 5
Compression:
Stored size: 780 Bytes
Contents
module StripeLocal class Discount < ActiveRecord::Base include ObjectAdapter time_writer :start, :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 :customer then :customer_id when :coupon then h[:coupon_id] = v.id and next when ->(x){ attribute_method? x } then k.to_sym else next end if v.is_a?(Numeric) && v > 1000000000 h[key] = Time.at( v ) else h[key] = v end end end end #=!=#>>> # string :coupon_id # string :customer_id # datetime :start # datetime :end #=ยก=#>>> end end
Version data entries
5 entries across 5 versions & 1 rubygems