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.

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?


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/softlayer/ProductItemCategory.rb', line 18

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']

  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
end

Instance Attribute Details

#capacityObject

Returns the value of attribute capacity

Returns:

  • (Object)

    the current value of capacity


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def capacity
  @capacity
end

#capacityRestrictionMaximumObject

Returns the value of attribute capacityRestrictionMaximum

Returns:

  • (Object)

    the current value of capacityRestrictionMaximum


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def capacityRestrictionMaximum
  @capacityRestrictionMaximum
end

#capacityRestrictionMinimumObject

Returns the value of attribute capacityRestrictionMinimum

Returns:

  • (Object)

    the current value of capacityRestrictionMinimum


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def capacityRestrictionMinimum
  @capacityRestrictionMinimum
end

#capacityRestrictionTypeObject

Returns the value of attribute capacityRestrictionType

Returns:

  • (Object)

    the current value of capacityRestrictionType


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def capacityRestrictionType
  @capacityRestrictionType
end

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def description
  @description
end

#hourlyRecurringFeeObject

Returns the value of attribute hourlyRecurringFee

Returns:

  • (Object)

    the current value of hourlyRecurringFee


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def hourlyRecurringFee
  @hourlyRecurringFee
end

#laborFeeObject

Returns the value of attribute laborFee

Returns:

  • (Object)

    the current value of laborFee


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def laborFee
  @laborFee
end

#oneTimeFeeObject

Returns the value of attribute oneTimeFee

Returns:

  • (Object)

    the current value of oneTimeFee


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def oneTimeFee
  @oneTimeFee
end

#price_idObject

Returns the value of attribute price_id

Returns:

  • (Object)

    the current value of price_id


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def price_id
  @price_id
end

#recurringFeeObject

Returns the value of attribute recurringFee

Returns:

  • (Object)

    the current value of recurringFee


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def recurringFee
  @recurringFee
end

#requiredCoreCountObject

Returns the value of attribute requiredCoreCount

Returns:

  • (Object)

    the current value of requiredCoreCount


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def requiredCoreCount
  @requiredCoreCount
end

#setupFeeObject

Returns the value of attribute setupFee

Returns:

  • (Object)

    the current value of setupFee


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def setupFee
  @setupFee
end

#unitsObject

Returns the value of attribute units

Returns:

  • (Object)

    the current value of units


13
14
15
# File 'lib/softlayer/ProductItemCategory.rb', line 13

def units
  @units
end

Instance Method Details

#free?Boolean

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

Returns:

  • (Boolean)

36
37
38
# File 'lib/softlayer/ProductItemCategory.rb', line 36

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