Class: Braintree::Plan
- Inherits:
-
Object
- Object
- Braintree::Plan
- Includes:
- BaseModule
- Defined in:
- lib/braintree/plan.rb
Instance Attribute Summary collapse
-
#add_ons ⇒ Object
readonly
Returns the value of attribute add_ons.
-
#billing_day_of_month ⇒ Object
readonly
Returns the value of attribute billing_day_of_month.
-
#billing_frequency ⇒ Object
readonly
Returns the value of attribute billing_frequency.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency_iso_code ⇒ Object
readonly
Returns the value of attribute currency_iso_code.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#discounts ⇒ Object
readonly
Returns the value of attribute discounts.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number_of_billing_cycles ⇒ Object
readonly
Returns the value of attribute number_of_billing_cycles.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#trial_duration ⇒ Object
readonly
Returns the value of attribute trial_duration.
-
#trial_duration_unit ⇒ Object
readonly
Returns the value of attribute trial_duration_unit.
-
#trial_period ⇒ Object
readonly
Returns the value of attribute trial_period.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Class Method Summary collapse
- ._new(*args) ⇒ Object
- .all ⇒ Object
- .create(*args) ⇒ Object
- .create!(*args) ⇒ Object
- .find(*args) ⇒ Object
- .update(*args) ⇒ Object
- .update!(*args) ⇒ Object
Instance Method Summary collapse
-
#initialize(gateway, attributes) ⇒ Plan
constructor
A new instance of Plan.
Methods included from BaseModule
Methods included from BaseModule::Methods
#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class
Constructor Details
#initialize(gateway, attributes) ⇒ Plan
Returns a new instance of Plan.
26 27 28 29 30 31 32 |
# File 'lib/braintree/plan.rb', line 26 def initialize(gateway, attributes) @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 |
Instance Attribute Details
#add_ons ⇒ Object (readonly)
Returns the value of attribute add_ons.
5 6 7 |
# File 'lib/braintree/plan.rb', line 5 def add_ons @add_ons end |
#billing_day_of_month ⇒ Object (readonly)
Returns the value of attribute billing_day_of_month.
6 7 8 |
# File 'lib/braintree/plan.rb', line 6 def billing_day_of_month @billing_day_of_month end |
#billing_frequency ⇒ Object (readonly)
Returns the value of attribute billing_frequency.
7 8 9 |
# File 'lib/braintree/plan.rb', line 7 def billing_frequency @billing_frequency end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
8 9 10 |
# File 'lib/braintree/plan.rb', line 8 def created_at @created_at end |
#currency_iso_code ⇒ Object (readonly)
Returns the value of attribute currency_iso_code.
9 10 11 |
# File 'lib/braintree/plan.rb', line 9 def currency_iso_code @currency_iso_code end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
10 11 12 |
# File 'lib/braintree/plan.rb', line 10 def description @description end |
#discounts ⇒ Object (readonly)
Returns the value of attribute discounts.
11 12 13 |
# File 'lib/braintree/plan.rb', line 11 def discounts @discounts end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/braintree/plan.rb', line 12 def id @id end |
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
13 14 15 |
# File 'lib/braintree/plan.rb', line 13 def merchant_id @merchant_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/braintree/plan.rb', line 14 def name @name end |
#number_of_billing_cycles ⇒ Object (readonly)
Returns the value of attribute number_of_billing_cycles.
15 16 17 |
# File 'lib/braintree/plan.rb', line 15 def number_of_billing_cycles @number_of_billing_cycles end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
16 17 18 |
# File 'lib/braintree/plan.rb', line 16 def price @price end |
#trial_duration ⇒ Object (readonly)
Returns the value of attribute trial_duration.
17 18 19 |
# File 'lib/braintree/plan.rb', line 17 def trial_duration @trial_duration end |
#trial_duration_unit ⇒ Object (readonly)
Returns the value of attribute trial_duration_unit.
18 19 20 |
# File 'lib/braintree/plan.rb', line 18 def trial_duration_unit @trial_duration_unit end |
#trial_period ⇒ Object (readonly)
Returns the value of attribute trial_period.
19 20 21 |
# File 'lib/braintree/plan.rb', line 19 def trial_period @trial_period end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
20 21 22 |
# File 'lib/braintree/plan.rb', line 20 def updated_at @updated_at end |
Class Method Details
._new(*args) ⇒ Object
58 59 60 |
# File 'lib/braintree/plan.rb', line 58 def self._new(*args) self.new(*args) end |
.all ⇒ Object
22 23 24 |
# File 'lib/braintree/plan.rb', line 22 def self.all Configuration.gateway.plan.all end |
.create(*args) ⇒ Object
37 38 39 |
# File 'lib/braintree/plan.rb', line 37 def create(*args) Configuration.gateway.plan.create(*args) end |
.create!(*args) ⇒ Object
41 42 43 |
# File 'lib/braintree/plan.rb', line 41 def create!(*args) Configuration.gateway.plan.create!(*args) end |
.find(*args) ⇒ Object
45 46 47 |
# File 'lib/braintree/plan.rb', line 45 def find(*args) Configuration.gateway.plan.find(*args) end |
.update(*args) ⇒ Object
49 50 51 |
# File 'lib/braintree/plan.rb', line 49 def update(*args) Configuration.gateway.plan.update(*args) end |
.update!(*args) ⇒ Object
53 54 55 |
# File 'lib/braintree/plan.rb', line 53 def update!(*args) Configuration.gateway.plan.update!(*args) end |