Class: Spree::Calculator::WeigthCalculator
- Inherits:
-
ShippingCalculator
- Object
- ShippingCalculator
- Spree::Calculator::WeigthCalculator
- Defined in:
- app/models/spree/calculator/weigth_calculator.rb
Instance Attribute Summary collapse
-
#package ⇒ Object
readonly
Returns the value of attribute package.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#package ⇒ Object (readonly)
Returns the value of attribute package.
5 6 7 |
# File 'app/models/spree/calculator/weigth_calculator.rb', line 5 def package @package end |
Class Method Details
.description ⇒ Object
7 8 9 |
# File 'app/models/spree/calculator/weigth_calculator.rb', line 7 def self.description I18n.t("calculator_name") end |
Instance Method Details
#compute_package(package) ⇒ Object
11 12 13 14 15 |
# File 'app/models/spree/calculator/weigth_calculator.rb', line 11 def compute_package(package) @package = package json = JSON.parse Open3.capture3("curl", "-X", "GET", "#{preferred_url}/#{zip}?#{params}").first Spree::LocalizedNumber.parse(json["cost"]) end |