Class: SubscriptionFu::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/subscription_fu/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



8
9
10
11
12
13
# File 'lib/subscription_fu/config.rb', line 8

def initialize
  @available_plans = {}
  @plan_class_name = "SubscriptionFu::Plan"
  paypal_use_production!
  ::Paypal.logger = Rails.logger
end

Instance Attribute Details

#available_plansObject (readonly)

Returns the value of attribute available_plans.



6
7
8
# File 'lib/subscription_fu/config.rb', line 6

def available_plans
  @available_plans
end

#paypal_api_pwdObject

Returns the value of attribute paypal_api_pwd.



5
6
7
# File 'lib/subscription_fu/config.rb', line 5

def paypal_api_pwd
  @paypal_api_pwd
end

#paypal_api_sigObject

Returns the value of attribute paypal_api_sig.



5
6
7
# File 'lib/subscription_fu/config.rb', line 5

def paypal_api_sig
  @paypal_api_sig
end

#paypal_api_user_idObject

Returns the value of attribute paypal_api_user_id.



5
6
7
# File 'lib/subscription_fu/config.rb', line 5

def paypal_api_user_id
  @paypal_api_user_id
end

#plan_class_nameObject

Returns the value of attribute plan_class_name.



5
6
7
# File 'lib/subscription_fu/config.rb', line 5

def plan_class_name
  @plan_class_name
end

Instance Method Details

#add_free_plan(key, data = {}) ⇒ Object



27
28
29
# File 'lib/subscription_fu/config.rb', line 27

def add_free_plan(key, data = {})
  add_plan(key, 0, data)
end

#add_plan(key, price, data = {}) ⇒ Object



23
24
25
# File 'lib/subscription_fu/config.rb', line 23

def add_plan(key, price, data = {})
  available_plans[key] = plan_class.new(key, price, data)
end

#paypal_use_production!Object



19
20
21
# File 'lib/subscription_fu/config.rb', line 19

def paypal_use_production!
  ::Paypal.sandbox = false
end

#paypal_use_sandbox!Object



15
16
17
# File 'lib/subscription_fu/config.rb', line 15

def paypal_use_sandbox!
  ::Paypal.sandbox = true
end