Class: Eco::API::Common::Session::Environment
- Inherits:
-
Object
- Object
- Eco::API::Common::Session::Environment
- Defined in:
- lib/eco/api/common/session/environment.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#file_manager ⇒ Object
(also: #fm)
readonly
Returns the value of attribute file_manager.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#mailer ⇒ Object
readonly
Returns the value of attribute mailer.
-
#s3uploader ⇒ Object
readonly
Returns the value of attribute s3uploader.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#sftp ⇒ Object
readonly
Returns the value of attribute sftp.
Instance Method Summary collapse
- #api(version: nil) ⇒ Object
-
#initialize(init = {}, session:) ⇒ Environment
constructor
A new instance of Environment.
- #mailer? ⇒ Boolean
- #s3uploader? ⇒ Boolean
- #sftp? ⇒ Boolean
Constructor Details
#initialize(init = {}, session:) ⇒ Environment
Returns a new instance of Environment.
14 15 16 17 18 19 20 21 22 23 24 |
# 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 |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/eco/api/common/session/environment.rb', line 6 def config @config end |
#file_manager ⇒ Object (readonly) Also known as: fm
Returns the value of attribute file_manager.
7 8 9 |
# File 'lib/eco/api/common/session/environment.rb', line 7 def file_manager @file_manager end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/eco/api/common/session/environment.rb', line 7 def logger @logger end |
#mailer ⇒ Object (readonly)
Returns the value of attribute mailer.
8 9 10 |
# File 'lib/eco/api/common/session/environment.rb', line 8 def mailer @mailer end |
#s3uploader ⇒ Object (readonly)
Returns the value of attribute s3uploader.
8 9 10 |
# File 'lib/eco/api/common/session/environment.rb', line 8 def s3uploader @s3uploader end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
6 7 8 |
# File 'lib/eco/api/common/session/environment.rb', line 6 def session @session end |
#sftp ⇒ Object (readonly)
Returns the value of attribute sftp.
8 9 10 |
# File 'lib/eco/api/common/session/environment.rb', line 8 def sftp @sftp end |
Instance Method Details
#api(version: nil) ⇒ Object
56 57 58 |
# File 'lib/eco/api/common/session/environment.rb', line 56 def api(version: nil) config.api(logger, version: version) end |
#mailer? ⇒ Boolean
32 33 34 |
# File 'lib/eco/api/common/session/environment.rb', line 32 def mailer? config.mailer.configured? end |
#s3uploader? ⇒ Boolean
52 53 54 |
# File 'lib/eco/api/common/session/environment.rb', line 52 def s3uploader? config.s3storage.configured? end |
#sftp? ⇒ Boolean
42 43 44 |
# File 'lib/eco/api/common/session/environment.rb', line 42 def sftp? config.sftp.configured? end |