Created
February 7, 2014 23:04
-
-
Save laspluviosillas/8873792 to your computer and use it in GitHub Desktop.
Example loading chargify statements to get subtotal.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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