class SoftLayer::ProductConfigurationOption

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

Public Class Methods

new(package_item_data, price_item_data) click to toggle source
# 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

Public Instance Methods

free?() click to toggle source

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

# 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