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?



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/softlayer/ProductItemCategory.rb', line 17

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

  self.price_id = price_item_data['id']
  self.setupFee = price_item_data['setupFee'] ? price_item_data['setupFee'].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.recurringFee = price_item_data['recurringFee'] ? price_item_data['recurringFee'].to_f : 0.0
  self.hourlyRecurringFee = price_item_data['hourlyRecurringFee'] ? price_item_data['hourlyRecurringFee'].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

#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

#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)


31
32
33
# File 'lib/softlayer/ProductItemCategory.rb', line 31

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