Sha256: e0e69cd7e3905e00a80ec17cb6a9f5cb8f0a4f13c68fcf9d7fbf1b5872df5ad6

Contents?: true

Size: 1.69 KB

Versions: 76

Compression:

Stored size: 1.69 KB

Contents

module Eco
  module API
    module Common
      module Session
        class BaseSession
          attr_accessor :session
          attr_accessor :environment, :config
          alias_method :enviro, :environment
          alias_method :enviro=, :environment=

          attr_reader  :api, :file_manager, :logger
          alias_method :fm, :file_manager

          include Session::Helpers
          
          def initialize(e)
            raise "Expected object Eco::API::Common::Session::Environment. Given: #{e.class}" unless e.is_a?(Environment)
            self.environment = e
          end

          def session
            enviro.session
          end

          def environment=(value)
            @environment = nil
            @environment = value if value.is_a?(Environment)
          end

          def config
            enviro.config
          end

          def api(version: nil)
            enviro.api(version: version)
          end

          def file_manager
            enviro.file_manager
          end

          def mailer
            enviro.mailer
          end

          def mailer?
            enviro.mailer?
          end

          def sftp
            enviro.sftp
          end

          def sftp?
            enviro.sftp?
          end

          def s3uploader
            enviro.s3uploader
          end

          def s3uploader?
            enviro.s3uploader?
          end

          def logger
            enviro.logger
          end

          # TODO: paremeter for the exception
          def fatal(msg)
            logger.fatal(msg)
            raise msg
          end

        end
      end
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
eco-helpers-2.4.9 lib/eco/api/common/session/base_session.rb
eco-helpers-2.4.8 lib/eco/api/common/session/base_session.rb
eco-helpers-2.4.7 lib/eco/api/common/session/base_session.rb
eco-helpers-2.4.6 lib/eco/api/common/session/base_session.rb
eco-helpers-2.4.5 lib/eco/api/common/session/base_session.rb
eco-helpers-2.4.4 lib/eco/api/common/session/base_session.rb
eco-helpers-2.4.3 lib/eco/api/common/session/base_session.rb
eco-helpers-2.4.2 lib/eco/api/common/session/base_session.rb
eco-helpers-2.3.3 lib/eco/api/common/session/base_session.rb
eco-helpers-2.3.2 lib/eco/api/common/session/base_session.rb
eco-helpers-2.2.5 lib/eco/api/common/session/base_session.rb
eco-helpers-2.2.4 lib/eco/api/common/session/base_session.rb
eco-helpers-2.2.3 lib/eco/api/common/session/base_session.rb
eco-helpers-2.2.2 lib/eco/api/common/session/base_session.rb
eco-helpers-2.2.1 lib/eco/api/common/session/base_session.rb
eco-helpers-2.1.12 lib/eco/api/common/session/base_session.rb
eco-helpers-2.1.11 lib/eco/api/common/session/base_session.rb
eco-helpers-2.1.10 lib/eco/api/common/session/base_session.rb
eco-helpers-2.1.9 lib/eco/api/common/session/base_session.rb
eco-helpers-2.1.8 lib/eco/api/common/session/base_session.rb