Class: Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/jirarest2/issue.rb

Overview

represent an issue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issueid) ⇒ Issue

Returns a new instance of Issue.

Parameters:

  • issueid (String)

    Key or ID of the issue



25
26
27
# File 'lib/jirarest2/issue.rb', line 25

def initialize(issueid)
  @issueid = issueid
end

Instance Attribute Details

#assigneeObject (readonly)

Person the issue is assigned to



22
23
24
# File 'lib/jirarest2/issue.rb', line 22

def assignee
  @assignee
end

Instance Method Details

#createmeta(issuetype) ⇒ Object

Interpret the result of createmeta for one issuetype



68
69
70
# File 'lib/jirarest2/issue.rb', line 68

def createmeta(issuetype)
  @name = issuetype
end

#receive(connection) ⇒ Object

TODO:

This method does not work yet

Receive an issue and all it’s fields from jira

Parameters:

  • connection (Connection)


32
33
34
35
36
37
# File 'lib/jirarest2/issue.rb', line 32

def receive(connection)
  uritail = "issue/#{@issueid}"
  result = connection.execute("Get",uritail,{"expand" => "metadata"}) # get the issue AND the metadata because we already know how to parse that.
  return result
# TODO Many and more fields
end

#remove_assignee(connection) ⇒ Object

Deletes an assignee. It actually only calls set_assignee with name = nil .

Parameters:

  • connection (Connection)


62
63
64
# File 'lib/jirarest2/issue.rb', line 62

def remove_assignee(connection)
  set_assignee(connection, nil)
end

#set_assignee(connection, name) ⇒ Boolean

Set an assignee to an issue

Parameters:

  • connection (Connection)
  • name (String)

    Username of the new Assignee, Defaultassignee if “-1” is given

  • name (Nil)

    Deletes Assignee

Returns:

  • (Boolean)

    true if successfull, false if not



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/jirarest2/issue.rb', line 44

def set_assignee(connection, name)
  uritail = "issue/#{@issueid}/assignee"
  if ! name.nil? then
    setname = {"name" => name}
  else
    setname = nil
  end
  retcode = connection.execute("Put",uritail,setname).code
  if retcode == "204" then
    @assignee = name
    return true
  else
    return false
  end
end