Sha256: 05b0629098582895d24fca3e32de5eb2e2611859972b41f6028ddc5d3b22a196
Contents?: true
Size: 667 Bytes
Versions: 6
Compression:
Stored size: 667 Bytes
Contents
module Tang class ImportInvoicesJob < ActiveJob::Base queue_as :default def perform(starting_after = nil) # Do something later stripe_invoices = Stripe::Invoice.list(limit: 100, starting_after: starting_after) stripe_invoices.each do |stripe_invoice| invoice = Invoice.from_stripe(stripe_invoice) if invoice.present? stripe_invoice.lines.data.each do |stripe_invoice_item| InvoiceItem.from_stripe(stripe_invoice_item, invoice) end end end if stripe_invoices.has_more Tang::ImportInvoicesJob.perform_now(stripe_invoices.data.last.id) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems