Method: StripeLocal::Transaction.normalize
- Defined in:
- app/models/stripe_local/transaction.rb
.normalize(attrs) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/models/stripe_local/transaction.rb', line 17 def normalize attrs attrs.each_with_object({}) do |(k,v),h| key = case k.to_sym when :source then :source_id when :type then :source_type 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 |