Class: RSpreedly::SubscriptionPlan
- Defined in:
- lib/rspreedly/subscription_plan.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#charge_after_first_period ⇒ Object
Returns the value of attribute charge_after_first_period.
-
#charge_later_duration_quantity ⇒ Object
Returns the value of attribute charge_later_duration_quantity.
-
#charge_later_duration_units ⇒ Object
Returns the value of attribute charge_later_duration_units.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#currency_code ⇒ Object
Returns the value of attribute currency_code.
-
#description ⇒ Object
Returns the value of attribute description.
-
#duration_quantity ⇒ Object
Returns the value of attribute duration_quantity.
-
#duration_units ⇒ Object
Returns the value of attribute duration_units.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#feature_level ⇒ Object
Returns the value of attribute feature_level.
-
#force_recurring ⇒ Object
Returns the value of attribute force_recurring.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#needs_to_be_renewed ⇒ Object
Returns the value of attribute needs_to_be_renewed.
-
#plan_type ⇒ Object
Returns the value of attribute plan_type.
-
#price ⇒ Object
Returns the value of attribute price.
-
#return_url ⇒ Object
Returns the value of attribute return_url.
-
#terms ⇒ Object
Returns the value of attribute terms.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Attributes inherited from Base
Class Method Summary collapse
-
.active ⇒ Object
Get a list of all active subscription plans (more) GET /api/v4/[short site name]/subscription_plans.xml.
-
.all ⇒ Object
Get a list of all subscription plans (more) GET /api/v4/[short site name]/subscription_plans.xml.
-
.find(id) ⇒ Object
there’s no API method for just getting one plan, so we fake it!.
Methods inherited from Base
api_request, #api_request, #attributes=, do_request, #initialize, #to_xml
Constructor Details
This class inherits a constructor from RSpreedly::Base
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def amount @amount end |
#charge_after_first_period ⇒ Object
Returns the value of attribute charge_after_first_period.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def charge_after_first_period @charge_after_first_period end |
#charge_later_duration_quantity ⇒ Object
Returns the value of attribute charge_later_duration_quantity.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def charge_later_duration_quantity @charge_later_duration_quantity end |
#charge_later_duration_units ⇒ Object
Returns the value of attribute charge_later_duration_units.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def charge_later_duration_units @charge_later_duration_units end |
#created_at ⇒ Object
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def created_at @created_at end |
#currency_code ⇒ Object
Returns the value of attribute currency_code.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def currency_code @currency_code end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def description @description end |
#duration_quantity ⇒ Object
Returns the value of attribute duration_quantity.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def duration_quantity @duration_quantity end |
#duration_units ⇒ Object
Returns the value of attribute duration_units.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def duration_units @duration_units end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def enabled @enabled end |
#feature_level ⇒ Object
Returns the value of attribute feature_level.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def feature_level @feature_level end |
#force_recurring ⇒ Object
Returns the value of attribute force_recurring.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def force_recurring @force_recurring end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def name @name end |
#needs_to_be_renewed ⇒ Object
Returns the value of attribute needs_to_be_renewed.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def needs_to_be_renewed @needs_to_be_renewed end |
#plan_type ⇒ Object
Returns the value of attribute plan_type.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def plan_type @plan_type end |
#price ⇒ Object
Returns the value of attribute price.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def price @price end |
#return_url ⇒ Object
Returns the value of attribute return_url.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def return_url @return_url end |
#terms ⇒ Object
Returns the value of attribute terms.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def terms @terms end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
5 6 7 |
# File 'lib/rspreedly/subscription_plan.rb', line 5 def updated_at @updated_at end |
Class Method Details
.active ⇒ Object
Get a list of all active subscription plans (more) GET /api/v4/[short site name]/subscription_plans.xml
42 43 44 |
# File 'lib/rspreedly/subscription_plan.rb', line 42 def self.active all.reject { |plan| !plan.enabled } end |
.all ⇒ Object
Get a list of all subscription plans (more) GET /api/v4/[short site name]/subscription_plans.xml
34 35 36 37 38 |
# File 'lib/rspreedly/subscription_plan.rb', line 34 def self.all response = api_request(:get, "/subscription_plans.xml") return [] unless response.has_key?("subscription_plans") response["subscription_plans"].collect{|data| SubscriptionPlan.new(data)} end |
.find(id) ⇒ Object
there’s no API method for just getting one plan, so we fake it!
27 28 29 30 |
# File 'lib/rspreedly/subscription_plan.rb', line 27 def self.find(id) return all if id == :all all.find{|plan| plan.id == id.to_i} end |