Sha256: de028cd6cf8feb1543e17222a97903c6fd580837aa45dae278ff9ffe8a558971

Contents?: true

Size: 519 Bytes

Versions: 10

Compression:

Stored size: 519 Bytes

Contents

module ShopifyAPI
  class RecurringApplicationCharge < Base
    undef_method :test

    class << self
      def current
        (all || []).find { |c| c.status == 'active' }
      end

      [:pending, :cancelled, :accepted, :declined].each do |status|
        define_method(status) { (all || []).select { |c| c.status == status.to_s } }
      end
    end

    def cancel
      load_attributes_from_response(self.destroy)
    end

    def activate
      load_attributes_from_response(post(:activate))
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shopify_api-4.0.7 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-4.0.6 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-4.0.5 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-4.0.4 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-4.0.3 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-4.0.2 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-4.0.1 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-4.0.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-3.2.7 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-3.2.6 lib/shopify_api/resources/recurring_application_charge.rb