Parcourir la source

Closes #198 Missing helper methods on ApplicationCharge

Gavin Ballard il y a 9 ans
Parent
commit
1f651ad886
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  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