Class: Eco::API::Common::Session::BaseSession

Inherits:
Object
  • Object
show all
Includes:
Helpers, Language::AuxiliarLogger
Defined in:
lib/eco/api/common/session/base_session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Language::AuxiliarLogger

#log

Constructor Details

#initialize(env) ⇒ BaseSession

Returns a new instance of BaseSession.



13
14
15
16
17
18
# File 'lib/eco/api/common/session/base_session.rb', line 13

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

Instance Attribute Details

#configObject



30
31
32
# File 'lib/eco/api/common/session/base_session.rb', line 30

def config
  enviro.config
end

#environmentObject Also known as: enviro

Returns the value of attribute environment.



7
8
9
# File 'lib/eco/api/common/session/base_session.rb', line 7

def environment
  @environment
end

#sessionObject



20
21
22
# File 'lib/eco/api/common/session/base_session.rb', line 20

def session
  enviro.session
end

Instance Method Details

#api(version: nil) ⇒ Object



34
35
36
# File 'lib/eco/api/common/session/base_session.rb', line 34

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

#api?(version: nil) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/eco/api/common/session/base_session.rb', line 38

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

#fatal(msg) ⇒ Object

TODO: paremeter for the exception



76
77
78
79
# File 'lib/eco/api/common/session/base_session.rb', line 76

def fatal(msg)
  log(:fatal) { msg }
  raise msg
end

#file_managerObject Also known as: fm



42
43
44
# File 'lib/eco/api/common/session/base_session.rb', line 42

def file_manager
  enviro.file_manager
end

#loggerObject



71
72
73
# File 'lib/eco/api/common/session/base_session.rb', line 71

def logger
  enviro.logger
end

#mailerObject



47
48
49
# File 'lib/eco/api/common/session/base_session.rb', line 47

def mailer
  enviro.mailer
end

#mailer?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/eco/api/common/session/base_session.rb', line 51

def mailer?
  enviro.mailer?
end

#s3uploaderObject



63
64
65
# File 'lib/eco/api/common/session/base_session.rb', line 63

def s3uploader
  enviro.s3uploader
end

#s3uploader?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/eco/api/common/session/base_session.rb', line 67

def s3uploader?
  enviro.s3uploader?
end

#sftpObject



55
56
57
# File 'lib/eco/api/common/session/base_session.rb', line 55

def sftp
  enviro.sftp
end

#sftp?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/eco/api/common/session/base_session.rb', line 59

def sftp?
  enviro.sftp?
end