Sha256: 8b5b608076cc03c74bca11062260b9424fa7d84deea1df9ed36727d560e419b9
Contents?: true
Size: 384 Bytes
Versions: 4
Compression:
Stored size: 384 Bytes
Contents
module CorreiosApi class ShippingQuotes attr_reader :rates def initialize rates @rates = rates end def cheaper_rate valid_rates.sort_by(&:price).first end def faster_rate valid_rates.sort_by(&:delivery_time_in_days).first end def valid_rates @rates.select { |rate| rate.price > 0 && rate.errors.empty? } end end end
Version data entries
4 entries across 4 versions & 1 rubygems