Sha256: 52a7e1fb603971d14046feaef986b21d86362b30a8abc306f650a092d2c71d6a

Contents?: true

Size: 1.08 KB

Versions: 37

Compression:

Stored size: 1.08 KB

Contents

module Braintree
  # See http://www.braintreepayments.com/docs/ruby
  class Plan
    include BaseModule

    attr_reader :id
    attr_reader :merchant_id
    attr_reader :billing_day_of_month
    attr_reader :billing_frequency
    attr_reader :currency_iso_code
    attr_reader :description
    attr_reader :discounts
    attr_reader :name
    attr_reader :number_of_billing_cycles
    attr_reader :price
    attr_reader :trial_duration
    attr_reader :trial_duration_unit
    attr_reader :trial_period
    attr_reader :created_at
    attr_reader :updated_at
    attr_reader :add_ons

    # See http://www.braintreepayments.com/docs/ruby/plans/all
    def self.all
      Configuration.gateway.plan.all
    end

    def initialize(gateway, attributes) # :nodoc:
      @gateway = gateway
      set_instance_variables_from_hash(attributes)
      add_ons.map! { |attrs| AddOn._new(attrs) }
      discounts.map! { |attrs| Discount._new(attrs) }
      @price = Util.to_big_decimal(price)
    end

    class << self
      protected :new
    end

    def self._new(*args)
      self.new *args
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
braintree-2.40.0 lib/braintree/plan.rb
braintree-2.39.0 lib/braintree/plan.rb
braintree-2.38.0 lib/braintree/plan.rb
braintree-2.37.0 lib/braintree/plan.rb
braintree-2.36.0 lib/braintree/plan.rb
braintree-2.35.0 lib/braintree/plan.rb
braintree-2.34.1 lib/braintree/plan.rb
braintree-2.34.0 lib/braintree/plan.rb
braintree-2.33.1 lib/braintree/plan.rb
braintree-2.33.0 lib/braintree/plan.rb
braintree-2.32.1 lib/braintree/plan.rb
braintree-2.31.0 lib/braintree/plan.rb
braintree-2.30.2 lib/braintree/plan.rb
braintree-2.30.0 lib/braintree/plan.rb
braintree-2.29.0 lib/braintree/plan.rb
braintree-2.28.0 lib/braintree/plan.rb
braintree-2.27.1 lib/braintree/plan.rb
braintree-2.27.0 lib/braintree/plan.rb
braintree-2.26.0 lib/braintree/plan.rb
braintree-2.25.0 lib/braintree/plan.rb