Class: Flagsmith::Engine::Environment
- Inherits:
-
Object
- Object
- Flagsmith::Engine::Environment
- Defined in:
- lib/flagsmith/engine/environments/models.rb
Overview
EnvironmentModel
Instance Attribute Summary collapse
-
#amplitude_config ⇒ Object
Returns the value of attribute amplitude_config.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#feature_states ⇒ Object
Returns the value of attribute feature_states.
-
#heap_config ⇒ Object
Returns the value of attribute heap_config.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#identity_overrides ⇒ Object
Returns the value of attribute identity_overrides.
-
#mixpanel_config ⇒ Object
Returns the value of attribute mixpanel_config.
-
#project ⇒ Object
Returns the value of attribute project.
-
#segment_config ⇒ Object
Returns the value of attribute segment_config.
Class Method Summary collapse
-
.build(json) ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Summary collapse
-
#initialize(id:, api_key:, project:, feature_states: [], identity_overrides: []) ⇒ Environment
constructor
A new instance of Environment.
Constructor Details
#initialize(id:, api_key:, project:, feature_states: [], identity_overrides: []) ⇒ Environment
Returns a new instance of Environment.
11 12 13 14 15 16 17 |
# File 'lib/flagsmith/engine/environments/models.rb', line 11 def initialize(id:, api_key:, project:, feature_states: [], identity_overrides: []) @id = id @api_key = api_key @project = project @feature_states = feature_states @identity_overrides = identity_overrides end |
Instance Attribute Details
#amplitude_config ⇒ Object
Returns the value of attribute amplitude_config.
8 9 10 |
# File 'lib/flagsmith/engine/environments/models.rb', line 8 def amplitude_config @amplitude_config end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/flagsmith/engine/environments/models.rb', line 7 def api_key @api_key end |
#feature_states ⇒ Object
Returns the value of attribute feature_states.
8 9 10 |
# File 'lib/flagsmith/engine/environments/models.rb', line 8 def feature_states @feature_states end |
#heap_config ⇒ Object
Returns the value of attribute heap_config.
8 9 10 |
# File 'lib/flagsmith/engine/environments/models.rb', line 8 def heap_config @heap_config end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/flagsmith/engine/environments/models.rb', line 7 def id @id end |
#identity_overrides ⇒ Object
Returns the value of attribute identity_overrides.
8 9 10 |
# File 'lib/flagsmith/engine/environments/models.rb', line 8 def identity_overrides @identity_overrides end |
#mixpanel_config ⇒ Object
Returns the value of attribute mixpanel_config.
8 9 10 |
# File 'lib/flagsmith/engine/environments/models.rb', line 8 def mixpanel_config @mixpanel_config end |
#project ⇒ Object
Returns the value of attribute project.
8 9 10 |
# File 'lib/flagsmith/engine/environments/models.rb', line 8 def project @project end |
#segment_config ⇒ Object
Returns the value of attribute segment_config.
8 9 10 |
# File 'lib/flagsmith/engine/environments/models.rb', line 8 def segment_config @segment_config end |
Class Method Details
.build(json) ⇒ Object
rubocop:disable Metrics/MethodLength
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/flagsmith/engine/environments/models.rb', line 21 def build(json) project = Flagsmith::Engine::Project.build(json[:project]) feature_states = json[:feature_states].map do |fs| Flagsmith::Engine::FeatureState.build(fs) end identity_overrides = json.fetch(:identity_overrides, []).map do |io| Flagsmith::Engine::Identity.build(io) end new(**json.slice(:id, :api_key).merge( project: project, feature_states: feature_states, identity_overrides: identity_overrides )) end |