Permalink
Browse files

Add invoice model to query invoices

  • Loading branch information...
alexisraca committed Jan 22, 2014
1 parent c695b64 commit 51e3bde4c45c7ff62379e80c1b602eb1be19d75c
Showing with 20 additions and 0 deletions.
  1. +20 −0 lib/chargify_api_ares/resources/invoice.rb
@@ -0,0 +1,20 @@
+module Chargify
+ class Invoice < Base
+
+ def self.find_by_invoice_id(id)
+ find(:first, params: {id: id})
+ end
+
+ def self.find_by_subscription_id(id)
+ find(:all, params: {subscription_id: id})
+ end
+
+ def self.unpaid_from_subscription(subscription_id)
+ find(:all, params: {subscription_id: subscription_id, state: "unpaid"})
+ end
+
+ def self.unpaid
+ find(:all, params: {state: "unpaid"})
+ end
+ end
+end

0 comments on commit 51e3bde

Please sign in to comment.