Sha256: 0b922e843b3cd58aed40710868971d743350de6f6e9108401f964a9a9c5a6080
Contents?: true
Size: 1.47 KB
Versions: 5
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true module FreightKit class Platform < Carrier # Credentials should be a `Credential` or `Array` of `Credential` def initialize(credentials, customer_location: nil, tariff: nil) super # Use #superclass instead of using #ancestors to fetch the parent class which the carrier class is inheriting from # (#ancestors returns an array including the parent class and all the modules that were included) parent_class_name = self.class.superclass.name.demodulize.underscore conf_path = File .join( File.expand_path( '../../../../configuration/platforms', self.class.const_source_location(:REACTIVE_FREIGHT_PLATFORM).first, ), "#{parent_class_name}.yml", ) @conf = YAML.safe_load(File.read(conf_path), permitted_classes: [Symbol]) conf_path = File .join( File.expand_path( '../../../../configuration/carriers', self.class.const_source_location(:REACTIVE_FREIGHT_CARRIER).first, ), "#{self.class.to_s.demodulize.underscore}.yml", ) @conf = @conf.deep_merge(YAML.safe_load(File.read(conf_path), permitted_classes: [Symbol])) @rates_with_excessive_length_fees = @conf.dig(:attributes, :rates, :with_excessive_length_fees) end end end
Version data entries
5 entries across 5 versions & 1 rubygems