module StripeLocal class Invoice < ActiveRecord::Base include ObjectAdapter has_many :lines, inverse_of: :invoice, class_name: "LineItem" belongs_to :charge, inverse_of: :invoice belongs_to :customer, inverse_of: :invoices self.primary_key = :id time_writer :date, :period_start, :period_end, :next_payment_attempt class<(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 def succeed inv #TODO: implement this end def fail inv #TODO: implement this end def paid where paid: true end def unpaid where paid: false end alias :failed :unpaid end #=!=#>>> # string :id # string :customer_id # integer :amount_due # integer :subtotal # integer :total # boolean :attempted # integer :attempt_count # boolean :paid # boolean :closed # datetime :date # datetime :period_start # datetime :period_end # string :currency # integer :starting_balance # integer :ending_balance # string :charge_id # integer :discount # datetime :next_payment_attempt #=ยก=#>>> end end