Class: SubscriptionFu::Config
- Inherits:
-
Object
- Object
- SubscriptionFu::Config
- Defined in:
- lib/subscription_fu/config.rb
Instance Attribute Summary collapse
-
#available_plans ⇒ Object
readonly
Returns the value of attribute available_plans.
-
#paypal_api_pwd ⇒ Object
Returns the value of attribute paypal_api_pwd.
-
#paypal_api_sig ⇒ Object
Returns the value of attribute paypal_api_sig.
-
#paypal_api_user_id ⇒ Object
Returns the value of attribute paypal_api_user_id.
-
#plan_class_name ⇒ Object
Returns the value of attribute plan_class_name.
Instance Method Summary collapse
- #add_free_plan(key, data = {}) ⇒ Object
- #add_plan(key, price, data = {}) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #paypal_use_production! ⇒ Object
- #paypal_use_sandbox! ⇒ Object
Constructor Details
#initialize ⇒ Config
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_plans ⇒ Object (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_pwd ⇒ Object
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_sig ⇒ Object
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_id ⇒ Object
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_name ⇒ Object
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 |