Class: CloudRailSi::Types::SubscriptionPlan

Inherits:
SandboxObject show all
Defined in:
lib/cloudrail_si/types/SubscriptionPlan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SandboxObject

#get, #set

Constructor Details

#initialize(amount, crated, currency, description, id, interval, interval_count, name) ⇒ SubscriptionPlan

Returns a new instance of SubscriptionPlan.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 9

def initialize(amount, crated, currency, description, id, interval, interval_count, name)
    super()
    @amount = amount
    @created = created
    @currency = currency
    @description = description
    @id = id
    @interval = interval
    @interval_count = interval_count
    @name = name
    raise Errors::IllegalArgumentError.new("At least one of the parameters is undefined.") if (currency.nil? || description.nil? || id.nil? || interval.nil? || name.nil?)
    raise Errors::IllegalArgumentError.new("Amount can not be less than 0.") if (amount < 0)
    raise Errors::IllegalArgumentError.new("Passed currency is not a valid three-letter currency code.") if (currency.length != 3)
    raise Errors::IllegalArgumentError.new("Unknown interval. Allowed values are: 'day', 'week', 'month' or 'year'.") if (["day", "week", "month", "year"].index(interval) < 0)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



7
8
9
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 7

def amount
  @amount
end

#createdObject (readonly)

Returns the value of attribute created.



7
8
9
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 7

def created
  @created
end

#currencyObject (readonly)

Returns the value of attribute currency.



7
8
9
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 7

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



7
8
9
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 7

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 7

def id
  @id
end

#intervalObject (readonly)

Returns the value of attribute interval.



7
8
9
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 7

def interval
  @interval
end

#interval_countObject (readonly)

Returns the value of attribute interval_count.



7
8
9
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 7

def interval_count
  @interval_count
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/cloudrail_si/types/SubscriptionPlan.rb', line 7

def name
  @name
end