Sha256: fa8be5b909fdb4fb4d50aff92a3bbbcc2cb3acd892a762de7cfe5c7b33d09a83
Contents?: true
Size: 1.93 KB
Versions: 108
Compression:
Stored size: 1.93 KB
Contents
module Eco module API module Common module Session class Environment attr_reader :config, :session attr_reader :file_manager, :logger attr_reader :mailer, :sftp, :s3uploader alias_method :fm, :file_manager #@param init [Eco::API::Common::Session::Environment] object to ini the session environment #@param session [Eco::API::Session, nil] the current session def initialize(init = {}, session:) init = init.conf if init.is_a?(Environment) msg = "Expected object Eco::API::Session::Config or Environment. Given: #{init}" raise msg unless init.is_a?(Eco::API::Session::Config) raise "Expected an Eco::API::Session object. Given: #{session}" if session && !session.is_a?(Eco::API::Session) @config = init @session = session @file_manager = Eco::API::Common::Session::FileManager.new(enviro: self) @logger = Eco::API::Common::Session::Logger.new(enviro: self) end def mailer if mailer? @mailer ||= Eco::API::Common::Session::Mailer.new(enviro: self) end end def mailer? config.mailer.configured? end def sftp if sftp? @sftp ||= Eco::API::Common::Session::SFTP.new(enviro: self) end end def sftp? config.sftp.configured? end def s3uploader if s3uploader? @s3uploader ||= Eco::API::Common::Session::S3Uploader.new(enviro: self) end end def s3uploader? config.s3storage.configured? end def api(version: nil) config.api(logger, version: version) end end end end end end
Version data entries
108 entries across 108 versions & 1 rubygems