Class: BillingLogic::CommandBuilders::ProductStub
- Inherits:
-
Object
- Object
- BillingLogic::CommandBuilders::ProductStub
- Defined in:
- lib/billing_logic/command_builders/command_builders.rb
Instance Attribute Summary collapse
-
#billing_cycle ⇒ Object
Returns the value of attribute billing_cycle.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#initial_payment ⇒ Object
Returns the value of attribute initial_payment.
-
#name ⇒ Object
Returns the value of attribute name.
-
#payments ⇒ Object
Returns the value of attribute payments.
-
#price ⇒ Object
Returns the value of attribute price.
Class Method Summary collapse
Instance Attribute Details
#billing_cycle ⇒ Object
Returns the value of attribute billing_cycle.
28 29 30 |
# File 'lib/billing_logic/command_builders/command_builders.rb', line 28 def billing_cycle @billing_cycle end |
#identifier ⇒ Object
Returns the value of attribute identifier.
28 29 30 |
# File 'lib/billing_logic/command_builders/command_builders.rb', line 28 def identifier @identifier end |
#initial_payment ⇒ Object
Returns the value of attribute initial_payment.
28 29 30 |
# File 'lib/billing_logic/command_builders/command_builders.rb', line 28 def initial_payment @initial_payment end |
#name ⇒ Object
Returns the value of attribute name.
28 29 30 |
# File 'lib/billing_logic/command_builders/command_builders.rb', line 28 def name @name end |
#payments ⇒ Object
Returns the value of attribute payments.
28 29 30 |
# File 'lib/billing_logic/command_builders/command_builders.rb', line 28 def payments @payments end |
#price ⇒ Object
Returns the value of attribute price.
28 29 30 |
# File 'lib/billing_logic/command_builders/command_builders.rb', line 28 def price @price end |
Class Method Details
.parse(string, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/billing_logic/command_builders/command_builders.rb', line 29 def self.parse(string, = {}) string =~ /#{BillingLogic::CommandBuilders::SINGLE_PRODUCT_REGEX}/ billing_cycle = $3 ? ::BillingLogic::BillingCycle.new(:frequency => 1, :period => $3.include?('mo') ? :month : :year) : nil product = ([:product_class] || self).new product.name = $1 product.price = Float($2) product.identifier = "#{$1} @ $#{$2}#{$3}" product.billing_cycle = billing_cycle product.initial_payment = [:initial_payment] || 0 product end |