Class: PlanMyStuff::ProjectItemMetadata

Inherits:
BaseMetadata show all
Defined in:
lib/plan_my_stuff/project_item_metadata.rb

Overview

Metadata stored on the body of a ProjectItem – primarily used for draft items, which have their own body field distinct from any linked issue. Regular (non-draft) items rely on their linked issue’s IssueMetadata instead, to avoid double-bookkeeping.

Lays the groundwork for the Phase 13 testing-tracking workflow (T-049), which will assign non-GitHub users (e.g. internal QA accounts) to draft items via the pms_assignee field.

Constant Summary

Constants inherited from BaseMetadata

BaseMetadata::SCHEMA_VERSION

Instance Attribute Summary collapse

Attributes inherited from BaseMetadata

#app_name, #created_by, #custom_fields, #gem_version, #rails_env, #schema_version, #visibility

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseMetadata

#initialize, #internal?, #public?, #to_json, #validate_custom_fields!

Constructor Details

This class inherits a constructor from PlanMyStuff::BaseMetadata

Instance Attribute Details

#pms_assigneeInteger?

Returns consuming app user id of the PMS-side assignee.

Returns:

  • (Integer, nil)

    consuming app user id of the PMS-side assignee



15
16
17
# File 'lib/plan_my_stuff/project_item_metadata.rb', line 15

def pms_assignee
  @pms_assignee
end

Class Method Details

.build(user:, visibility: 'internal') ⇒ PlanMyStuff::ProjectItemMetadata

Builds a new ProjectItemMetadata, auto-filling gem defaults.

Parameters:

  • user (Object, Integer)

    user object or user_id

  • visibility (String) (defaults to: 'internal')

    “public” or “internal”

Returns:



38
39
40
41
42
43
44
45
46
47
# File 'lib/plan_my_stuff/project_item_metadata.rb', line 38

def build(user:, visibility: 'internal')
   = new
  apply_common_build(
    ,
    user: user,
    visibility: visibility,
  )
  .pms_assignee = nil
  
end

.from_hash(hash) ⇒ PlanMyStuff::ProjectItemMetadata

Builds a ProjectItemMetadata from a parsed hash (e.g. from MetadataParser)

Parameters:

  • hash (Hash)

Returns:



24
25
26
27
28
29
# File 'lib/plan_my_stuff/project_item_metadata.rb', line 24

def from_hash(hash)
   = new
  apply_common_from_hash(, hash, {})
  .pms_assignee = hash[:pms_assignee]
  
end

Instance Method Details

#to_hHash

Returns:

  • (Hash)


51
52
53
# File 'lib/plan_my_stuff/project_item_metadata.rb', line 51

def to_h
  super.merge(pms_assignee: pms_assignee)
end