Class: Youtrack::Issue
- Inherits:
-
Base
- Object
- Base
- Youtrack::Issue
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/youtrack/resources/issue.rb', line 79
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
|
96
97
98
99
|
# File 'lib/youtrack/resources/issue.rb', line 96
def (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.
Hack: the body has to be set to empty so that HTTParty sends a Content-Length header, which Youtrack requires
API-Success: Returns a 201 created wit hthe location header set
Returns the response object
24
25
26
27
|
# File 'lib/youtrack/resources/issue.rb', line 24
def create(attributes={})
put("issue", query: attributes, body: {})
response
end
|
#destroy(issue_id) ⇒ Object
74
75
76
77
|
# File 'lib/youtrack/resources/issue.rb', line 74
def destroy(issue_id)
delete("issue/#{issue_id}")
response
end
|
#exists?(issue_id) ⇒ Boolean
44
45
46
47
|
# File 'lib/youtrack/resources/issue.rb', line 44
def exists?(issue_id)
get("issue/#{issue_id}/exists")
response.code == 200
end
|
#find(issue_id) ⇒ Object
29
30
31
32
|
# File 'lib/youtrack/resources/issue.rb', line 29
def find(issue_id)
get("issue/#{issue_id}")
response.parsed_response
end
|
#get_attachments_for(issue_id) ⇒ Object
49
50
51
52
|
# File 'lib/youtrack/resources/issue.rb', line 49
def get_attachments_for(issue_id)
get("issue/#{issue_id}/attachment")
response.parsed_response
end
|
#get_changes_for(issue_id) ⇒ Object
39
40
41
42
|
# File 'lib/youtrack/resources/issue.rb', line 39
def get_changes_for(issue_id)
get("issue/#{issue_id}/changes")
response.parsed_response
end
|
54
55
56
57
|
# File 'lib/youtrack/resources/issue.rb', line 54
def (issue_id)
get("issue/#{issue_id}/comment")
response.parsed_response
end
|
#get_history_for(issue_id) ⇒ Object
34
35
36
37
|
# File 'lib/youtrack/resources/issue.rb', line 34
def get_history_for(issue_id)
get("issue/#{issue_id}/history")
response.parsed_response
end
|
#get_links_for(issue_id) ⇒ Object
59
60
61
62
|
# File 'lib/youtrack/resources/issue.rb', line 59
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.
69
70
71
72
|
# File 'lib/youtrack/resources/issue.rb', line 69
def update(issue_id, attributes={})
post("issue/#{issue_id}", query: attributes)
response.parsed_response
end
|