Class: Paymentwall::Product

Inherits:
Object
  • Object
show all
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

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

#getAmountObject



30
31
32
# File 'lib/Paymentwall/Product.rb', line 30

def getAmount()
	@amount
end

#getCurrencyCodeObject



34
35
36
# File 'lib/Paymentwall/Product.rb', line 34

def getCurrencyCode
	@currencyCode
end

#getIdObject



26
27
28
# File 'lib/Paymentwall/Product.rb', line 26

def getId()
	@productId
end

#getNameObject



38
39
40
# File 'lib/Paymentwall/Product.rb', line 38

def getName()
	@name
end

#getPeriodLengthObject



50
51
52
# File 'lib/Paymentwall/Product.rb', line 50

def getPeriodLength()
	@periodLength
end

#getPeriodTypeObject



46
47
48
# File 'lib/Paymentwall/Product.rb', line 46

def getPeriodType()
	@periodType
end

#getTrialProductObject



58
59
60
# File 'lib/Paymentwall/Product.rb', line 58

def getTrialProduct()
	@trialProduct
end

#getTypeObject



42
43
44
# File 'lib/Paymentwall/Product.rb', line 42

def getType()
	@productType
end

#isRecurringObject



54
55
56
# File 'lib/Paymentwall/Product.rb', line 54

def isRecurring()
	@recurring
end