Class: Paymentwall::Product
- Inherits:
-
Object
- Object
- Paymentwall::Product
- Defined in:
- lib/Paymentwall/Product.rb
Constant Summary collapse
- TYPE_SUBSCRIPTION =
'subscription'
- TYPE_FIXED =
'fixed'
- PERIOD_TYPE_DAY =
'day'
- PERIOD_TYPE_WEEK =
'week'
- PERIOD_TYPE_MONTH =
'month'
- PERIOD_TYPE_YEAR =
'year'
Instance Method Summary collapse
- #getAmount ⇒ Object
- #getCurrencyCode ⇒ Object
- #getId ⇒ Object
- #getName ⇒ Object
- #getPeriodLength ⇒ Object
- #getPeriodType ⇒ Object
- #getTrialProduct ⇒ Object
- #getType ⇒ Object
-
#initialize(productId, amount = 0.0, currencyCode = nil, name = nil, productType = self.class::TYPE_FIXED, periodLength = 0, periodType = nil, recurring = false, trialProduct = nil) ⇒ Product
constructor
A new instance of Product.
- #isRecurring ⇒ Object
Constructor Details
#initialize(productId, amount = 0.0, currencyCode = nil, name = nil, productType = self.class::TYPE_FIXED, periodLength = 0, periodType = nil, recurring = false, trialProduct = nil) ⇒ Product
Returns a new instance of Product.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/Paymentwall/Product.rb', line 12 def initialize(productId, amount = 0.0, currencyCode = nil, name = nil, productType = self.class::TYPE_FIXED, periodLength = 0, periodType = nil, recurring = false, trialProduct = nil) @productId = productId @amount = amount.round(2) @currencyCode = currencyCode @name = name @productType = productType @periodLength = periodLength @periodType = periodType @recurring = recurring if (productType == Paymentwall::Product::TYPE_SUBSCRIPTION && recurring && recurring != 0) @trialProduct = trialProduct end end |
Instance Method Details
#getAmount ⇒ Object
30 31 32 |
# File 'lib/Paymentwall/Product.rb', line 30 def getAmount() @amount end |
#getCurrencyCode ⇒ Object
34 35 36 |
# File 'lib/Paymentwall/Product.rb', line 34 def getCurrencyCode @currencyCode end |
#getId ⇒ Object
26 27 28 |
# File 'lib/Paymentwall/Product.rb', line 26 def getId() @productId end |
#getName ⇒ Object
38 39 40 |
# File 'lib/Paymentwall/Product.rb', line 38 def getName() @name end |
#getPeriodLength ⇒ Object
50 51 52 |
# File 'lib/Paymentwall/Product.rb', line 50 def getPeriodLength() @periodLength end |
#getPeriodType ⇒ Object
46 47 48 |
# File 'lib/Paymentwall/Product.rb', line 46 def getPeriodType() @periodType end |
#getTrialProduct ⇒ Object
58 59 60 |
# File 'lib/Paymentwall/Product.rb', line 58 def getTrialProduct() @trialProduct end |
#getType ⇒ Object
42 43 44 |
# File 'lib/Paymentwall/Product.rb', line 42 def getType() @productType end |
#isRecurring ⇒ Object
54 55 56 |
# File 'lib/Paymentwall/Product.rb', line 54 def isRecurring() @recurring end |