Class: Youtrack::Issue

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

Instance Attribute Summary

Attributes inherited from Base

#base_url, #response, #service

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Youtrack::Base

Instance Method Details

#add_attachment(issue_id, data, content_type, filename) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/youtrack/resources/issue.rb', line 73

def add_attachment(issue_id, data, content_type, filename)
  url = URI.parse(join(base_url, "issue/#{issue_id}/attachment"))
  req = Net::HTTP::Post::Multipart.new( url.path, "file" => UploadIO.new(data, content_type, filename))
  req['Cookie'] = service.cookies['Cookie']
  http = Net::HTTP.new(url.host, url.port)
  http.set_debug_output($stderr) if service.debug
  
  if url.scheme == 'https'
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER
  end

  response = http.request(req)
  response
end

#add_comment(issue_id, attributes = {}) ⇒ Object



90
91
92
93
# File 'lib/youtrack/resources/issue.rb', line 90

def add_comment(issue_id, attributes={})
  post("issue/#{issue_id}/execute", query: attributes)
  response
end

#create(attributes = {}) ⇒ Object

Create a New Issue project string ID of a project to add new issue to. summary string Short summary for the new issue. description string Description for the new issue. attachments file in “multipart/form-data” format One or several files in “multipart/form-data” format that should be attached to the new issue. permittedGroup string Set visibility for the new issue, that is: Specify a user group to which the issue will be visible.



18
19
20
21
# File 'lib/youtrack/resources/issue.rb', line 18

def create(attributes={})
  put("issue", query: attributes)
  response
end

#destroy(issue_id) ⇒ Object



68
69
70
71
# File 'lib/youtrack/resources/issue.rb', line 68

def destroy(issue_id)
  delete("issue/#{issue_id}")
  response
end

#exists?(issue_id) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
41
# File 'lib/youtrack/resources/issue.rb', line 38

def exists?(issue_id)
  get("issue/#{issue_id}/exists")
  response.code == 200
end

#find(issue_id) ⇒ Object



23
24
25
26
# File 'lib/youtrack/resources/issue.rb', line 23

def find(issue_id)
  get("issue/#{issue_id}")
  response.parsed_response
end

#get_attachments_for(issue_id) ⇒ Object



43
44
45
46
# File 'lib/youtrack/resources/issue.rb', line 43

def get_attachments_for(issue_id)
  get("issue/#{issue_id}/attachment")
  response.parsed_response
end

#get_changes_for(issue_id) ⇒ Object



33
34
35
36
# File 'lib/youtrack/resources/issue.rb', line 33

def get_changes_for(issue_id)
  get("issue/#{issue_id}/changes")
  response.parsed_response
end

#get_comments_for(issue_id) ⇒ Object



48
49
50
51
# File 'lib/youtrack/resources/issue.rb', line 48

def get_comments_for(issue_id)
  get("issue/#{issue_id}/comment")
  response.parsed_response
end

#get_history_for(issue_id) ⇒ Object



28
29
30
31
# File 'lib/youtrack/resources/issue.rb', line 28

def get_history_for(issue_id)
  get("issue/#{issue_id}/history")
  response.parsed_response
end


53
54
55
56
# File 'lib/youtrack/resources/issue.rb', line 53

def get_links_for(issue_id)
  get("issue/#{issue_id}/link")
  response.parsed_response
end

#update(issue_id, attributes = {}) ⇒ Object

issueID string ID of an issue that should be updated. summary string New summary for the specified issue. description string Updated description for the specified issue.



63
64
65
66
# File 'lib/youtrack/resources/issue.rb', line 63

def update(issue_id, attributes={})
  post("issue/#{issue_id}", query: attributes)
  response.parsed_response
end