Class: Redminer::Issue

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

Instance Attribute Summary collapse

Attributes inherited from Base

#server

Instance Method Summary collapse

Methods inherited from Base

#all=, #method_missing

Constructor Details

#initialize(server, id = nil) ⇒ Issue

Returns a new instance of Issue.



10
11
12
13
14
15
16
# File 'lib/redminer/issue.rb', line 10

def initialize(server, id = nil)
  @server = server
  unless id.nil?
    @id = id
    self.retrieve
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Redminer::Base

Instance Attribute Details

#authorObject

Returns the value of attribute author.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def author
  @author
end

#categoryObject

Returns the value of attribute category.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def category
  @category
end

#created_onObject

Returns the value of attribute created_on.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def created_on
  @created_on
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def description
  @description
end

#due_dateObject

Returns the value of attribute due_date.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def due_date
  @due_date
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/redminer/issue.rb', line 3

def id
  @id
end

#priorityObject

Returns the value of attribute priority.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def priority
  @priority
end

#projectObject

Returns the value of attribute project.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def project
  @project
end

#start_dateObject

Returns the value of attribute start_date.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def start_date
  @start_date
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def status
  @status
end

#subjectObject

Returns the value of attribute subject.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def subject
  @subject
end

#trackerObject

Returns the value of attribute tracker.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def tracker
  @tracker
end

#updated_onObject

Returns the value of attribute updated_on.



4
5
6
# File 'lib/redminer/issue.rb', line 4

def updated_on
  @updated_on
end

Instance Method Details

#craeteObject



30
31
32
# File 'lib/redminer/issue.rb', line 30

def craete
  server.post("/issues.json", to_hash)
end

#retrieveObject



18
19
20
21
22
23
24
# File 'lib/redminer/issue.rb', line 18

def retrieve
  response = server.get("/issues/#{id}.json")
  raise "#{id} issue does not exists" if response.nil?
  origin = response["issue"]
  self.all = origin
  self
end

#syncObject



26
27
28
# File 'lib/redminer/issue.rb', line 26

def sync
  (@id.nil? ? create : update)
end

#update(note = nil) ⇒ Object



34
35
36
37
# File 'lib/redminer/issue.rb', line 34

def update(note = nil)
  params = to_hash.merge(:notes => note) unless note.nil?
  server.put("/issues/#{id}.json", params)
end