Class: SoftLayer::ProductConfigurationOption

Inherits:
Struct
  • Object
show all
Defined in:
lib/softlayer/ProductItemCategory.rb

Overview

This struct represents a configuration option that can be included in a product order. Strictly speaking the only information required for the product order is the price_id, the rest of the information is provided to make the object friendly to humans who may be searching for the meaning of a given price_id.

DEPRECATION WARNING: The following configuration option keys have been deprecated and will be removed with the next major version: capacityRestrictionMaximum, capacityRestrictionMinimum, capacityRestrictionType, hourlyRecurringFee, laborFee, oneTimeFee, recurringFee, requiredCoreCount, setupFee

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(package_item_data, price_item_data) ⇒ ProductConfigurationOption

Is it evil, or just incongruous to give methods to a struct?



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/softlayer/ProductItemCategory.rb', line 23

def initialize(package_item_data, price_item_data)
  self.capacity    = package_item_data['capacity']
  self.description = package_item_data['description']
  self.units       = package_item_data['units']

  #DEPRECATION WARNING: All these are deprecated and will be removed with the next major version, pleace use keys below
  self.capacityRestrictionMaximum = price_item_data['capacityRestrictionMaximum'] ? price_item_data['capacityRestrictionMaximum'] : nil
  self.capacityRestrictionMinimum = price_item_data['capacityRestrictionMinimum'] ? price_item_data['capacityRestrictionMinimum'] : nil
  self.capacityRestrictionType    = price_item_data['capacityRestrictionType']    ? price_item_data['capacityRestrictionType']    : nil
  self.hourlyRecurringFee         = price_item_data['hourlyRecurringFee']         ? price_item_data['hourlyRecurringFee'].to_f    : 0.0
  self.laborFee                   = price_item_data['laborFee']                   ? price_item_data['laborFee'].to_f              : 0.0
  self.oneTimeFee                 = price_item_data['oneTimeFee']                 ? price_item_data['oneTimeFee'].to_f            : 0.0
  self.price_id                   = price_item_data['id']
  self.recurringFee               = price_item_data['recurringFee']               ? price_item_data['recurringFee'].to_f          : 0.0
  self.requiredCoreCount          = price_item_data['requiredCoreCount']          ? price_item_data['requiredCoreCount']          : nil
  self.setupFee                   = price_item_data['setupFee']                   ? price_item_data['setupFee'].to_f              : 0.0

  self.capacity_restriction_maximum = price_item_data['capacityRestrictionMaximum'] ? price_item_data['capacityRestrictionMaximum'] : nil
  self.capacity_restriction_minimum = price_item_data['capacityRestrictionMinimum'] ? price_item_data['capacityRestrictionMinimum'] : nil
  self.capacity_restriction_type    = price_item_data['capacityRestrictionType']    ? price_item_data['capacityRestrictionType']    : nil
  self.hourly_recurring_fee         = price_item_data['hourlyRecurringFee']         ? price_item_data['hourlyRecurringFee'].to_f    : 0.0
  self.labor_fee                    = price_item_data['laborFee']                   ? price_item_data['laborFee'].to_f              : 0.0
  self.one_time_fee                 = price_item_data['oneTimeFee']                 ? price_item_data['oneTimeFee'].to_f            : 0.0
  self.recurring_fee                = price_item_data['recurringFee']               ? price_item_data['recurringFee'].to_f          : 0.0
  self.required_core_count          = price_item_data['requiredCoreCount']          ? price_item_data['requiredCoreCount']          : nil
  self.setup_fee                    = price_item_data['setupFee']                   ? price_item_data['setupFee'].to_f              : 0.0
end

Instance Attribute Details

#capacityObject

Returns the value of attribute capacity

Returns:

  • (Object)

    the current value of capacity



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def capacity
  @capacity
end

#capacity_restriction_maximumObject

Returns the value of attribute capacity_restriction_maximum

Returns:

  • (Object)

    the current value of capacity_restriction_maximum



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def capacity_restriction_maximum
  @capacity_restriction_maximum
end

#capacity_restriction_minimumObject

Returns the value of attribute capacity_restriction_minimum

Returns:

  • (Object)

    the current value of capacity_restriction_minimum



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def capacity_restriction_minimum
  @capacity_restriction_minimum
end

#capacity_restriction_typeObject

Returns the value of attribute capacity_restriction_type

Returns:

  • (Object)

    the current value of capacity_restriction_type



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def capacity_restriction_type
  @capacity_restriction_type
end

#capacityRestrictionMaximumObject

Returns the value of attribute capacityRestrictionMaximum

Returns:

  • (Object)

    the current value of capacityRestrictionMaximum



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def capacityRestrictionMaximum
  @capacityRestrictionMaximum
end

#capacityRestrictionMinimumObject

Returns the value of attribute capacityRestrictionMinimum

Returns:

  • (Object)

    the current value of capacityRestrictionMinimum



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def capacityRestrictionMinimum
  @capacityRestrictionMinimum
end

#capacityRestrictionTypeObject

Returns the value of attribute capacityRestrictionType

Returns:

  • (Object)

    the current value of capacityRestrictionType



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def capacityRestrictionType
  @capacityRestrictionType
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def description
  @description
end

#hourly_recurring_feeObject

Returns the value of attribute hourly_recurring_fee

Returns:

  • (Object)

    the current value of hourly_recurring_fee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def hourly_recurring_fee
  @hourly_recurring_fee
end

#hourlyRecurringFeeObject

Returns the value of attribute hourlyRecurringFee

Returns:

  • (Object)

    the current value of hourlyRecurringFee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def hourlyRecurringFee
  @hourlyRecurringFee
end

#labor_feeObject

Returns the value of attribute labor_fee

Returns:

  • (Object)

    the current value of labor_fee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def labor_fee
  @labor_fee
end

#laborFeeObject

Returns the value of attribute laborFee

Returns:

  • (Object)

    the current value of laborFee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def laborFee
  @laborFee
end

#one_time_feeObject

Returns the value of attribute one_time_fee

Returns:

  • (Object)

    the current value of one_time_fee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def one_time_fee
  @one_time_fee
end

#oneTimeFeeObject

Returns the value of attribute oneTimeFee

Returns:

  • (Object)

    the current value of oneTimeFee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def oneTimeFee
  @oneTimeFee
end

#price_idObject

Returns the value of attribute price_id

Returns:

  • (Object)

    the current value of price_id



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def price_id
  @price_id
end

#recurring_feeObject

Returns the value of attribute recurring_fee

Returns:

  • (Object)

    the current value of recurring_fee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def recurring_fee
  @recurring_fee
end

#recurringFeeObject

Returns the value of attribute recurringFee

Returns:

  • (Object)

    the current value of recurringFee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def recurringFee
  @recurringFee
end

#required_core_countObject

Returns the value of attribute required_core_count

Returns:

  • (Object)

    the current value of required_core_count



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def required_core_count
  @required_core_count
end

#requiredCoreCountObject

Returns the value of attribute requiredCoreCount

Returns:

  • (Object)

    the current value of requiredCoreCount



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def requiredCoreCount
  @requiredCoreCount
end

#setup_feeObject

Returns the value of attribute setup_fee

Returns:

  • (Object)

    the current value of setup_fee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def setup_fee
  @setup_fee
end

#setupFeeObject

Returns the value of attribute setupFee

Returns:

  • (Object)

    the current value of setupFee



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def setupFee
  @setupFee
end

#unitsObject

Returns the value of attribute units

Returns:

  • (Object)

    the current value of units



17
18
19
# File 'lib/softlayer/ProductItemCategory.rb', line 17

def units
  @units
end

Instance Method Details

#free?Boolean

returns true if the configuration option has no fees associated with it.

Returns:

  • (Boolean)


52
53
54
# File 'lib/softlayer/ProductItemCategory.rb', line 52

def free?
  self.setupFee == 0 && self.laborFee == 0 && self.oneTimeFee == 0 && self.recurringFee == 0 && self.hourlyRecurringFee == 0
end