Sha256: c56c4b2a3471a4fbf3018f7f1dfba30104bdfc641dd8072d457ca1dd242e9bf6

Contents?: true

Size: 1.75 KB

Versions: 17

Compression:

Stored size: 1.75 KB

Contents

module Eco
  module API
    module Common
      module Session
        class BaseSession
          attr_writer :session, :config
          attr_reader :environment
          alias_method :enviro, :environment

          include Session::Helpers

          def initialize(env)
            msg = "Expected object Eco::API::Common::Session::Environment. Given: #{env.class}"
            raise msg unless env.is_a?(Environment)

            self.environment = env
          end

          def session
            enviro.session
          end

          def environment=(value)
            @environment = nil
            @environment = value if value.is_a?(Environment)
          end
          alias_method :enviro=, :environment=

          def config
            enviro.config
          end

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

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

          def file_manager
            enviro.file_manager
          end
          alias_method :fm, :file_manager

          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

17 entries across 17 versions & 1 rubygems

Version Path
eco-helpers-2.7.24 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.23 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.22 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.21 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.20 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.19 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.18 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.17 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.16 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.15 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.14 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.13 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.12 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.4 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.2 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.1 lib/eco/api/common/session/base_session.rb
eco-helpers-2.7.0 lib/eco/api/common/session/base_session.rb