Class: Humidifier::Configuration
- Inherits:
-
Object
- Object
- Humidifier::Configuration
- Defined in:
- lib/humidifier/configuration.rb
Overview
a container for user params
Constant Summary collapse
- UPLOAD_MESSAGE =
The message that gets displayed when the stack body is too large to use the template_body option
<<-MSG.freeze The %{identifier} stack's body is too large to be use the template_body option, and therefore must use the template_url option instead. You can configure Humidifier to do this automatically by setting up the s3 config on the top-level Humidifier object like so: Humidifier.configure do |config| config.s3_bucket = 'my.s3.bucket' config.s3_prefix = 'my-prefix/' # optional end MSG
Instance Attribute Summary collapse
-
#s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
-
#s3_prefix ⇒ Object
Returns the value of attribute s3_prefix.
-
#sdk_version ⇒ Object
Returns the value of attribute sdk_version.
Instance Method Summary collapse
-
#ensure_upload_configured!(payload) ⇒ Object
raise an error unless the s3_bucket field is set.
-
#initialize(opts = {}) ⇒ Configuration
constructor
A new instance of Configuration.
-
#sdk_version_1? ⇒ Boolean
true if the sdk_version option is set to 1 or ‘1’.
-
#sdk_version_2? ⇒ Boolean
true if the sdk_version option is set to 2 or ‘2’.
Constructor Details
#initialize(opts = {}) ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 |
# File 'lib/humidifier/configuration.rb', line 19 def initialize(opts = {}) self.s3_bucket = opts[:s3_bucket] self.s3_prefix = opts[:s3_prefix] self.sdk_version = opts[:sdk_version] end |
Instance Attribute Details
#s3_bucket ⇒ Object
Returns the value of attribute s3_bucket.
17 18 19 |
# File 'lib/humidifier/configuration.rb', line 17 def s3_bucket @s3_bucket end |
#s3_prefix ⇒ Object
Returns the value of attribute s3_prefix.
17 18 19 |
# File 'lib/humidifier/configuration.rb', line 17 def s3_prefix @s3_prefix end |
#sdk_version ⇒ Object
Returns the value of attribute sdk_version.
17 18 19 |
# File 'lib/humidifier/configuration.rb', line 17 def sdk_version @sdk_version end |
Instance Method Details
#ensure_upload_configured!(payload) ⇒ Object
raise an error unless the s3_bucket field is set
26 27 28 |
# File 'lib/humidifier/configuration.rb', line 26 def ensure_upload_configured!(payload) raise UPLOAD_MESSAGE.gsub('%{identifier}', payload.identifier) if s3_bucket.nil? end |
#sdk_version_1? ⇒ Boolean
true if the sdk_version option is set to 1 or ‘1’
31 32 33 |
# File 'lib/humidifier/configuration.rb', line 31 def sdk_version_1? sdk_version.to_s == '1' end |
#sdk_version_2? ⇒ Boolean
true if the sdk_version option is set to 2 or ‘2’
36 37 38 |
# File 'lib/humidifier/configuration.rb', line 36 def sdk_version_2? sdk_version.to_s == '2' end |