-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.rb
More file actions
50 lines (37 loc) · 1.29 KB
/
test.rb
File metadata and controls
50 lines (37 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'faraday'
conn = Faraday.new(:url => 'http://tracker.tworedkites.com') do |faraday|
faraday.request :url_encoded # form-encode POST params
faraday.response :logger # log requests to STDOUT
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
end
login = conn.post '/youtrack/rest/user/login', { login: 'test', password: 'test'}
cookie = login.headers['set-cookie']
#
#response = conn.get '/youtrack/rest/issue/byproject/notacms' do |req|
# req.headers['Cookie'] = cookie
#end
#p '---------'
#p response
### Creates a ticket
response = conn.put '/youtrack/rest/issue' do |req|
req.headers['Cookie'] = cookie
req.body = {project: 'test', summary: 'wat what 123', description: 'the quick brown fox jumped over the brown fox',
permittedGroup: '2rk'}
end
p '---------'
p response["location"].split('/').last
=begin
response = conn.post do |req|
req.url '/youtrack/rest/issue/test-5/execute'
req.headers['Cookie'] = cookie
#req.body = {command: "subtask of test-4 type Feature estimation 3h"} #This works perfectly
req.body = {command: "work 3h hello world"}
end
p '---------'
p response
=end
#response = conn.get '/youtrack/rest/admin/project' do |req|
# req.headers['Cookie'] = cookie
#end
#p '---------'
#p response