Class: Dor::Workflow::Client::Status
- Inherits:
-
Object
- Object
- Dor::Workflow::Client::Status
- Defined in:
- lib/dor/workflow/client/status.rb
Overview
reveals the status of an object based on the lifecycles
Constant Summary collapse
- STATUS_CODE_DISP_TXT =
verbiage we want to use to describe an item when it has completed a particular step
{ 0 => 'Unknown Status', # if there are no milestones for the current version, someone likely messed up the versioning process. 1 => 'Registered', 2 => 'In accessioning', 3 => 'In accessioning (published)', 4 => 'In accessioning (published, deposited)', 5 => 'Accessioned', 6 => 'Accessioned (indexed)', 7 => 'Accessioned (indexed, ingested)', 8 => 'Opened' }.freeze
- STEPS =
milestones from accessioning and the order they happen in
{ 'registered' => 1, 'submitted' => 2, 'published' => 3, 'deposited' => 4, 'accessioned' => 5, 'indexed' => 6, 'shelved' => 7, 'opened' => 8 }.freeze
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#display(include_time: false) ⇒ String
Single composed status from status_info.
- #display_simplified ⇒ Object
-
#initialize(druid:, version:, lifecycle_routes:) ⇒ Status
constructor
A new instance of Status.
- #milestones ⇒ Object
Constructor Details
#initialize(druid:, version:, lifecycle_routes:) ⇒ Status
Returns a new instance of Status.
38 39 40 41 42 43 |
# File 'lib/dor/workflow/client/status.rb', line 38 def initialize(druid:, version:, lifecycle_routes:) @druid = druid @version = version.to_s @lifecycle_routes = lifecycle_routes @status_code, @status_time = status_from_latest_current_milestone end |
Instance Attribute Details
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
33 34 35 |
# File 'lib/dor/workflow/client/status.rb', line 33 def status_code @status_code end |
Instance Method Details
#display(include_time: false) ⇒ String
Returns single composed status from status_info.
47 48 49 50 51 52 |
# File 'lib/dor/workflow/client/status.rb', line 47 def display(include_time: false) # use the translation table to get the appropriate verbage for the latest step result = "v#{version} #{STATUS_CODE_DISP_TXT[status_code]}" result += " #{format_date(status_time)}" if include_time result end |
#display_simplified ⇒ Object
54 55 56 |
# File 'lib/dor/workflow/client/status.rb', line 54 def display_simplified simplified_status_code(STATUS_CODE_DISP_TXT[status_code]) end |
#milestones ⇒ Object
58 59 60 |
# File 'lib/dor/workflow/client/status.rb', line 58 def milestones @milestones ||= lifecycle_routes.milestones(druid: druid) end |