Sha256: b334d8f64fcc7822afa3b736c35b3059a317aa8e960b200345d06e7a7f258940

Contents?: true

Size: 822 Bytes

Versions: 48

Compression:

Stored size: 822 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 usage_charges
      UsageCharge.find(:all, params: { recurring_application_charge_id: id })
    end

    def cancel
      load_attributes_from_response(self.destroy)
    end

    def activate
      load_attributes_from_response(post(:activate))
    end

    def customize(customize_recurring_app_charge_params = {})
      load_attributes_from_response(put(:customize, recurring_application_charge: customize_recurring_app_charge_params ))
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
shopify_api-9.2.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-9.1.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-9.0.4 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-9.0.3 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-9.0.2 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-9.0.1 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-9.0.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-8.1.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-8.0.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-7.1.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-7.0.2 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-7.0.1 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-7.0.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-6.0.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-5.2.4 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-5.2.3 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-5.2.2 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-5.2.1 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-5.2.0 lib/shopify_api/resources/recurring_application_charge.rb
shopify_api-5.1.0 lib/shopify_api/resources/recurring_application_charge.rb