jiralicious 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. data/.gitignore +2 -1
  2. data/.ruby-gemset +1 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +5 -0
  5. data/README.md +32 -4
  6. data/jiralicious.gemspec +7 -5
  7. data/lib/jiralicious.rb +10 -3
  8. data/lib/jiralicious/base.rb +114 -0
  9. data/lib/jiralicious/configuration.rb +13 -2
  10. data/lib/jiralicious/cookie_session.rb +5 -5
  11. data/lib/jiralicious/custom_field_option.rb +27 -0
  12. data/lib/jiralicious/field.rb +39 -0
  13. data/lib/jiralicious/issue.rb +111 -26
  14. data/lib/jiralicious/issue/comment.rb +62 -0
  15. data/lib/jiralicious/issue/fields.rb +93 -0
  16. data/lib/jiralicious/issue/transitions.rb +92 -0
  17. data/lib/jiralicious/issue/watchers.rb +47 -0
  18. data/lib/jiralicious/parsers/field_parser.rb +2 -2
  19. data/lib/jiralicious/project.rb +44 -0
  20. data/lib/jiralicious/search.rb +4 -1
  21. data/lib/jiralicious/search_result.rb +4 -0
  22. data/lib/jiralicious/version.rb +1 -1
  23. data/spec/basic_session_spec.rb +4 -4
  24. data/spec/comment_spec.rb +64 -0
  25. data/spec/configuration_spec.rb +9 -0
  26. data/spec/fixtures/comment.json +30 -0
  27. data/spec/fixtures/comment_single.json +29 -0
  28. data/spec/fixtures/issue.json +89 -93
  29. data/spec/fixtures/issue_2.json +30 -0
  30. data/spec/fixtures/issue_create.json +5 -0
  31. data/spec/fixtures/issue_createmeta.json +34 -0
  32. data/spec/fixtures/issue_editmeta.json +22 -0
  33. data/spec/fixtures/issue_update.json +164 -0
  34. data/spec/fixtures/jira.yml +7 -0
  35. data/spec/fixtures/project.json +87 -0
  36. data/spec/fixtures/project_issue_list.json +20 -0
  37. data/spec/fixtures/projects.json +22 -0
  38. data/spec/fixtures/search.json +9 -9
  39. data/spec/fixtures/test.json +24 -0
  40. data/spec/fixtures/transitions.json +61 -61
  41. data/spec/fixtures/watchers.json +17 -0
  42. data/spec/issue_spec.rb +255 -21
  43. data/spec/project_spec.rb +55 -0
  44. data/spec/search_result_spec.rb +20 -8
  45. data/spec/search_spec.rb +6 -6
  46. data/spec/support/http.rb +55 -2
  47. data/spec/watchers_spec.rb +43 -0
  48. metadata +154 -100
  49. data/.rvmrc +0 -1
  50. data/spec/cookie_session_spec.rb +0 -268
@@ -29,4 +29,13 @@ describe Jiralicious::Configuration do
29
29
  Jiralicious.api_version.should == "2.0aplha"
30
30
  Jiralicious.auth_type.should == :cookie_session
31
31
  end
32
+
33
+ it "loads the yml in the specified format into the configuation variables" do
34
+ Jiralicious.load_yml(jira_yml)
35
+ Jiralicious.username.should == "jira_admin"
36
+ Jiralicious.password.should == "jira_admin"
37
+ Jiralicious.uri.should == "http://localhost:8080"
38
+ Jiralicious.api_version.should == "latest"
39
+ Jiralicious.auth_type.should == :basic
40
+ end
32
41
  end
@@ -0,0 +1,30 @@
1
+ {
2
+ "startAt": 0,
3
+ "maxResults": 1,
4
+ "total": 1,
5
+ "comments": [
6
+ {
7
+ "self": "http://www.example.com/jira/rest/api/2.0/issue/EX-1/comment/10000",
8
+ "id": "10000",
9
+ "author": {
10
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
11
+ "name": "fred",
12
+ "displayName": "Fred F. User",
13
+ "active": false
14
+ },
15
+ "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
16
+ "updateAuthor": {
17
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
18
+ "name": "fred",
19
+ "displayName": "Fred F. User",
20
+ "active": false
21
+ },
22
+ "created": "2013-02-26T07:47:25.089-0600",
23
+ "updated": "2013-02-26T07:47:25.090-0600",
24
+ "visibility": {
25
+ "type": "role",
26
+ "value": "Administrators"
27
+ }
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "self": "http://www.example.com/rest/api/2/issue/10265/comment/10402",
3
+ "id": "10000",
4
+ "author": {
5
+ "self": "http://www.example.com/rest/api/2/user?username=fred",
6
+ "name": "fred",
7
+ "emailAddress": "fred@example.com",
8
+ "avatarUrls": {
9
+ "16x16": "http://www.example.com/secure/useravatar?size=small&avatarId=10122",
10
+ "48x48": "http://www.example.com/secure/useravatar?avatarId=10122"
11
+ },
12
+ "displayName": "JIRA Administrator",
13
+ "active": true
14
+ },
15
+ "body": "a new comment without key after specials",
16
+ "updateAuthor": {
17
+ "self": "http://www.example.com/rest/api/2/user?username=fred",
18
+ "name": "fred",
19
+ "emailAddress": "fred@example.com",
20
+ "avatarUrls": {
21
+ "16x16": "http://www.example.com/secure/useravatar?size=small&avatarId=10122",
22
+ "48x48": "http://www.example.com/secure/useravatar?avatarId=10122"
23
+ },
24
+ "displayName": "JIRA Administrator",
25
+ "active": true
26
+ },
27
+ "created": "2013-04-10T08:38:17.000-0500",
28
+ "updated": "2013-04-10T08:38:17.000-0500"
29
+ }
@@ -7,14 +7,14 @@
7
7
  "name": "sub-tasks",
8
8
  "type": "issuelinks",
9
9
  "value": [
10
- {
11
- "issueKey": "EX-2",
12
- "issue": "http://example.com:8080/jira/rest/api/2.0/issue/EX-2",
13
- "type": {
14
- "name": "Sub-task",
15
- "direction": "OUTBOUND"
16
- }
10
+ {
11
+ "issueKey": "EX-2",
12
+ "issue": "http://example.com:8080/jira/rest/api/2.0/issue/EX-2",
13
+ "type": {
14
+ "name": "Sub-task",
15
+ "direction": "OUTBOUND"
17
16
  }
17
+ }
18
18
  ]
19
19
  },
20
20
  "timetracking": {
@@ -40,54 +40,50 @@
40
40
  "type": "java.util.Date",
41
41
  "value": 1
42
42
  },
43
- "description": {
44
- "name": "description",
45
- "type": "java.lang.String",
46
- "value": "example bug report"
47
- },
43
+ "description": "example bug report",
48
44
  "links": {
49
45
  "name": "links",
50
46
  "type": "issuelinks",
51
47
  "value": [
52
- {
53
- "issueKey": "PRJ-2",
54
- "issue": "http://example.com:8080/jira/rest/api/2.0/issue/PRJ-2",
55
- "type": {
56
- "name": "Dependent",
57
- "direction": "OUTBOUND",
58
- "description": "depends on"
59
- }
60
- },
61
- {
62
- "issueKey": "PRJ-3",
63
- "issue": "http://example.com:8080/jira/rest/api/2.0/issue/PRJ-3",
64
- "type": {
65
- "name": "Dependent",
66
- "direction": "INBOUND",
67
- "description": "is depended by"
68
- }
48
+ {
49
+ "issueKey": "PRJ-2",
50
+ "issue": "http://example.com:8080/jira/rest/api/2.0/issue/PRJ-2",
51
+ "type": {
52
+ "name": "Dependent",
53
+ "direction": "OUTBOUND",
54
+ "description": "depends on"
69
55
  }
56
+ },
57
+ {
58
+ "issueKey": "PRJ-3",
59
+ "issue": "http://example.com:8080/jira/rest/api/2.0/issue/PRJ-3",
60
+ "type": {
61
+ "name": "Dependent",
62
+ "direction": "INBOUND",
63
+ "description": "is depended by"
64
+ }
65
+ }
70
66
  ]
71
67
  },
72
68
  "attachment": {
73
69
  "name": "attachment",
74
70
  "type": "attachment",
75
71
  "value": [
76
- {
77
- "self": "http://www.example.com/jira/rest/api/2.0/attachments/10000",
78
- "filename": "picture.jpg",
79
- "author": {
80
- "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
81
- "name": "fred",
82
- "displayName": "Fred F. User",
83
- "active": false
84
- },
85
- "created": "2011-07-25T06:31:08.307-0500",
86
- "size": 23123,
87
- "mimeType": "image/jpeg",
88
- "content": "http://www.example.com/jira/attachments/10000",
89
- "thumbnail": "http://www.example.com/jira/secure/thumbnail/10000"
90
- }
72
+ {
73
+ "self": "http://www.example.com/jira/rest/api/2.0/attachments/10000",
74
+ "filename": "picture.jpg",
75
+ "author": {
76
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
77
+ "name": "fred",
78
+ "displayName": "Fred F. User",
79
+ "active": false
80
+ },
81
+ "created": "2011-07-25T06:31:08.307-0500",
82
+ "size": 23123,
83
+ "mimeType": "image/jpeg",
84
+ "content": "http://www.example.com/jira/attachments/10000",
85
+ "thumbnail": "http://www.example.com/jira/secure/thumbnail/10000"
86
+ }
91
87
  ]
92
88
  },
93
89
  "watcher": {
@@ -98,12 +94,12 @@
98
94
  "isWatching": false,
99
95
  "watchCount": 1,
100
96
  "watchers": [
101
- {
102
- "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
103
- "name": "fred",
104
- "displayName": "Fred F. User",
105
- "active": false
106
- }
97
+ {
98
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
99
+ "name": "fred",
100
+ "displayName": "Fred F. User",
101
+ "active": false
102
+ }
107
103
  ]
108
104
  }
109
105
  },
@@ -111,56 +107,56 @@
111
107
  "name": "comment",
112
108
  "type": "java.lang.String",
113
109
  "value": [
114
- {
115
- "self": "http://example.com:8080/jira/rest/api/2.0/comment/10000",
116
- "author": {
117
- "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
118
- "name": "fred",
119
- "displayName": "Fred F. User",
120
- "active": false
121
- },
122
- "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
123
- "updateAuthor": {
124
- "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
125
- "name": "fred",
126
- "displayName": "Fred F. User",
127
- "active": false
128
- },
129
- "created": "2011-07-25T06:31:08.311-0500",
130
- "updated": "2011-07-25T06:31:08.311-0500",
131
- "visibility": {
132
- "type": "ROLE",
133
- "value": "Administrators"
134
- }
110
+ {
111
+ "self": "http://example.com:8080/jira/rest/api/2.0/comment/10000",
112
+ "author": {
113
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
114
+ "name": "fred",
115
+ "displayName": "Fred F. User",
116
+ "active": false
117
+ },
118
+ "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
119
+ "updateAuthor": {
120
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
121
+ "name": "fred",
122
+ "displayName": "Fred F. User",
123
+ "active": false
124
+ },
125
+ "created": "2011-07-25T06:31:08.311-0500",
126
+ "updated": "2011-07-25T06:31:08.311-0500",
127
+ "visibility": {
128
+ "type": "ROLE",
129
+ "value": "Administrators"
135
130
  }
131
+ }
136
132
  ]
137
133
  },
138
134
  "worklog": {
139
135
  "name": "worklog",
140
136
  "type": "worklog",
141
137
  "value": [
142
- {
143
- "self": "http://www.example.com/jira/rest/api/2.0/worklog/10000",
144
- "author": {
145
- "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
146
- "name": "fred",
147
- "displayName": "Fred F. User",
148
- "active": false
149
- },
150
- "updateAuthor": {
151
- "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
152
- "name": "fred",
153
- "displayName": "Fred F. User",
154
- "active": false
155
- },
156
- "comment": "I did some work here.",
157
- "visibility": {
158
- "type": "GROUP",
159
- "value": "jira-developers"
160
- },
161
- "started": "2011-07-25T06:31:08.314-0500",
162
- "minutesSpent": 180
163
- }
138
+ {
139
+ "self": "http://www.example.com/jira/rest/api/2.0/worklog/10000",
140
+ "author": {
141
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
142
+ "name": "fred",
143
+ "displayName": "Fred F. User",
144
+ "active": false
145
+ },
146
+ "updateAuthor": {
147
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
148
+ "name": "fred",
149
+ "displayName": "Fred F. User",
150
+ "active": false
151
+ },
152
+ "comment": "I did some work here.",
153
+ "visibility": {
154
+ "type": "GROUP",
155
+ "value": "jira-developers"
156
+ },
157
+ "started": "2011-07-25T06:31:08.314-0500",
158
+ "minutesSpent": 180
159
+ }
164
160
  ]
165
161
  }
166
162
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "expand": "html",
3
+ "self": "http://example.com:8080/jira/rest/api/2.0/issue/EX-2",
4
+ "key": "EX-2",
5
+ "fields": {
6
+ "timetracking": {
7
+ "name": "timetracking",
8
+ "type": "timetracking",
9
+ "value": {
10
+ "timeoriginalestimate": 10,
11
+ "timeestimate": 3,
12
+ "timespent": 6
13
+ }
14
+ },
15
+ "project": {
16
+ "name": "project",
17
+ "type": "com.atlassian.jira.project.Project",
18
+ "value": {
19
+ "self": "http://www.example.com/jira/rest/api/2.0/project/EX",
20
+ "key": "EX",
21
+ "name": "Example"
22
+ }
23
+ },
24
+ "description": {
25
+ "name": "description",
26
+ "type": "java.lang.String",
27
+ "value": "example bug report"
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "id": "10050",
3
+ "key": "EX-2",
4
+ "self": "http://www.example.com/jira/rest/api/2/issue/10050"
5
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "expand": "projects",
3
+ "projects": [
4
+ {
5
+ "self": "http://www.example.com/jira/rest/api/2/project/EX",
6
+ "id": "10000",
7
+ "key": "EX",
8
+ "name": "Example Project",
9
+ "avatarUrls": {
10
+ "16x16": "http://www.example.com/jira/secure/projectavatar?size=small&pid=10000&avatarId=10011",
11
+ "48x48": "http://www.example.com/jira/secure/projectavatar?pid=10000&avatarId=10011"
12
+ },
13
+ "issuetypes": [
14
+ {
15
+ "self": "http://www.example.com/jira/rest/api/2/issueType/1",
16
+ "id": "1",
17
+ "description": "An error in the code",
18
+ "iconUrl": "http://www.example.com/jira/images/icons/issuetypes/bug.png",
19
+ "name": "Bug",
20
+ "subtask": false,
21
+ "fields": {
22
+ "issuetype": {
23
+ "required": true,
24
+ "name": "Issue Type",
25
+ "operations": [
26
+ "set"
27
+ ]
28
+ }
29
+ }
30
+ }
31
+ ]
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "fields": {
3
+ "summary": {
4
+ "required": false,
5
+ "schema": {
6
+ "type": "array",
7
+ "items": "option",
8
+ "custom": "com.atlassian.jira.plugin.system.customfieldtypes:multiselect",
9
+ "customId": 10001
10
+ },
11
+ "name": "My Multi Select",
12
+ "operations": [
13
+ "set",
14
+ "add"
15
+ ],
16
+ "allowedValues": [
17
+ "red",
18
+ "blue"
19
+ ]
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,164 @@
1
+ {
2
+ "expand": "html",
3
+ "self": "http://example.com:8080/jira/rest/api/2.0/issue/EX-1",
4
+ "key": "EX-3",
5
+ "fields": {
6
+ "sub-tasks": {
7
+ "name": "sub-tasks",
8
+ "type": "issuelinks",
9
+ "value": [
10
+ {
11
+ "issueKey": "EX-2",
12
+ "issue": "http://example.com:8080/jira/rest/api/2.0/issue/EX-2",
13
+ "type": {
14
+ "name": "Sub-task",
15
+ "direction": "OUTBOUND"
16
+ }
17
+ }
18
+ ]
19
+ },
20
+ "timetracking": {
21
+ "name": "timetracking",
22
+ "type": "timetracking",
23
+ "value": {
24
+ "timeoriginalestimate": 10,
25
+ "timeestimate": 3,
26
+ "timespent": 6
27
+ }
28
+ },
29
+ "project": {
30
+ "name": "project",
31
+ "type": "com.atlassian.jira.project.Project",
32
+ "value": {
33
+ "self": "http://www.example.com/jira/rest/api/2.0/project/EX",
34
+ "key": "EX",
35
+ "name": "Example"
36
+ }
37
+ },
38
+ "updated": {
39
+ "name": "updated",
40
+ "type": "java.util.Date",
41
+ "value": 1
42
+ },
43
+ "description": "example bug report updated description ",
44
+ "labels": ["test_label"],
45
+ "links": {
46
+ "name": "links",
47
+ "type": "issuelinks",
48
+ "value": [
49
+ {
50
+ "issueKey": "PRJ-2",
51
+ "issue": "http://example.com:8080/jira/rest/api/2.0/issue/PRJ-2",
52
+ "type": {
53
+ "name": "Dependent",
54
+ "direction": "OUTBOUND",
55
+ "description": "depends on"
56
+ }
57
+ },
58
+ {
59
+ "issueKey": "PRJ-3",
60
+ "issue": "http://example.com:8080/jira/rest/api/2.0/issue/PRJ-3",
61
+ "type": {
62
+ "name": "Dependent",
63
+ "direction": "INBOUND",
64
+ "description": "is depended by"
65
+ }
66
+ }
67
+ ]
68
+ },
69
+ "attachment": {
70
+ "name": "attachment",
71
+ "type": "attachment",
72
+ "value": [
73
+ {
74
+ "self": "http://www.example.com/jira/rest/api/2.0/attachments/10000",
75
+ "filename": "picture.jpg",
76
+ "author": {
77
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
78
+ "name": "fred",
79
+ "displayName": "Fred F. User",
80
+ "active": false
81
+ },
82
+ "created": "2011-07-25T06:31:08.307-0500",
83
+ "size": 23123,
84
+ "mimeType": "image/jpeg",
85
+ "content": "http://www.example.com/jira/attachments/10000",
86
+ "thumbnail": "http://www.example.com/jira/secure/thumbnail/10000"
87
+ }
88
+ ]
89
+ },
90
+ "watcher": {
91
+ "name": "watcher",
92
+ "type": "watcher",
93
+ "value": {
94
+ "self": "http://www.example.com/jira/rest/api/2.0/issue/EX-1/watchers",
95
+ "isWatching": false,
96
+ "watchCount": 1,
97
+ "watchers": [
98
+ {
99
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
100
+ "name": "fred",
101
+ "displayName": "Fred F. User",
102
+ "active": false
103
+ }
104
+ ]
105
+ }
106
+ },
107
+ "comment": {
108
+ "name": "comment",
109
+ "type": "java.lang.String",
110
+ "value": [
111
+ {
112
+ "self": "http://example.com:8080/jira/rest/api/2.0/comment/10000",
113
+ "author": {
114
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
115
+ "name": "fred",
116
+ "displayName": "Fred F. User",
117
+ "active": false
118
+ },
119
+ "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
120
+ "updateAuthor": {
121
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
122
+ "name": "fred",
123
+ "displayName": "Fred F. User",
124
+ "active": false
125
+ },
126
+ "created": "2011-07-25T06:31:08.311-0500",
127
+ "updated": "2011-07-25T06:31:08.311-0500",
128
+ "visibility": {
129
+ "type": "ROLE",
130
+ "value": "Administrators"
131
+ }
132
+ }
133
+ ]
134
+ },
135
+ "worklog": {
136
+ "name": "worklog",
137
+ "type": "worklog",
138
+ "value": [
139
+ {
140
+ "self": "http://www.example.com/jira/rest/api/2.0/worklog/10000",
141
+ "author": {
142
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
143
+ "name": "fred",
144
+ "displayName": "Fred F. User",
145
+ "active": false
146
+ },
147
+ "updateAuthor": {
148
+ "self": "http://www.example.com/jira/rest/api/2.0/user?username=fred",
149
+ "name": "fred",
150
+ "displayName": "Fred F. User",
151
+ "active": false
152
+ },
153
+ "comment": "I did some work here.",
154
+ "visibility": {
155
+ "type": "GROUP",
156
+ "value": "jira-developers"
157
+ },
158
+ "started": "2011-07-25T06:31:08.314-0500",
159
+ "minutesSpent": 180
160
+ }
161
+ ]
162
+ }
163
+ }
164
+ }