fba_fee_calculator 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cbef1ebfe534d681550427ad5f4016debc346516
4
+ data.tar.gz: 0e06aa2b15349b79fcd7165c24c5e984dc4461bc
5
+ SHA512:
6
+ metadata.gz: 4676bad87803f4faa9a2f1b5dec2c9c3ac626f63cdf79888aa06d3e53fd55222b7714892ae2d6cc20ba4b33bb3c3997dc5e2463276c1d3c6518e128e693e7c12
7
+ data.tar.gz: b87242c1074cb029d419e7389e1b26a8a771f1870c355d76568773b9329167233829623034bfcfc8c6214ca3fe11a9eb44a7136e0088de74216f9e9a741a3d72
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fba_fee_calculator.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Sellerated
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # FbaFeeCalculator
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/fba_fee_calculator`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ https://sellercentral.amazon.com/hz/fba/profitabilitycalculator/index
8
+ https://github.com/hamptus/fbacalculator/blob/master/fbacalculator%2Ffbacalculator.py
9
+ https://github.com/MattJGlick/amazon_fba_fee_calculator/blob/master/index.js
10
+
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'fba_fee_calculator'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install fba_fee_calculator
27
+
28
+ ## Usage
29
+
30
+ TODO: Write usage instructions here
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fba_fee_calculator.
41
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "rspec/core/rake_task"
2
+ require "bundler/gem_tasks"
3
+
4
+ # Default directory to look in is `/specs`
5
+ # Run with `rake spec`
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "fba_fee_calculator"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fba_fee_calculator/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fba_fee_calculator"
8
+ spec.version = FbaFeeCalculator::VERSION
9
+ spec.authors = ["Eric Berry"]
10
+ spec.email = ["eric@sellerated.com"]
11
+
12
+ spec.summary = %q{Calculates Amazon FBA Fees for Merchants}
13
+ spec.description = %q{This gem can be used to calculate FBA fees for Amazon merchants. It should return similar values to: https://sellercentral.amazon.com/hz/fba/profitabilitycalculator/index}
14
+ spec.homepage = "https://www.github.com/sellerated/fba_fee_calculator"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_dependency "activemodel", "~> 4.2"
31
+ spec.add_development_dependency "bundler", "~> 1.11"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.4"
34
+ spec.add_development_dependency "timecop", "~> 0.8.1"
35
+ end
@@ -0,0 +1,135 @@
1
+ module FbaFeeCalculator
2
+ class FbaFeeCalculation
3
+ include ::ActiveModel::Model
4
+ include ::FbaFeeCalculator::FeeConstants
5
+
6
+ attr_reader :price, :category, :weight, :dimensions, :is_media, :size_category, :size_tier,
7
+ :cubic_feet, :amazon_referral_fee, :variable_closing_fee, :order_handling, :packaging_weight,
8
+ :pick_and_pack, :weight_handling, :monthly_storage, :revenue_subtotal, :outbound_shipping_weight,
9
+ :fulfillment_cost_subtotal, :cost_subtotal, :margin_impact, :dimensional_weight
10
+
11
+ validates :price, numericality: { greater_than: 0 }
12
+ validates :category, inclusion: { in: PERCENTAGE_FEES.keys }
13
+ validates :weight, numericality: { greater_than: 0 }
14
+ validate :valid_dimensions
15
+
16
+ def initialize(price, category, weight, dimensions)
17
+ @price = price
18
+ @category = category
19
+ @weight = weight
20
+ @dimensions = dimensions
21
+ @fba_fees = FbaFees.new
22
+ end
23
+
24
+ def calculate!
25
+ return unless valid?
26
+
27
+ calculate_is_media
28
+ calculate_size_category
29
+ calculate_size_tier
30
+ calculate_cubic_feet
31
+ calculate_dimensional_weight
32
+ calculate_packaging_weight
33
+ calculate_outbound_shipping_weight
34
+ calculate_revenue_subtotal
35
+ calculate_amazon_referral_fee
36
+ calculate_variable_closing_fee
37
+ calculate_order_handling
38
+ calculate_pick_and_pack
39
+ calculate_weight_handling
40
+ calculate_monthly_storage
41
+ calculate_fulfillment_cost_subtotal
42
+ calculate_cost_subtotal
43
+ calculate_margin_impact
44
+
45
+ self
46
+ end
47
+
48
+ private
49
+
50
+ def calculate_is_media
51
+ @is_media = @fba_fees.is_media?(category)
52
+ end
53
+
54
+ def calculate_size_category
55
+ @size_category = @fba_fees.get_standard_or_oversize(dimensions, weight)
56
+ end
57
+
58
+ def calculate_size_tier
59
+ @size_tier = @fba_fees.get_size_tier(size_category, weight, dimensions, is_media)
60
+ end
61
+
62
+ def calculate_cubic_feet
63
+ @cubic_feet = @fba_fees.get_cubic_feet(dimensions)
64
+ end
65
+
66
+ def calculate_dimensional_weight
67
+ @dimensional_weight = @fba_fees.get_dimensional_weight(dimensions)
68
+ end
69
+
70
+ def calculate_packaging_weight
71
+ @packaging_weight = @fba_fees.get_packaging_weight(size_category, is_media)
72
+ end
73
+
74
+ def calculate_outbound_shipping_weight
75
+ @outbound_shipping_weight = @fba_fees.get_outbound_shipping_weight(size_tier, weight, packaging_weight, dimensional_weight)
76
+ end
77
+
78
+ def calculate_revenue_subtotal
79
+ @revenue_subtotal = price
80
+ end
81
+
82
+ def calculate_amazon_referral_fee
83
+ @amazon_referral_fee = @fba_fees.get_amazon_referral_fee(category, price)
84
+ end
85
+
86
+ def calculate_variable_closing_fee
87
+ @variable_closing_fee = @fba_fees.get_variable_closing_fee(category, is_media)
88
+ end
89
+
90
+ def calculate_order_handling
91
+ @order_handling = @fba_fees.get_order_handling(size_category, price)
92
+ end
93
+
94
+ def calculate_pick_and_pack
95
+ @pick_and_pack = @fba_fees.get_pick_and_pack(size_tier)
96
+ end
97
+
98
+ def calculate_weight_handling
99
+ @weight_handling = @fba_fees.get_weight_handling(size_tier, outbound_shipping_weight, is_media)
100
+ end
101
+
102
+ def calculate_monthly_storage
103
+ @monthly_storage = @fba_fees.get_monthly_storage(size_category, cubic_feet)
104
+ end
105
+
106
+ def calculate_fulfillment_cost_subtotal
107
+ @fulfillment_cost_subtotal = (@order_handling + @pick_and_pack + @weight_handling + @monthly_storage).round(2)
108
+ end
109
+
110
+ def calculate_cost_subtotal
111
+ @cost_subtotal = ((@fulfillment_cost_subtotal + @amazon_referral_fee + @variable_closing_fee) * -1).round(2)
112
+ end
113
+
114
+ def calculate_margin_impact
115
+ @margin_impact = (@price + @cost_subtotal).round(2)
116
+ end
117
+
118
+ def valid_dimensions
119
+ errs = []
120
+ if dimensions.length != 3
121
+ errs << "must have 3 parts (width, height, depth)"
122
+ end
123
+
124
+ dimensions.each do |dimension|
125
+ if dimension.to_f <= 0
126
+ errs << "must contain all positive, numeric values"
127
+ end
128
+ end
129
+
130
+ errs.uniq.each do |err|
131
+ errors.add(:dimensions, err)
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,184 @@
1
+ require "active_model"
2
+
3
+ module FbaFeeCalculator
4
+ class FbaFees
5
+ include ::FbaFeeCalculator::FeeConstants
6
+
7
+ def is_media?(category)
8
+ VARIABLE_CLOSING_FEES.keys.include? category
9
+ end
10
+
11
+ # https://www.amazon.com/gp/help/customer/display.html?nodeId=201119390
12
+ def get_size_tier(size_category, weight, dimensions, is_media = false)
13
+ if size_category == "Standard"
14
+ fee_weight = is_media ? (14.to_f / 16.to_f) : (12.to_f / 16.to_f)
15
+ if [ (fee_weight > weight),
16
+ (dimensions.max <= 15),
17
+ (dimensions.min <= 0.75),
18
+ (median(dimensions) <= 12) ].all?
19
+ return "SML_STND"
20
+ else
21
+ return "LRG_STND"
22
+ end
23
+ else
24
+ girth_length = get_girth_length(dimensions)
25
+ if [ (girth_length > 165),
26
+ (weight > 150),
27
+ (dimensions.max > 108) ].any?
28
+ return "SPL_OVER"
29
+ elsif girth_length > 130
30
+ return "LRG_OVER"
31
+ elsif [ (weight > 70),
32
+ (dimensions.max > 60),
33
+ (median(dimensions) <= 30) ].any?
34
+ reurn "MED_OVER"
35
+ else
36
+ return "SML_OVER"
37
+ end
38
+ end
39
+ end
40
+
41
+ def get_pick_and_pack(size_tier)
42
+ return 0 unless PICK_PACK.keys.include?(size_tier)
43
+ PICK_PACK[size_tier]
44
+ end
45
+
46
+ def get_variable_closing_fee(category, is_media = false)
47
+ return VARIABLE_CLOSING_FEES[category].to_f if is_media
48
+ 0.0
49
+ end
50
+
51
+ def get_amazon_referral_fee(category, price)
52
+ pct_fee = (PERCENTAGE_FEES[category].to_f / 100) * price
53
+ pct_fee = (pct_fee * 100).ceil.to_f / 100
54
+ min_fee = MINIMUM_FEES[category].to_f
55
+ [pct_fee, min_fee].max
56
+ end
57
+
58
+ def get_outbound_shipping_weight(size_tier, weight, packaging_weight, dimensional_weight)
59
+ if ["SML_STND", "LRG_STND"].include? size_tier
60
+ if weight <= 1
61
+ return weight + packaging_weight
62
+ else
63
+ return [weight, dimensional_weight].max + packaging_weight
64
+ end
65
+ elsif size_tier == "SPL_OVER"
66
+ return weight + packaging_weight
67
+ else
68
+ return [weight, dimensional_weight].max + packaging_weight
69
+ end
70
+ end
71
+
72
+ def get_weight_handling(size_tier, outbound_shipping_weight, is_media = false)
73
+ weight = outbound_shipping_weight.ceil
74
+
75
+ case size_tier
76
+ when "SML_STND"
77
+ return 0.5
78
+ when "LRG_STND"
79
+ if is_media
80
+ return 0.85 if weight <= 1
81
+ return 1.24 if weight <= 2
82
+ return 1.24 + (weight - 2) * 0.41
83
+ else
84
+ return 0.96 if weight <= 1
85
+ return 1.95 if weight <= 2
86
+ return 1.95 + (weight - 2) * 0.39
87
+ end
88
+ when "SML_OVER"
89
+ return 2.06 if weight <= 2
90
+ return 2.06 + (weight - 2) * 0.39
91
+ when "MED_OVER"
92
+ return 2.73 if weight <= 2
93
+ return 2.73 + (weight - 2) * 0.39
94
+ when "LRG_OVER"
95
+ return 63.98 if weight <= 90
96
+ return 63.98 + (weight - 90) * 0.80
97
+ when "SPL_OVER"
98
+ return 124.58 if weight <= 90
99
+ return 124.58 + (weight - 90) * 0.92
100
+ end
101
+ end
102
+
103
+ # https://www.amazon.com/gp/help/customer/display.html/?nodeId=201119410
104
+ def get_order_handling(size_category, price, is_media = false)
105
+ if !is_media && size_category == "Standard" && price < 300
106
+ return 1
107
+ end
108
+ return 0
109
+ end
110
+
111
+ # January - September
112
+ # Standard - $0.54 per cubic foot
113
+ # Oversize - $0.43 per cubic foot
114
+ # October - December
115
+ # Standard - $0.72 per cubic foot
116
+ # Oversize - $0.57 per cubic foot
117
+ #
118
+ # See http://www.amazon.com/gp/help/customer/display.html?nodeId=200627230
119
+ def get_monthly_storage(size_category, cubic_feet)
120
+ monthly_storage = 0
121
+ current_month = Time.now.utc.month
122
+
123
+ if current_month <= 9
124
+ if size_category == "Standard"
125
+ monthly_storage = 0.54 * cubic_feet
126
+ else
127
+ monthly_storage = 0.43 * cubic_feet
128
+ end
129
+ else
130
+ if size_category == "Standard"
131
+ monthly_storage = 0.72 * cubic_feet
132
+ else
133
+ monthly_storage = 0.57 * cubic_feet
134
+ end
135
+ end
136
+
137
+ monthly_storage.round(2)
138
+ end
139
+
140
+ # http://www.amazon.com/gp/help/customer/display.html?nodeId=201119390
141
+ def get_girth_and_length(dimensions)
142
+ (dimensions.max + (median(dimensions) * 2) + (dimensions.min * 2)).round(1)
143
+ end
144
+
145
+ # https://www.amazon.com/gp/help/customer/display.html?nodeId=201119390
146
+ def get_standard_or_oversize(dimensions, weight)
147
+ if [ (weight > 20),
148
+ (dimensions.max > 18),
149
+ (dimensions.min > 8),
150
+ (median(dimensions) > 14) ].any?
151
+ "Oversize"
152
+ else
153
+ "Standard"
154
+ end
155
+ end
156
+
157
+ def get_dimensional_weight(dimensions)
158
+ (dimensions.inject(:*).to_f / 166).round(2)
159
+ end
160
+
161
+ def get_cubic_feet(dimensions)
162
+ (dimensions.inject(:*).to_f / 1728).round(3)
163
+ end
164
+
165
+ # http://www.amazon.com/gp/help/customer/display.html/?nodeId=201119410#calc
166
+ def get_packaging_weight(size_category, is_media)
167
+ return 0.125 if is_media
168
+ if size_category == "Standard"
169
+ return 0.25
170
+ else
171
+ return 1.0
172
+ end
173
+ end
174
+
175
+ private
176
+
177
+ def median(array)
178
+ sorted = array.sort
179
+ len = sorted.length
180
+ (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0
181
+ end
182
+
183
+ end
184
+ end
@@ -0,0 +1,105 @@
1
+ module FbaFeeCalculator
2
+ module FeeConstants
3
+
4
+ PICK_PACK = {
5
+ "SML_STND" => 1.06,
6
+ "LRG_STND" => 1.06,
7
+ "SML_OVER" => 4.09,
8
+ "MED_OVER" => 5.20,
9
+ "LRG_OVER" => 8.40,
10
+ "SPL_OVER" => 10.53
11
+ }
12
+
13
+ PERCENTAGE_FEES = {
14
+ "3D Printed Products" => 12,
15
+ "Amazon Device Accessories" => 45,
16
+ "Amazon Kindle" => 15,
17
+ "Automotive & Powersports" => 12,
18
+ "Baby Products" => 15,
19
+ "Beauty" => 15,
20
+ "Books" => 15,
21
+ "Camera & Photo" => 8,
22
+ "Cell Phone Devices*" => 8,
23
+ "Clothing & Accessories" => 15,
24
+ "Collectible Coins" => 15,
25
+ "Consumer Electronics" => 8,
26
+ "Electronics Accessories" => 15,
27
+ "Entertainment Collectibles" => 20,
28
+ "Health & Personal Care" => 15,
29
+ "Home & Garden (including Pet Supplies)" => 15,
30
+ "Independent Design" => 25,
31
+ "Industrial & Scientific (including Food Service and Janitorial & Sanitation)" => 12,
32
+ "Jewelry" => 20,
33
+ "Kitchen" => 15,
34
+ "Luggage & Travel Accessories" => 15,
35
+ "Major Appliances" => 15,
36
+ "Music" => 15,
37
+ "Musical Instruments" => 15,
38
+ "Office Products" => 15,
39
+ "Outdoors" => 15,
40
+ "Personal Computers" => 6,
41
+ "Shoes, Handbags and Sunglasses" =>15,
42
+ "Software & Computer/Video Games" => 15,
43
+ "Sports" => 15,
44
+ "Sports Collectibles" => 20,
45
+ "Tools & Home Improvement" => 15,
46
+ "Toys & Games" => 15,
47
+ "Video & DVD" => 15,
48
+ "Video Games" => 15,
49
+ "Video Game Consoles" => 8,
50
+ "Watches" => 15,
51
+ "Everything Else" => 15
52
+ }
53
+
54
+ MINIMUM_FEES = {
55
+ "3D Printed Products" => 0,
56
+ "Amazon Device Accessories" => 1,
57
+ "Amazon Kindle" => 0,
58
+ "Automotive & Powersports" => 1,
59
+ "Baby Products" => 1,
60
+ "Beauty" => 1,
61
+ "Books" => 0,
62
+ "Camera & Photo" => 1,
63
+ "Cell Phone Devices*" => 0,
64
+ "Clothing & Accessories" => 1,
65
+ "Collectible Coins" => 1,
66
+ "Consumer Electronics" => 1,
67
+ "Electronics Accessories" => 1,
68
+ "Entertainment Collectibles" => 0,
69
+ "Health & Personal Care" => 1,
70
+ "Home & Garden (including Pet Supplies)" => 1,
71
+ "Independent Design" => 1,
72
+ "Industrial & Scientific (including Food Service and Janitorial & Sanitation)" => 1,
73
+ "Jewelry" => 2,
74
+ "Kitchen" => 1,
75
+ "Luggage & Travel Accessories" => 1,
76
+ "Major Appliances" => 1,
77
+ "Music" => 0,
78
+ "Musical Instruments" => 1,
79
+ "Office Products" => 1,
80
+ "Outdoors" => 1,
81
+ "Personal Computers" => 1,
82
+ "Shoes, Handbags and Sunglasses" =>1,
83
+ "Software & Computer/Video Games" => 0,
84
+ "Sports" => 1,
85
+ "Sports Collectibles" => 0,
86
+ "Tools & Home Improvement" => 1,
87
+ "Toys & Games" => 1,
88
+ "Video & DVD" => 0,
89
+ "Video Games" => 0,
90
+ "Video Game Consoles" => 0,
91
+ "Watches" => 2,
92
+ "Everything Else" => 0
93
+ }
94
+
95
+ VARIABLE_CLOSING_FEES = {
96
+ "Books" => 1.35,
97
+ "Video & DVD" => 1.35,
98
+ "Music" => 1.35,
99
+ "Software & Computer/Video Games" => 1.35,
100
+ "Video Games" => 1.35,
101
+ "Video Game Consoles" => 1.35
102
+ }
103
+
104
+ end
105
+ end
@@ -0,0 +1,3 @@
1
+ module FbaFeeCalculator
2
+ VERSION = "1.0.1"
3
+ end
@@ -0,0 +1,17 @@
1
+ require "fba_fee_calculator/fee_constants"
2
+ require "fba_fee_calculator/fba_fees"
3
+ require "fba_fee_calculator/fba_fee_calculation"
4
+ require "fba_fee_calculator/version"
5
+
6
+ module FbaFeeCalculator
7
+ def self.calculate(args)
8
+ price = args[:price]
9
+ category = args[:category]
10
+ weight = args[:weight]
11
+ dimensions = args[:dimensions]
12
+
13
+ calculation = FbaFeeCalculation.new(price, category, weight, dimensions)
14
+ calculation.calculate!
15
+ calculation
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fba_fee_calculator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Eric Berry
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: timecop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.8.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.8.1
83
+ description: 'This gem can be used to calculate FBA fees for Amazon merchants. It
84
+ should return similar values to: https://sellercentral.amazon.com/hz/fba/profitabilitycalculator/index'
85
+ email:
86
+ - eric@sellerated.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/console
97
+ - bin/setup
98
+ - fba_fee_calculator.gemspec
99
+ - lib/fba_fee_calculator.rb
100
+ - lib/fba_fee_calculator/fba_fee_calculation.rb
101
+ - lib/fba_fee_calculator/fba_fees.rb
102
+ - lib/fba_fee_calculator/fee_constants.rb
103
+ - lib/fba_fee_calculator/version.rb
104
+ homepage: https://www.github.com/sellerated/fba_fee_calculator
105
+ licenses:
106
+ - MIT
107
+ metadata:
108
+ allowed_push_host: https://rubygems.org
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.5.1
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Calculates Amazon FBA Fees for Merchants
129
+ test_files: []