瀏覽代碼

Added pending, cancelled, accepted and declined to RecurringApplicationCharge

Travis Haynes 13 年之前
父節點
當前提交
5ab61d8ac5
共有 1 個文件被更改,包括 21 次插入3 次删除
  1. 21 3
      lib/shopify_api/recurring_application_charge.rb

+ 21 - 3
lib/shopify_api/recurring_application_charge.rb

@@ -1,9 +1,27 @@
 module ShopifyAPI
   class RecurringApplicationCharge < Base
     undef_method :test
-
-    def self.current
-      find(:all).find{|charge| charge.status == 'active'}
+    
+    class << self
+      def current
+        all.find { |c| c.status == 'active' }
+      end
+      
+      def pending
+        all.find { |c| c.status == 'pending' }
+      end
+      
+      def cancelled
+        all.find { |c| c.status == 'cancelled' }
+      end
+      
+      def accepted
+        all.find { |c| c.status == 'accepted' }
+      end
+      
+      def declined
+        all.find { |c| c.status == 'declined' }
+      end
     end
     
     def cancel