Sha256: c5db1840a43cf6e1775f29907c7ffeff363864a7c2c8e58152f8d63cd5666b3e

Contents?: true

Size: 990 Bytes

Versions: 29

Compression:

Stored size: 990 Bytes

Contents

module Braintree
  class Plan
    include BaseModule

    attr_reader :add_ons
    attr_reader :billing_day_of_month
    attr_reader :billing_frequency
    attr_reader :created_at
    attr_reader :currency_iso_code
    attr_reader :description
    attr_reader :discounts
    attr_reader :id
    attr_reader :merchant_id
    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 :updated_at

    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

29 entries across 29 versions & 1 rubygems

Version Path
braintree-3.3.0 lib/braintree/plan.rb
braintree-3.2.0 lib/braintree/plan.rb
braintree-3.1.0 lib/braintree/plan.rb
braintree-3.0.1 lib/braintree/plan.rb
braintree-2.104.1 lib/braintree/plan.rb
braintree-2.104.0 lib/braintree/plan.rb
braintree-2.103.0 lib/braintree/plan.rb
braintree-2.102.0 lib/braintree/plan.rb
braintree-2.101.0 lib/braintree/plan.rb
braintree-2.100.0 lib/braintree/plan.rb
braintree-2.99.0 lib/braintree/plan.rb
braintree-2.98.0 lib/braintree/plan.rb
braintree-2.97.0 lib/braintree/plan.rb
braintree-2.96.0 lib/braintree/plan.rb
braintree-2.95.0 lib/braintree/plan.rb
braintree-2.94.0 lib/braintree/plan.rb
braintree-2.93.0 lib/braintree/plan.rb
braintree-2.92.0 lib/braintree/plan.rb
braintree-2.91.0 lib/braintree/plan.rb
braintree-2.90.0 lib/braintree/plan.rb