Class: Flagsmith::Engine::Project
- Inherits:
-
Object
- Object
- Flagsmith::Engine::Project
- Defined in:
- lib/flagsmith/engine/projects/models.rb
Overview
ProjectModel
Instance Attribute Summary collapse
-
#hide_disabled_flags ⇒ Object
Returns the value of attribute hide_disabled_flags.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#organisation ⇒ Object
readonly
Returns the value of attribute organisation.
-
#segments ⇒ Object
Returns the value of attribute segments.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, organisation:, hide_disabled_flags:, segments: []) ⇒ Project
constructor
A new instance of Project.
Constructor Details
#initialize(id:, name:, organisation:, hide_disabled_flags:, segments: []) ⇒ Project
Returns a new instance of Project.
10 11 12 13 14 15 16 |
# File 'lib/flagsmith/engine/projects/models.rb', line 10 def initialize(id:, name:, organisation:, hide_disabled_flags:, segments: []) @id = id @name = name @hide_disabled_flags = hide_disabled_flags @organisation = organisation @segments = segments end |
Instance Attribute Details
#hide_disabled_flags ⇒ Object
Returns the value of attribute hide_disabled_flags.
8 9 10 |
# File 'lib/flagsmith/engine/projects/models.rb', line 8 def hide_disabled_flags @hide_disabled_flags end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/flagsmith/engine/projects/models.rb', line 7 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/flagsmith/engine/projects/models.rb', line 7 def name @name end |
#organisation ⇒ Object (readonly)
Returns the value of attribute organisation.
7 8 9 |
# File 'lib/flagsmith/engine/projects/models.rb', line 7 def organisation @organisation end |
#segments ⇒ Object
Returns the value of attribute segments.
8 9 10 |
# File 'lib/flagsmith/engine/projects/models.rb', line 8 def segments @segments end |
Class Method Details
.build(json) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/flagsmith/engine/projects/models.rb', line 19 def build(json) segments = json.fetch(:segments, []).map { |s| Flagsmith::Engine::Segment.build(s) } new( **json.slice(:id, :name, :hide_disabled_flags) .merge(organisation: Flagsmith::Engine::Organisation.build(json[:organisation])) .merge(segments: segments) ) end |