Class: Braintree::Plan

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/plan.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

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_onsObject (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_monthObject (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_frequencyObject (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_atObject (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_codeObject (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

#descriptionObject (readonly)

Returns the value of attribute description.



10
11
12
# File 'lib/braintree/plan.rb', line 10

def description
  @description
end

#discountsObject (readonly)

Returns the value of attribute discounts.



11
12
13
# File 'lib/braintree/plan.rb', line 11

def discounts
  @discounts
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/braintree/plan.rb', line 12

def id
  @id
end

#merchant_idObject (readonly)

Returns the value of attribute merchant_id.



13
14
15
# File 'lib/braintree/plan.rb', line 13

def merchant_id
  @merchant_id
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/braintree/plan.rb', line 14

def name
  @name
end

#number_of_billing_cyclesObject (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

#priceObject (readonly)

Returns the value of attribute price.



16
17
18
# File 'lib/braintree/plan.rb', line 16

def price
  @price
end

#trial_durationObject (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_unitObject (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_periodObject (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_atObject (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

.allObject



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