Class: PlanMyStuff::TestingProjectMetadata
- Inherits:
-
BaseProjectMetadata
- Object
- BaseMetadata
- BaseProjectMetadata
- PlanMyStuff::TestingProjectMetadata
- Defined in:
- lib/plan_my_stuff/testing_project_metadata.rb
Overview
Metadata for testing projects, stored in the GH Project readme field. Detected at read time by kind: “testing” in the serialized metadata blob.
Constant Summary
Constants inherited from BaseMetadata
Instance Attribute Summary collapse
-
#deadline_miss_reason ⇒ String?
Free-text captured when the project deadline slips.
-
#due_date ⇒ Date?
Project-level deadline.
-
#subject_urls ⇒ Array<String>
PR/issue URLs this testing project covers.
Attributes inherited from BaseProjectMetadata
Attributes inherited from BaseMetadata
#app_name, #created_by, #custom_fields, #gem_version, #rails_env, #schema_version, #visibility
Class Method Summary collapse
-
.build(user:, visibility: 'internal', custom_fields: {}, subject_urls: [], due_date: nil, deadline_miss_reason: nil) ⇒ PlanMyStuff::TestingProjectMetadata
Builds a new TestingProjectMetadata for project creation.
-
.from_hash(hash) ⇒ PlanMyStuff::TestingProjectMetadata
Builds a TestingProjectMetadata from a parsed hash.
Instance Method Summary collapse
-
#initialize ⇒ TestingProjectMetadata
constructor
A new instance of TestingProjectMetadata.
- #to_h ⇒ Hash
Methods inherited from BaseMetadata
#internal?, #public?, #to_json, #validate_custom_fields!
Constructor Details
#initialize ⇒ TestingProjectMetadata
Returns a new instance of TestingProjectMetadata.
79 80 81 82 83 |
# File 'lib/plan_my_stuff/testing_project_metadata.rb', line 79 def initialize super @kind = 'testing' @subject_urls = [] end |
Instance Attribute Details
#deadline_miss_reason ⇒ String?
Returns free-text captured when the project deadline slips.
12 13 14 |
# File 'lib/plan_my_stuff/testing_project_metadata.rb', line 12 def deadline_miss_reason @deadline_miss_reason end |
#due_date ⇒ Date?
Returns project-level deadline.
10 11 12 |
# File 'lib/plan_my_stuff/testing_project_metadata.rb', line 10 def due_date @due_date end |
#subject_urls ⇒ Array<String>
Returns PR/issue URLs this testing project covers.
8 9 10 |
# File 'lib/plan_my_stuff/testing_project_metadata.rb', line 8 def subject_urls @subject_urls end |
Class Method Details
.build(user:, visibility: 'internal', custom_fields: {}, subject_urls: [], due_date: nil, deadline_miss_reason: nil) ⇒ PlanMyStuff::TestingProjectMetadata
Builds a new TestingProjectMetadata for project creation.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/plan_my_stuff/testing_project_metadata.rb', line 41 def build( user:, visibility: 'internal', custom_fields: {}, subject_urls: [], due_date: nil, deadline_miss_reason: nil ) = new apply_common_build( , user: user, visibility: visibility, custom_fields_data: custom_fields, custom_fields_schema: PlanMyStuff.configuration.custom_fields_for(:testing), ) .subject_urls = Array.wrap(subject_urls) .due_date = due_date .deadline_miss_reason = deadline_miss_reason end |
.from_hash(hash) ⇒ PlanMyStuff::TestingProjectMetadata
Builds a TestingProjectMetadata from a parsed hash.
21 22 23 24 25 26 27 28 |
# File 'lib/plan_my_stuff/testing_project_metadata.rb', line 21 def from_hash(hash) = new apply_common_from_hash(, hash, PlanMyStuff.configuration.custom_fields_for(:testing)) .subject_urls = Array.wrap(hash[:subject_urls]) .due_date = parse_date(hash[:due_date]) .deadline_miss_reason = hash[:deadline_miss_reason] end |
Instance Method Details
#to_h ⇒ Hash
86 87 88 89 90 91 92 |
# File 'lib/plan_my_stuff/testing_project_metadata.rb', line 86 def to_h super.merge( subject_urls: subject_urls, due_date: due_date&.iso8601, deadline_miss_reason: deadline_miss_reason, ) end |