class Spreedly::Subscriptions::SubscriptionPlan
Public Class Methods
all()
click to toggle source
Returns all of the subscription plans defined in your site.
# File lib/spreedly/subscriptions.rb, line 268 def self.all xml = Spreedly::Subscriptions.get('/subscription_plans.xml') if xml.code == 200 xml['subscription_plans'].collect{|data| new(data)} else raise "Could not list subscription plans: result code #{xml.code}, body '#{xml.body}'" end end
find(id)
click to toggle source
Returns the subscription plan with the given id.
# File lib/spreedly/subscriptions.rb, line 278 def self.find(id) all.detect{|e| e.id.to_s == id.to_s} end
plans()
click to toggle source
# File lib/spreedly/subscriptions/mock.rb, line 191 def self.plans @plans ||= { 1 => new( :id => 1, :name => 'Default mock plan', :duration_quantity => 1, :duration_units => 'days', :amount => 6 ), 2 => new( :id => 2, :name => 'Test Free Trial Plan', :plan_type => 'free_trial', :duration_quantity => 1, :duration_units => 'days', :amount => 11 ), 3 => new( :id => 3, :name => 'Test Regular Plan', :duration_quantity => 1, :duration_units => 'days', :amount => 17 ) } end
Public Instance Methods
trial?()
click to toggle source
Convenience method for determining if this plan is a free trial plan or not.
# File lib/spreedly/subscriptions.rb, line 283 def trial? (plan_type == 'free_trial') end