rutrack 0.0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.envrc +1 -0
- data/.gitignore +21 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +23 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +79 -0
- data/Rakefile +11 -0
- data/features/support/env.rb +3 -0
- data/features/support/hooks.rb +1 -0
- data/features/support/vcr.rb +16 -0
- data/features/support/world.rb +0 -0
- data/lib/youtrack.rb +11 -0
- data/lib/youtrack/client.rb +86 -0
- data/lib/youtrack/resources/base.rb +54 -0
- data/lib/youtrack/resources/issue.rb +169 -0
- data/lib/youtrack/resources/project.rb +55 -0
- data/lib/youtrack/resources/tag.rb +52 -0
- data/lib/youtrack/resources/user.rb +78 -0
- data/lib/youtrack/version.rb +4 -0
- data/spec/cassettes/client/connect.yml +40 -0
- data/spec/cassettes/client/connect_credentials_error.yml +39 -0
- data/spec/cassettes/client/connect_url_error.yml +45 -0
- data/spec/cassettes/users/current.yml +75 -0
- data/spec/cassettes/users/get_by_login.yml +75 -0
- data/spec/cassettes/users/get_saved_searches_for.yml +76 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/youtrack/client_spec.rb +92 -0
- data/spec/youtrack/resources/user_spec.rb +83 -0
- data/youtrack.gemspec +35 -0
- metadata +201 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
module Youtrack
|
2
|
+
class Project < Base
|
3
|
+
|
4
|
+
# ==================
|
5
|
+
# USER Methods
|
6
|
+
# ==================
|
7
|
+
def get_accessible_projects
|
8
|
+
get('project/all')
|
9
|
+
response.parsed_response
|
10
|
+
end
|
11
|
+
|
12
|
+
# filter string Apply a filter to issues in a project.
|
13
|
+
# after Integer A number of issues to skip before getting a list of issues. That is, when you specify, for example, after=12 in request,
|
14
|
+
# then in the response you will get all issues matching request but without first twelve issues found .
|
15
|
+
# max Integer Maximum number of issues to be imported. If not provided, 10 issues will be imported, by default.
|
16
|
+
# updatedAfter Long Filter issues by the date of the most recent update. Only issues imported after the specified date will be gotten.
|
17
|
+
def get_issues_for(project_id, max,filter,options={})
|
18
|
+
max = 10 unless max
|
19
|
+
|
20
|
+
get("issue/byproject/#{project_id}?max=#{max}&filter=#{filter}")
|
21
|
+
response.parsed_response
|
22
|
+
end
|
23
|
+
|
24
|
+
# ==================
|
25
|
+
# ADMIN Methods
|
26
|
+
# ==================
|
27
|
+
def all
|
28
|
+
get('admin/project')
|
29
|
+
response.parsed_response
|
30
|
+
end
|
31
|
+
|
32
|
+
def find(project_id)
|
33
|
+
get("admin/project/#{project_id}")
|
34
|
+
response.parsed_response
|
35
|
+
end
|
36
|
+
|
37
|
+
# required attributes
|
38
|
+
#
|
39
|
+
# projectId string required Unique identifier of a project to be created. This short name will be used as prefix in issue IDs for this project.
|
40
|
+
# projectName string required Full name of a new project. Must be unique.
|
41
|
+
# startingNumber integer required Number to assign to the next manually created issue.
|
42
|
+
# projectLeadLogin string required Login name of a user to be assigned as a project leader.
|
43
|
+
# description string Optional description of the new project
|
44
|
+
def create(attributes={})
|
45
|
+
put("admin/project/#{attributes[:projectId]}", query: attributes)
|
46
|
+
response
|
47
|
+
end
|
48
|
+
|
49
|
+
def destroy(project_id)
|
50
|
+
delete("admin/project/#{project_id}")
|
51
|
+
response
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Youtrack
|
2
|
+
class Tag < Base
|
3
|
+
|
4
|
+
# get all user's tags
|
5
|
+
def get_all_tags
|
6
|
+
get('user/tag')
|
7
|
+
response.parsed_response
|
8
|
+
end
|
9
|
+
|
10
|
+
# get a user's tag by name
|
11
|
+
def get_tag_by_name( tag_name )
|
12
|
+
get("user/tag/#{tag_name}")
|
13
|
+
response.parsed_response
|
14
|
+
end
|
15
|
+
|
16
|
+
# add new user's tag
|
17
|
+
#
|
18
|
+
# attributes:
|
19
|
+
# tagName (required) String The name of the new tag
|
20
|
+
# visibleForGroup (required) String Name of a user group in which tag should be visible
|
21
|
+
# updatableByGroup (required) String Name of user group whose members can edit the new tag
|
22
|
+
# untagOnResolve (optional) Boolean autoremove when issue's state changes
|
23
|
+
#
|
24
|
+
# API Success: Returns 201 Created with Location Header set
|
25
|
+
# Returns the response object
|
26
|
+
|
27
|
+
def create(attributes={})
|
28
|
+
tag_name = attributes.delete(:tagName)
|
29
|
+
put("user/tag/#{tag_name}", attributes)
|
30
|
+
response
|
31
|
+
end
|
32
|
+
|
33
|
+
# update an existing tag
|
34
|
+
#
|
35
|
+
# attributes:
|
36
|
+
# tagName (required) String The name of tag to edit.
|
37
|
+
# newName (required) String the new name for the tag.
|
38
|
+
# visibleForGroup (required) String Name of a user group in which tag should be visible
|
39
|
+
# updatableByGroup (required) String Name of user group whose members can edit the new tag
|
40
|
+
# untagOnResolve (optional) Boolean autoremove when issue's state changes
|
41
|
+
#
|
42
|
+
# API Success: Returns 301 Moved Permanently with Location Header set
|
43
|
+
# Returns the response object
|
44
|
+
|
45
|
+
def update(attributes={})
|
46
|
+
tag_name = attributes.delete(:tagName)
|
47
|
+
post("user/tag/#{tag_name}", attributes)
|
48
|
+
response
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Youtrack
|
2
|
+
class User < Base
|
3
|
+
|
4
|
+
|
5
|
+
# ==================
|
6
|
+
# USER Methods
|
7
|
+
# ==================
|
8
|
+
def current
|
9
|
+
get('user/current')
|
10
|
+
response.parsed_response
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_by_login(login_name)
|
14
|
+
get("user/#{login_name}")
|
15
|
+
response.parsed_response
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_saved_searches_for(login_name)
|
19
|
+
get("user/#{login_name}/filter")
|
20
|
+
response.parsed_response
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_saved_searches
|
24
|
+
get("user/search")
|
25
|
+
response.parsed_response
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_saved_search_by_name(query_name)
|
29
|
+
get("user/search/#{query_name}")
|
30
|
+
response.parsed_response
|
31
|
+
end
|
32
|
+
|
33
|
+
# ==================
|
34
|
+
# ADMIN Methods
|
35
|
+
# ==================
|
36
|
+
def find(login_name)
|
37
|
+
get("admin/user/#{login_name}")
|
38
|
+
response.parsed_response
|
39
|
+
end
|
40
|
+
|
41
|
+
def all
|
42
|
+
get("admin/user")
|
43
|
+
response.parsed_response
|
44
|
+
end
|
45
|
+
|
46
|
+
# login string Login name of a user to be created. Required.
|
47
|
+
# fullName string User full name (optional).
|
48
|
+
# email string User email (required for new user).
|
49
|
+
# jabber string User jabber account (optional).
|
50
|
+
# password string Password for the new user. If skipped, by default the new user account will be created with auto-generated password
|
51
|
+
def create(attributes)
|
52
|
+
put("admin/user", body: attributes)
|
53
|
+
response
|
54
|
+
end
|
55
|
+
|
56
|
+
# User will be created if not already exist
|
57
|
+
def update(attributes)
|
58
|
+
post("admin/user", body: attributes)
|
59
|
+
response
|
60
|
+
end
|
61
|
+
|
62
|
+
def destroy(login_name)
|
63
|
+
delete("admin/user/#{login_name}")
|
64
|
+
response
|
65
|
+
end
|
66
|
+
|
67
|
+
def get_roles_for(login_name)
|
68
|
+
get("admin/user/#{login_name}/roles")
|
69
|
+
response.parsed_response
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_groups_for(login_name)
|
73
|
+
get("admin/user/#{login_name}/groups")
|
74
|
+
response.parsed_response
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://testcloud.myjetbrains.com/youtrack/rest/user/login
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: login=testuser&password=testuser
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx
|
17
|
+
Date:
|
18
|
+
- Fri, 07 Feb 2014 21:23:50 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/xml; charset=UTF-8
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
Set-Cookie:
|
28
|
+
- JSESSIONID=i1nlki01vb7k2ti2k3wmizbk;Path=/youtrack;Secure
|
29
|
+
- jetbrains.charisma.main.security.PRINCIPAL=YWU1ZGViODIyZTBkNzE5OTI5MDA0NzFhNzE5OWQwZDk1YjhlN2M5ZDA1YzQwYTgyNDVhMjgxZmQyYzFkNjY4NDp0ZXN0dXNlcg;Path=/youtrack;Expires=Sat,
|
30
|
+
07-Feb-2015 21:23:50 GMT
|
31
|
+
Expires:
|
32
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache, no-store, no-transform, must-revalidate
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: <login>ok</login>
|
38
|
+
http_version:
|
39
|
+
recorded_at: Fri, 07 Feb 2014 21:25:36 GMT
|
40
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://testcloud.myjetbrains.com/youtrack/rest/user/login
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: login=invalid_user&password=invalid_pass
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 403
|
13
|
+
message: Forbidden
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx
|
17
|
+
Date:
|
18
|
+
- Fri, 07 Feb 2014 21:59:44 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/xml; charset=UTF-8
|
21
|
+
Content-Length:
|
22
|
+
- '98'
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
Set-Cookie:
|
28
|
+
- JSESSIONID=16ngfmvqeqmc912t0v7q6fo2kc;Path=/youtrack;Secure
|
29
|
+
Expires:
|
30
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
31
|
+
Cache-Control:
|
32
|
+
- no-cache, no-store, no-transform, must-revalidate
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><error>Incorrect
|
36
|
+
login or password.</error>
|
37
|
+
http_version:
|
38
|
+
recorded_at: Fri, 07 Feb 2014 22:01:31 GMT
|
39
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://testcloud.myjetbrains.com/youtracks/rest/user/login
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: login=testuser&password=testuser
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 404
|
13
|
+
message: Not Found
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx
|
17
|
+
Date:
|
18
|
+
- Fri, 07 Feb 2014 21:59:42 GMT
|
19
|
+
Content-Type:
|
20
|
+
- text/html;charset=ISO-8859-1
|
21
|
+
Content-Length:
|
22
|
+
- '1292'
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Cache-Control:
|
26
|
+
- must-revalidate,no-cache,no-store
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: "<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-1\"/>\n<title>Error
|
30
|
+
404 Not Found</title>\n</head>\n<body>\n<h2>HTTP ERROR: 404</h2>\n<p>Problem
|
31
|
+
accessing /youtracks/rest/user/login. Reason:\n<pre> Not Found</pre></p>\n<hr
|
32
|
+
/><i><small>Powered by Jetty://</small></i>\n \n
|
33
|
+
\ \n \n
|
34
|
+
\ \n \n
|
35
|
+
\ \n \n
|
36
|
+
\ \n \n
|
37
|
+
\ \n \n
|
38
|
+
\ \n \n
|
39
|
+
\ \n \n
|
40
|
+
\ \n \n
|
41
|
+
\ \n \n
|
42
|
+
\ \n</body>\n</html>\n"
|
43
|
+
http_version:
|
44
|
+
recorded_at: Fri, 07 Feb 2014 22:01:29 GMT
|
45
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://testcloud.myjetbrains.com/youtrack/rest/user/login
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: login=testuser&password=testuser
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx
|
17
|
+
Date:
|
18
|
+
- Fri, 07 Feb 2014 22:39:52 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/xml; charset=UTF-8
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
Set-Cookie:
|
28
|
+
- JSESSIONID=1x6fz1xa878jlneco9qotclw8;Path=/youtrack;Secure
|
29
|
+
- jetbrains.charisma.main.security.PRINCIPAL=YWU1ZGViODIyZTBkNzE5OTI5MDA0NzFhNzE5OWQwZDk1YjhlN2M5ZDA1YzQwYTgyNDVhMjgxZmQyYzFkNjY4NDp0ZXN0dXNlcg;Path=/youtrack;Expires=Sat,
|
30
|
+
07-Feb-2015 22:39:52 GMT
|
31
|
+
Expires:
|
32
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache, no-store, no-transform, must-revalidate
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: <login>ok</login>
|
38
|
+
http_version:
|
39
|
+
recorded_at: Fri, 07 Feb 2014 22:41:39 GMT
|
40
|
+
- request:
|
41
|
+
method: get
|
42
|
+
uri: https://testcloud.myjetbrains.com/youtrack/rest/user/current
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ''
|
46
|
+
headers:
|
47
|
+
Cookie:
|
48
|
+
- JSESSIONID=1x6fz1xa878jlneco9qotclw8;Path=/youtrack;Secure, jetbrains.charisma.main.security.PRINCIPAL=YWU1ZGViODIyZTBkNzE5OTI5MDA0NzFhNzE5OWQwZDk1YjhlN2M5ZDA1YzQwYTgyNDVhMjgxZmQyYzFkNjY4NDp0ZXN0dXNlcg;Path=/youtrack;Expires=Sat,
|
49
|
+
07-Feb-2015 22:39:52 GMT
|
50
|
+
response:
|
51
|
+
status:
|
52
|
+
code: 200
|
53
|
+
message: OK
|
54
|
+
headers:
|
55
|
+
Server:
|
56
|
+
- nginx
|
57
|
+
Date:
|
58
|
+
- Fri, 07 Feb 2014 22:41:19 GMT
|
59
|
+
Content-Type:
|
60
|
+
- application/xml; charset=UTF-8
|
61
|
+
Content-Length:
|
62
|
+
- '130'
|
63
|
+
Connection:
|
64
|
+
- keep-alive
|
65
|
+
Vary:
|
66
|
+
- Accept-Encoding
|
67
|
+
Cache-Control:
|
68
|
+
- no-cache, no-store, no-transform, must-revalidate
|
69
|
+
body:
|
70
|
+
encoding: UTF-8
|
71
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user login="testuser"
|
72
|
+
email="testuser@testcloud.de" fullName="Test User"/>
|
73
|
+
http_version:
|
74
|
+
recorded_at: Fri, 07 Feb 2014 22:43:05 GMT
|
75
|
+
recorded_with: VCR 2.8.0
|
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://testcloud.myjetbrains.com/youtrack/rest/user/login
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: login=testuser&password=testuser
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx
|
17
|
+
Date:
|
18
|
+
- Fri, 07 Feb 2014 22:42:20 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/xml; charset=UTF-8
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Vary:
|
26
|
+
- Accept-Encoding
|
27
|
+
Set-Cookie:
|
28
|
+
- JSESSIONID=xt1ovx8ac8acjld0v70wx33o;Path=/youtrack;Secure
|
29
|
+
- jetbrains.charisma.main.security.PRINCIPAL=YWU1ZGViODIyZTBkNzE5OTI5MDA0NzFhNzE5OWQwZDk1YjhlN2M5ZDA1YzQwYTgyNDVhMjgxZmQyYzFkNjY4NDp0ZXN0dXNlcg;Path=/youtrack;Expires=Sat,
|
30
|
+
07-Feb-2015 22:42:20 GMT
|
31
|
+
Expires:
|
32
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
33
|
+
Cache-Control:
|
34
|
+
- no-cache, no-store, no-transform, must-revalidate
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: <login>ok</login>
|
38
|
+
http_version:
|
39
|
+
recorded_at: Fri, 07 Feb 2014 22:44:07 GMT
|
40
|
+
- request:
|
41
|
+
method: get
|
42
|
+
uri: https://testcloud.myjetbrains.com/youtrack/rest/user/testuser
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ''
|
46
|
+
headers:
|
47
|
+
Cookie:
|
48
|
+
- JSESSIONID=xt1ovx8ac8acjld0v70wx33o;Path=/youtrack;Secure, jetbrains.charisma.main.security.PRINCIPAL=YWU1ZGViODIyZTBkNzE5OTI5MDA0NzFhNzE5OWQwZDk1YjhlN2M5ZDA1YzQwYTgyNDVhMjgxZmQyYzFkNjY4NDp0ZXN0dXNlcg;Path=/youtrack;Expires=Sat,
|
49
|
+
07-Feb-2015 22:42:20 GMT
|
50
|
+
response:
|
51
|
+
status:
|
52
|
+
code: 200
|
53
|
+
message: OK
|
54
|
+
headers:
|
55
|
+
Server:
|
56
|
+
- nginx
|
57
|
+
Date:
|
58
|
+
- Fri, 07 Feb 2014 22:42:21 GMT
|
59
|
+
Content-Type:
|
60
|
+
- application/xml; charset=UTF-8
|
61
|
+
Content-Length:
|
62
|
+
- '130'
|
63
|
+
Connection:
|
64
|
+
- keep-alive
|
65
|
+
Vary:
|
66
|
+
- Accept-Encoding
|
67
|
+
Cache-Control:
|
68
|
+
- no-cache, no-store, no-transform, must-revalidate
|
69
|
+
body:
|
70
|
+
encoding: UTF-8
|
71
|
+
string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user login="testuser"
|
72
|
+
email="testuser@testcloud.de" fullName="Test User"/>
|
73
|
+
http_version:
|
74
|
+
recorded_at: Fri, 07 Feb 2014 22:44:08 GMT
|
75
|
+
recorded_with: VCR 2.8.0
|