class Eco::API::Common::Session::Environment

Attributes

config[R]
file_manager[R]
fm[R]
logger[R]
mailer[R]
s3uploader[R]
session[R]
sftp[R]

Public Class Methods

new(init = {}, session:) click to toggle source

@param init [Eco::API::Common::Session::Environment] object to ini the session environment @param session [Eco::API::Session, nil] the current session

# File lib/eco/api/common/session/environment.rb, line 14
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

Public Instance Methods

api(version: nil) click to toggle source
# File lib/eco/api/common/session/environment.rb, line 56
def api(version: nil)
  config.api(logger, version: version)
end
mailer?() click to toggle source
# File lib/eco/api/common/session/environment.rb, line 32
def mailer?
  config.mailer.configured?
end
s3uploader?() click to toggle source
# File lib/eco/api/common/session/environment.rb, line 52
def s3uploader?
  config.s3storage.configured?
end
sftp?() click to toggle source
# File lib/eco/api/common/session/environment.rb, line 42
def sftp?
  config.sftp.configured?
end