Sha256: 3ba5432ecb9967307aaf5d73b32bd5d2166d95ce3cb8dc26c77a81faacbe5d10

Contents?: true

Size: 503 Bytes

Versions: 5

Compression:

Stored size: 503 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

5 entries across 5 versions & 1 rubygems

Version Path
shopify_api-3.2.5 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-3.2.4 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-3.2.3 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-3.2.2 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-3.2.1 lib/shopify_api/resources/recurring_application_charge.rb