Module: StripeLocal::AssociationMethods
- Defined in:
- lib/stripe_local/association_methods.rb
Instance Method Summary collapse
- #available_transactions ⇒ Object
- #cards ⇒ Object
- #charges ⇒ Object
- #coupon ⇒ Object
- #customer ⇒ Object
- #discount ⇒ Object
- #invoices ⇒ Object
- #paid_invoices ⇒ Object
- #pending_transactions ⇒ Object
- #plan ⇒ Object
- #subscription ⇒ Object
- #transactions ⇒ Object
Instance Method Details
#available_transactions ⇒ Object
47 48 49 |
# File 'lib/stripe_local/association_methods.rb', line 47 def available_transactions transactions.available end |
#cards ⇒ Object
11 12 13 |
# File 'lib/stripe_local/association_methods.rb', line 11 def cards @cards ||= StripeLocal::Card.where( customer_id: customer.id ) end |
#charges ⇒ Object
35 36 37 |
# File 'lib/stripe_local/association_methods.rb', line 35 def charges @charges ||= StripeLocal::Charge.where( customer_id: customer.id ).order( created: :desc ) end |
#coupon ⇒ Object
23 24 25 |
# File 'lib/stripe_local/association_methods.rb', line 23 def coupon @coupon ||= StripeLocal::Coupon.find_by( id: discount.coupon_id ) end |
#customer ⇒ Object
3 4 5 |
# File 'lib/stripe_local/association_methods.rb', line 3 def customer @customer ||= StripeLocal::Customer.find_by( model_id: id ) end |
#discount ⇒ Object
19 20 21 |
# File 'lib/stripe_local/association_methods.rb', line 19 def discount @discount ||= StripeLocal::Discount.find_by( customer_id: customer.id ) end |
#invoices ⇒ Object
27 28 29 |
# File 'lib/stripe_local/association_methods.rb', line 27 def invoices @invoices ||= StripeLocal::Invoice.where( customer_id: customer.id ).order( date: :desc ) end |
#paid_invoices ⇒ Object
31 32 33 |
# File 'lib/stripe_local/association_methods.rb', line 31 def paid_invoices invoices.paid end |
#pending_transactions ⇒ Object
43 44 45 |
# File 'lib/stripe_local/association_methods.rb', line 43 def pending_transactions transactions.pending end |
#plan ⇒ Object
15 16 17 |
# File 'lib/stripe_local/association_methods.rb', line 15 def plan @plan ||= StripeLocal::Plan.find_by( id: subscription.plan_id ) end |
#subscription ⇒ Object
7 8 9 |
# File 'lib/stripe_local/association_methods.rb', line 7 def subscription @subscription ||= StripeLocal::Subscription.find_by( customer_id: customer.id ) end |
#transactions ⇒ Object
39 40 41 |
# File 'lib/stripe_local/association_methods.rb', line 39 def transactions @transactions ||= StripeLocal::Transaction.where( source: charges ).order( created: :desc ) end |