Skip to content

Instantly share code, notes, and snippets.

@laspluviosillas
Created February 7, 2014 23:04
Show Gist options
  • Save laspluviosillas/8873792 to your computer and use it in GitHub Desktop.
Save laspluviosillas/8873792 to your computer and use it in GitHub Desktop.
Example loading chargify statements to get subtotal.
s = Chargify::Statement.find(27478308)
transactions = s.transactions.reject { |t| t.type == "Payment" }
total_cents = transactions.sum(&:amount_in_cents)
total = total_cents.to_f/100 # to_f necessary otherwise decimals are truncated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment