Sha256: 1d8f3bbd463c36ae096f88ed4da48f8ad61e863ac5ecc2949f8cddfa11a6d668

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module SolidusEasypost
  class Configuration
    attr_accessor :purchase_labels, :track_all_cartons
    attr_writer :shipping_rate_calculator_class, :shipping_method_selector_class, :parcel_dimension_calculator_class,
      :webhook_handler_class

    def initialize
      self.purchase_labels = true
      self.track_all_cartons = false
    end

    def shipping_rate_calculator_class
      @shipping_rate_calculator_class ||= 'SolidusEasypost::ShippingRateCalculator'
      @shipping_rate_calculator_class.constantize
    end

    def shipping_method_selector_class
      @shipping_method_selector_class ||= 'SolidusEasypost::ShippingMethodSelector'
      @shipping_method_selector_class.constantize
    end

    def parcel_dimension_calculator_class
      @parcel_dimension_calculator_class ||= 'SolidusEasypost::Calculator::WeightDimensionCalculator'
      @parcel_dimension_calculator_class.constantize
    end

    def webhook_handler_class
      @webhook_handler_class ||= 'SolidusEasypost::TrackerWebhookHandler'
      @webhook_handler_class.constantize
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_easypost-3.0.0 lib/solidus_easypost/configuration.rb