Pārlūkot izejas kodu

Closes #198 Missing helper methods on ApplicationCharge

Gavin Ballard 9 gadi atpakaļ
vecāks
revīzija
1f651ad886
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      lib/shopify_api/resources/application_charge.rb

+ 6 - 0
lib/shopify_api/resources/application_charge.rb

@@ -2,6 +2,12 @@ module ShopifyAPI
   class ApplicationCharge < Base
     undef_method :test
 
+    class << self
+      [:pending, :cancelled, :accepted, :declined].each do |status|
+        define_method(status) { (all || []).select { |c| c.status == status.to_s } }
+      end
+    end
+
     def activate
       load_attributes_from_response(post(:activate))
     end