Sha256: b6f5dc24798d1a1169dd69cb2e85b34b833c103beed7dbc6622248f11cb01151

Contents?: true

Size: 1.46 KB

Versions: 6

Compression:

Stored size: 1.46 KB

Contents

module Eco
  module API
    module Common
      module Session
        class BaseSession

          include Common::People

          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

          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
            enviro.api
          end

          def file_manager
            enviro.file_manager
          end

          def mailer
            enviro.mailer
          end

          def sftp
            enviro.sftp
          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

6 entries across 6 versions & 1 rubygems

Version Path
eco-helpers-1.1.3 lib/eco/api/common/session/base_session.rb
eco-helpers-1.1.2 lib/eco/api/common/session/base_session.rb
eco-helpers-1.1.1 lib/eco/api/common/session/base_session.rb
eco-helpers-1.0.14 lib/eco/api/common/session/base_session.rb
eco-helpers-1.0.13 lib/eco/api/common/session/base_session.rb
eco-helpers-1.0.12 lib/eco/api/common/session/base_session.rb