Class: AssistedWorkflow::Addons::Jira

Inherits:
Base
  • Object
show all
Defined in:
lib/assisted_workflow/addons/jira.rb

Instance Method Summary collapse

Methods inherited from Base

get_required_options, #name, required_options

Constructor Details

#initialize(output, options = {}) ⇒ Jira

Returns a new instance of Jira.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/assisted_workflow/addons/jira.rb', line 40

def initialize(output, options = {})
  super
  Jiralicious.configure do |config|
    config.username = options["username"]
    config.password = options["password"]
    config.uri = options["uri"]
    config.api_version = "latest"
    config.auth_type = :basic
  end
  @project = options["project"]
  @username = options["username"]
  @unstarted = options["unstarted"]
  @started = options["started"]
  @finished = options["finished"]
end

Instance Method Details

#find_story(story_id) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/assisted_workflow/addons/jira.rb', line 56

def find_story(story_id)
  if !story_id.nil?
    log "loading story ##{story_id}"
    issue = Jiralicious::Issue.find(story_id)
    story = JiraStory.new(issue) if issue
    story
  end
end

#finish_story(story, options = {}) ⇒ Object



70
71
72
73
74
# File 'lib/assisted_workflow/addons/jira.rb', line 70

def finish_story(story, options = {})
  log "finishing story ##{story.id}"
  move_story! story, @finished
  story.comments.add(options[:note]) if options[:note]
end

#pending_stories(options = {}) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/assisted_workflow/addons/jira.rb', line 76

def pending_stories(options = {})
  log "loading pending stories"
  states = [@unstarted]
  states << @started if options[:include_started]
  query = "project=#{@project} and assignee='#{@username}' and status in ('#{states.join("','")}')"
  response = Jiralicious.search(query, :max_results => 5)
  log "loading stories info"
  response.issues_raw.map do |issue|
    JiraStory.new(Jiralicious::Issue.new(issue))
  end
end

#start_story(story, options = {}) ⇒ Object



65
66
67
68
# File 'lib/assisted_workflow/addons/jira.rb', line 65

def start_story(story, options = {})
  log "starting story ##{story.id}"
  move_story! story, @started
end

#valid?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/assisted_workflow/addons/jira.rb', line 88

def valid?
  !@project.nil?
end