Sha256: 761a37e0744b0927899b964f693dc4055cd6d4923766f8a0fd1c59f4e54ccaa6

Contents?: true

Size: 813 Bytes

Versions: 5

Compression:

Stored size: 813 Bytes

Contents

module Stripe
  module Plans
    include ConfigurationBuilder

    configuration_for :plan do
      attr_reader :currency
      attr_accessor :name, :amount, :interval, :interval_count, :trial_period_days

      validates_presence_of :id, :name, :amount
      validates_inclusion_of :interval, :in => %w(month year), :message => "'%{value}' is not one of 'month' or 'year'"

      def initialize(*args)
        super(*args)
        @currency = 'usd'
        @interval_count = 1
        @trial_period_days = 0
      end

      def create_options
        {
          :currency => @currency,
          :name => @name,
          :amount => @amount,
          :interval => @interval,
          :interval_count => @interval_count,
          :trial_period_days => @trial_period_days
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stripe-rails-0.2.5 lib/stripe/plans.rb
stripe-rails-0.2.4 lib/stripe/plans.rb
stripe-rails-0.2.3 lib/stripe/plans.rb
stripe-rails-0.2.2 lib/stripe/plans.rb
stripe-rails-0.2.1 lib/stripe/plans.rb