Class: AnalyticsOps::Setup::Result
- Inherits:
-
Object
- Object
- AnalyticsOps::Setup::Result
- Defined in:
- lib/analytics_ops/setup.rb,
sig/analytics_ops.rbs
Overview
Immutable setup outcome returned to the CLI and Ruby callers.
Instance Attribute Summary collapse
-
#config_path ⇒ String
readonly
Returns the value of attribute config_path.
-
#profile ⇒ String
readonly
Returns the value of attribute profile.
-
#property ⇒ Resources::Property
readonly
Returns the value of attribute property.
-
#warnings ⇒ Array[String]
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #created? ⇒ Boolean
-
#initialize(config_path:, profile:, property:, created:, updated: false, warnings: []) ⇒ Result
constructor
A new instance of Result.
- #status ⇒ String
- #to_h ⇒ record
- #updated? ⇒ Boolean
Constructor Details
#initialize(config_path:, profile:, property:, created:, updated: false, warnings: []) ⇒ Result
Returns a new instance of Result.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/analytics_ops/setup.rb', line 14 def initialize(config_path:, profile:, property:, created:, updated: false, warnings: []) unless property.is_a?(Resources::Property) raise ArgumentError, "property must be an AnalyticsOps::Resources::Property" end unless [true, false].include?(created) && [true, false].include?(updated) && !(created && updated) raise ArgumentError, "created and updated must be distinct booleans" end @config_path = config_path.to_s.dup.freeze @profile = profile.to_s.dup.freeze @property = property @created = created @updated = updated @warnings = normalized_warnings(warnings) freeze end |
Instance Attribute Details
#config_path ⇒ String (readonly)
Returns the value of attribute config_path.
12 13 14 |
# File 'lib/analytics_ops/setup.rb', line 12 def config_path @config_path end |
#profile ⇒ String (readonly)
Returns the value of attribute profile.
12 13 14 |
# File 'lib/analytics_ops/setup.rb', line 12 def profile @profile end |
#property ⇒ Resources::Property (readonly)
Returns the value of attribute property.
12 13 14 |
# File 'lib/analytics_ops/setup.rb', line 12 def property @property end |
#warnings ⇒ Array[String] (readonly)
Returns the value of attribute warnings.
12 13 14 |
# File 'lib/analytics_ops/setup.rb', line 12 def warnings @warnings end |
Instance Method Details
#created? ⇒ Boolean
31 32 33 |
# File 'lib/analytics_ops/setup.rb', line 31 def created? @created end |
#status ⇒ String
39 40 41 |
# File 'lib/analytics_ops/setup.rb', line 39 def status created? || updated? ? "configured" : "already_configured" end |
#to_h ⇒ record
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/analytics_ops/setup.rb', line 43 def to_h { "status" => status, "config" => config_path, "profile" => profile, "updated" => updated?, "warnings" => warnings, "property" => property.to_h } end |
#updated? ⇒ Boolean
35 36 37 |
# File 'lib/analytics_ops/setup.rb', line 35 def updated? @updated end |