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
"The %{identifier} stack's body is too large to be use the template_body option, and therefore must use the\ntemplate_url option instead. You can configure Humidifier to do this automatically by setting up the s3 config\non the top-level Humidifier object like so:\n\n Humidifier.configure do |config|\n config.s3_bucket = 'my.s3.bucket'\n config.s3_prefix = 'my-prefix/' # optional\n end\n".freeze
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.
21 22 23 24 25 |
# File 'lib/humidifier/configuration.rb', line 21 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.
19 20 21 |
# File 'lib/humidifier/configuration.rb', line 19 def s3_bucket @s3_bucket end |
#s3_prefix ⇒ Object
Returns the value of attribute s3_prefix.
19 20 21 |
# File 'lib/humidifier/configuration.rb', line 19 def s3_prefix @s3_prefix end |
#sdk_version ⇒ Object
Returns the value of attribute sdk_version.
19 20 21 |
# File 'lib/humidifier/configuration.rb', line 19 def sdk_version @sdk_version end |
Instance Method Details
#ensure_upload_configured!(payload) ⇒ Object
raise an error unless the s3_bucket field is set
28 29 30 |
# File 'lib/humidifier/configuration.rb', line 28 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’
33 34 35 |
# File 'lib/humidifier/configuration.rb', line 33 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’
38 39 40 |
# File 'lib/humidifier/configuration.rb', line 38 def sdk_version_2? sdk_version.to_s == '2' end |