Class: FbaFeeCalculator::FbaFeeCalculation

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, FeeConstants
Defined in:
lib/fba_fee_calculator/fba_fee_calculation.rb

Constant Summary

Constants included from FeeConstants

FbaFeeCalculator::FeeConstants::MINIMUM_FEES, FbaFeeCalculator::FeeConstants::PERCENTAGE_FEES, FbaFeeCalculator::FeeConstants::PICK_PACK, FbaFeeCalculator::FeeConstants::VARIABLE_CLOSING_FEES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(price, category, weight, dimensions) ⇒ FbaFeeCalculation

Returns a new instance of FbaFeeCalculation.



16
17
18
19
20
21
22
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 16

def initialize(price, category, weight, dimensions)
  @price = price
  @category = category
  @weight = weight
  @dimensions = dimensions
  @fba_fees = FbaFees.new
end

Instance Attribute Details

#amazon_referral_feeObject (readonly)

Returns the value of attribute amazon_referral_fee.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def amazon_referral_fee
  @amazon_referral_fee
end

#categoryObject (readonly)

Returns the value of attribute category.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def category
  @category
end

#cost_subtotalObject (readonly)

Returns the value of attribute cost_subtotal.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def cost_subtotal
  @cost_subtotal
end

#cubic_feetObject (readonly)

Returns the value of attribute cubic_feet.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def cubic_feet
  @cubic_feet
end

#dimensional_weightObject (readonly)

Returns the value of attribute dimensional_weight.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def dimensional_weight
  @dimensional_weight
end

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def dimensions
  @dimensions
end

#fulfillment_cost_subtotalObject (readonly)

Returns the value of attribute fulfillment_cost_subtotal.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def fulfillment_cost_subtotal
  @fulfillment_cost_subtotal
end

#is_mediaObject (readonly)

Returns the value of attribute is_media.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def is_media
  @is_media
end

#margin_impactObject (readonly)

Returns the value of attribute margin_impact.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def margin_impact
  @margin_impact
end

#monthly_storageObject (readonly)

Returns the value of attribute monthly_storage.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def monthly_storage
  @monthly_storage
end

#order_handlingObject (readonly)

Returns the value of attribute order_handling.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def order_handling
  @order_handling
end

#outbound_shipping_weightObject (readonly)

Returns the value of attribute outbound_shipping_weight.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def outbound_shipping_weight
  @outbound_shipping_weight
end

#packaging_weightObject (readonly)

Returns the value of attribute packaging_weight.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def packaging_weight
  @packaging_weight
end

#pick_and_packObject (readonly)

Returns the value of attribute pick_and_pack.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def pick_and_pack
  @pick_and_pack
end

#priceObject (readonly)

Returns the value of attribute price.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def price
  @price
end

#revenue_subtotalObject (readonly)

Returns the value of attribute revenue_subtotal.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def revenue_subtotal
  @revenue_subtotal
end

#size_categoryObject (readonly)

Returns the value of attribute size_category.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def size_category
  @size_category
end

#size_tierObject (readonly)

Returns the value of attribute size_tier.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def size_tier
  @size_tier
end

#variable_closing_feeObject (readonly)

Returns the value of attribute variable_closing_fee.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def variable_closing_fee
  @variable_closing_fee
end

#weightObject (readonly)

Returns the value of attribute weight.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def weight
  @weight
end

#weight_handlingObject (readonly)

Returns the value of attribute weight_handling.



6
7
8
# File 'lib/fba_fee_calculator/fba_fee_calculation.rb', line 6

def weight_handling
  @weight_handling
end

Instance Method Details

#calculate!Object



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

def calculate!
  return unless valid?

  calculate_is_media
  calculate_size_category
  calculate_size_tier
  calculate_cubic_feet
  calculate_dimensional_weight
  calculate_packaging_weight
  calculate_outbound_shipping_weight
  calculate_revenue_subtotal
  calculate_amazon_referral_fee
  calculate_variable_closing_fee
  calculate_order_handling
  calculate_pick_and_pack
  calculate_weight_handling
  calculate_monthly_storage
  calculate_fulfillment_cost_subtotal
  calculate_cost_subtotal
  calculate_margin_impact

  self
end