class Abt::Providers::Devops::Commands::HarvestTimeEntryData

Public Class Methods

description() click to toggle source
# File lib/abt/providers/devops/commands/harvest_time_entry_data.rb, line 12
def self.description
  "Print Harvest time entry data for DevOps work item as json. Used by harvest start script."
end
usage() click to toggle source
# File lib/abt/providers/devops/commands/harvest_time_entry_data.rb, line 8
def self.usage
  "abt harvest-time-entry-data devops[:<organization-name>/<project-name>/<board-id>/<work-item-id>]"
end

Public Instance Methods

perform() click to toggle source
# File lib/abt/providers/devops/commands/harvest_time_entry_data.rb, line 16
          def perform
            require_work_item!

            if work_item
              puts Oj.dump(body, mode: :json)
            else
              abort(<<~TXT)
                Unable to find work item for configuration:
                devops:#{path}
              TXT
            end
          end

Private Instance Methods

body() click to toggle source
# File lib/abt/providers/devops/commands/harvest_time_entry_data.rb, line 31
def body
  {
    notes: notes,
    external_reference: {
      id: work_item["id"],
      group_id: "AzureDevOpsWorkItem",
      permalink: work_item["url"]
    }
  }
end
notes() click to toggle source
# File lib/abt/providers/devops/commands/harvest_time_entry_data.rb, line 42
def notes
  [
    "Azure DevOps",
    work_item["fields"]["System.WorkItemType"],
    "##{work_item['id']}",
    "-",
    work_item["name"]
  ].join(" ")
end