backlog_kit 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/README.md +4 -3
- data/Rakefile +4 -0
- data/backlog_kit.gemspec +4 -1
- data/lib/backlog_kit/client.rb +40 -0
- data/lib/backlog_kit/client/authorization.rb +12 -0
- data/lib/backlog_kit/client/git.rb +7 -0
- data/lib/backlog_kit/client/group.rb +25 -0
- data/lib/backlog_kit/client/issue.rb +94 -0
- data/lib/backlog_kit/client/notification.rb +19 -1
- data/lib/backlog_kit/client/priority.rb +6 -0
- data/lib/backlog_kit/client/project.rb +294 -2
- data/lib/backlog_kit/client/resolution.rb +6 -0
- data/lib/backlog_kit/client/space.rb +27 -0
- data/lib/backlog_kit/client/star.rb +31 -0
- data/lib/backlog_kit/client/status.rb +6 -0
- data/lib/backlog_kit/client/user.rb +57 -0
- data/lib/backlog_kit/client/wiki.rb +59 -0
- data/lib/backlog_kit/error.rb +10 -0
- data/lib/backlog_kit/hash_extensions.rb +4 -0
- data/lib/backlog_kit/version.rb +1 -1
- metadata +35 -5
@@ -1,30 +1,57 @@
|
|
1
1
|
module BacklogKit
|
2
2
|
class Client
|
3
|
+
|
4
|
+
# Methods for the Space API
|
3
5
|
module Space
|
6
|
+
|
7
|
+
# Get a space
|
8
|
+
#
|
9
|
+
# @return [BacklogKit::Response] The space information
|
4
10
|
def get_space
|
5
11
|
get('space')
|
6
12
|
end
|
7
13
|
|
14
|
+
# Get list of space activities
|
15
|
+
#
|
16
|
+
# @param params [Hash] Request parameters
|
17
|
+
# @return [BacklogKit::Response] List of recent updates in your space
|
8
18
|
def get_space_activities(params = {})
|
9
19
|
get('space/activities', params)
|
10
20
|
end
|
11
21
|
|
22
|
+
# Download a space logo image
|
23
|
+
#
|
24
|
+
# @return [BacklogKit::Response] Binary image data
|
12
25
|
def download_space_icon
|
13
26
|
get('space/image')
|
14
27
|
end
|
15
28
|
|
29
|
+
# Get a space notification
|
30
|
+
#
|
31
|
+
# @return [BacklogKit::Response] The notification information
|
16
32
|
def get_space_notification
|
17
33
|
get('space/notification')
|
18
34
|
end
|
19
35
|
|
36
|
+
# Update a space notification
|
37
|
+
#
|
38
|
+
# @param content [String] Content of the notification
|
39
|
+
# @return [BacklogKit::Response] The notification information
|
20
40
|
def update_space_notification(content)
|
21
41
|
put('space/notification', content: content)
|
22
42
|
end
|
23
43
|
|
44
|
+
# Get a space disk usage
|
45
|
+
#
|
46
|
+
# @return [BacklogKit::Response] The disk usage
|
24
47
|
def get_space_disk_usage
|
25
48
|
get('space/diskUsage')
|
26
49
|
end
|
27
50
|
|
51
|
+
# Upload attachment file for issue or wiki
|
52
|
+
#
|
53
|
+
# @param file_path [String] Path of the file
|
54
|
+
# @return [BacklogKit::Response] The file information
|
28
55
|
def upload_attachment(file_path)
|
29
56
|
payload = { file: Faraday::UploadIO.new(file_path, 'application/octet-stream') }
|
30
57
|
post('space/attachment', payload)
|
@@ -1,17 +1,48 @@
|
|
1
1
|
module BacklogKit
|
2
2
|
class Client
|
3
|
+
|
4
|
+
# Methods for the Star API
|
3
5
|
module Star
|
6
|
+
|
7
|
+
# Add a star to an issue
|
8
|
+
#
|
9
|
+
# @param issue_id [Integer, String] Issue id
|
10
|
+
# @return [BacklogKit::Response] No content response
|
4
11
|
def add_issue_star(issue_id)
|
5
12
|
post('stars', issue_id: issue_id)
|
6
13
|
end
|
7
14
|
|
15
|
+
# Add a star to an issue comment
|
16
|
+
#
|
17
|
+
# @param comment_id [Integer, String] Comment id
|
18
|
+
# @return [BacklogKit::Response] No content response
|
8
19
|
def add_issue_comment_star(comment_id)
|
9
20
|
post('stars', comment_id: comment_id)
|
10
21
|
end
|
11
22
|
|
23
|
+
# Add a star to a wiki page
|
24
|
+
#
|
25
|
+
# @param wiki_id [Integer, String] Wiki page id
|
26
|
+
# @return [BacklogKit::Response] No content response
|
12
27
|
def add_wiki_star(wiki_id)
|
13
28
|
post('stars', wiki_id: wiki_id)
|
14
29
|
end
|
30
|
+
|
31
|
+
# Add a star to a pull request
|
32
|
+
#
|
33
|
+
# @param pull_request_id [Integer, String] Pull request id
|
34
|
+
# @return [BacklogKit::Response] No content response
|
35
|
+
def add_pull_request_star(pull_request_id)
|
36
|
+
post('stars', pull_request_id: pull_request_id)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Add a star to a pull request comment
|
40
|
+
#
|
41
|
+
# @param pull_request_comment_id [Integer, String] Pull request comment id
|
42
|
+
# @return [BacklogKit::Response] No content response
|
43
|
+
def add_pull_request_comment_star(pull_request_comment_id)
|
44
|
+
post('stars', pull_request_comment_id: pull_request_comment_id)
|
45
|
+
end
|
15
46
|
end
|
16
47
|
end
|
17
48
|
end
|
@@ -1,54 +1,111 @@
|
|
1
1
|
module BacklogKit
|
2
2
|
class Client
|
3
|
+
|
4
|
+
# Methods for the User API
|
3
5
|
module User
|
6
|
+
|
7
|
+
# Get list of users
|
8
|
+
#
|
9
|
+
# @return [BacklogKit::Response] List of users
|
4
10
|
def get_users
|
5
11
|
get('users')
|
6
12
|
end
|
7
13
|
|
14
|
+
# Get a user
|
15
|
+
#
|
16
|
+
# @param user_id [Integer, String] User id
|
17
|
+
# @return [BacklogKit::Response] The user information
|
8
18
|
def get_user(user_id)
|
9
19
|
get("users/#{user_id}")
|
10
20
|
end
|
11
21
|
|
22
|
+
# Create a new user
|
23
|
+
#
|
24
|
+
# @param params [Hash] Request parameters
|
25
|
+
# @return [BacklogKit::Response] The user information
|
12
26
|
def create_user(params = {})
|
13
27
|
post('users', params)
|
14
28
|
end
|
15
29
|
|
30
|
+
# Update a user
|
31
|
+
#
|
32
|
+
# @param user_id [Integer, String] User id
|
33
|
+
# @param params [Hash] Request parameters
|
34
|
+
# @return [BacklogKit::Response] The user information
|
16
35
|
def update_user(user_id, params = {})
|
17
36
|
patch("users/#{user_id}", params)
|
18
37
|
end
|
19
38
|
|
39
|
+
# Delete a user
|
40
|
+
#
|
41
|
+
# @param user_id [Integer, String] User id
|
42
|
+
# @return [BacklogKit::Response] The user information
|
20
43
|
def delete_user(user_id)
|
21
44
|
delete("users/#{user_id}")
|
22
45
|
end
|
23
46
|
|
47
|
+
# Get a authentication user
|
48
|
+
#
|
49
|
+
# @return [BacklogKit::Response] The user information
|
24
50
|
def get_myself
|
25
51
|
get('users/myself')
|
26
52
|
end
|
27
53
|
|
54
|
+
# Download a user icon image
|
55
|
+
#
|
56
|
+
# @param user_id [Integer, String] User id
|
57
|
+
# @return [BacklogKit::Response] Binary image data
|
28
58
|
def download_user_icon(user_id)
|
29
59
|
get("users/#{user_id}/icon")
|
30
60
|
end
|
31
61
|
|
62
|
+
# Get list of user activities
|
63
|
+
#
|
64
|
+
# @param user_id [Integer, String] User id
|
65
|
+
# @param params [Hash] Request parameters
|
66
|
+
# @return [BacklogKit::Response] List of user's recent updates
|
32
67
|
def get_user_activities(user_id, params = {})
|
33
68
|
get("users/#{user_id}/activities", params)
|
34
69
|
end
|
35
70
|
|
71
|
+
# Get list of user stars
|
72
|
+
#
|
73
|
+
# @param user_id [Integer, String] User id
|
74
|
+
# @param params [Hash] Request parameters
|
75
|
+
# @return [BacklogKit::Response] List of stars
|
36
76
|
def get_user_stars(user_id, params = {})
|
37
77
|
get("users/#{user_id}/stars", params)
|
38
78
|
end
|
39
79
|
|
80
|
+
# Get number of user stars
|
81
|
+
#
|
82
|
+
# @param user_id [Integer, String] User id
|
83
|
+
# @param params [Hash] Request parameters
|
84
|
+
# @return [BacklogKit::Response] Number of stars
|
40
85
|
def get_user_star_count(user_id, params = {})
|
41
86
|
get("users/#{user_id}/stars/count", params)
|
42
87
|
end
|
43
88
|
|
89
|
+
# Get list of recently viewed issues
|
90
|
+
#
|
91
|
+
# @param params [Hash] Request parameters
|
92
|
+
# @return [BacklogKit::Response] List of recently viewed issues
|
44
93
|
def get_recently_viewed_issues(params = {})
|
45
94
|
get('users/myself/recentlyViewedIssues', params)
|
46
95
|
end
|
47
96
|
|
97
|
+
# Get list of recently viewed projects
|
98
|
+
#
|
99
|
+
# @param params [Hash] Request parameters
|
100
|
+
# @return [BacklogKit::Response] List of recently viewed projects
|
48
101
|
def get_recently_viewed_projects(params = {})
|
49
102
|
get('users/myself/recentlyViewedProjects', params)
|
50
103
|
end
|
51
104
|
|
105
|
+
# Get list of recently viewed wiki pages
|
106
|
+
#
|
107
|
+
# @param params [Hash] Request parameters
|
108
|
+
# @return [BacklogKit::Response] List of recently viewed pages
|
52
109
|
def get_recently_viewed_wikis(params = {})
|
53
110
|
get('users/myself/recentlyViewedWikis', params)
|
54
111
|
end
|
@@ -1,51 +1,110 @@
|
|
1
1
|
module BacklogKit
|
2
2
|
class Client
|
3
|
+
|
4
|
+
# Methods for the Wiki API
|
3
5
|
module Wiki
|
6
|
+
|
7
|
+
# Get list of wiki pages
|
8
|
+
#
|
9
|
+
# @param project_id_or_key [Integer, String] Project id or project key
|
10
|
+
# @return [BacklogKit::Response] List of pages
|
4
11
|
def get_wikis(project_id_or_key)
|
5
12
|
get('wikis', project_id_or_key: project_id_or_key)
|
6
13
|
end
|
7
14
|
|
15
|
+
# Get number of wiki pages
|
16
|
+
#
|
17
|
+
# @param project_id_or_key [Integer, String] Project id or project key
|
18
|
+
# @return [BacklogKit::Response] Number of pages
|
8
19
|
def get_wiki_count(project_id_or_key)
|
9
20
|
get('wikis/count', project_id_or_key: project_id_or_key)
|
10
21
|
end
|
11
22
|
|
23
|
+
# Get a wiki page
|
24
|
+
#
|
25
|
+
# @param wiki_id [Integer, String] Wiki page id
|
26
|
+
# @return [BacklogKit::Response] The page information
|
12
27
|
def get_wiki(wiki_id)
|
13
28
|
get("wikis/#{wiki_id}")
|
14
29
|
end
|
15
30
|
|
31
|
+
# Get list of wiki page tags
|
32
|
+
#
|
33
|
+
# @param project_id_or_key [Integer, String] Project id or project key
|
34
|
+
# @return [BacklogKit::Response] List of tags
|
16
35
|
def get_wiki_tags(project_id_or_key)
|
17
36
|
get('wikis/tags', project_id_or_key: project_id_or_key)
|
18
37
|
end
|
19
38
|
|
39
|
+
# Create a new wiki page
|
40
|
+
#
|
41
|
+
# @param name [String] Name of the page
|
42
|
+
# @param content [String] Content of the page
|
43
|
+
# @param project_id [Integer, String] Project id
|
44
|
+
# @param params [Hash] Request parameters
|
45
|
+
# @return [BacklogKit::Response] The page information
|
20
46
|
def create_wiki(name, content, project_id, params = {})
|
21
47
|
params.merge!(name: name, content: content, project_id: project_id)
|
22
48
|
post('wikis', params)
|
23
49
|
end
|
24
50
|
|
51
|
+
# Update a wiki page
|
52
|
+
#
|
53
|
+
# @param wiki_id [Integer, String] Wiki page id
|
54
|
+
# @param params [Hash] Request parameters
|
55
|
+
# @return [BacklogKit::Response] The page information
|
25
56
|
def update_wiki(wiki_id, params = {})
|
26
57
|
patch("wikis/#{wiki_id}", params)
|
27
58
|
end
|
28
59
|
|
60
|
+
# Delete a wiki page
|
61
|
+
#
|
62
|
+
# @param wiki_id [Integer, String] Wiki page id
|
63
|
+
# @param params [Hash] Request parameters
|
64
|
+
# @return [BacklogKit::Response] The page information
|
29
65
|
def delete_wiki(wiki_id, params = {})
|
30
66
|
delete("wikis/#{wiki_id}", params)
|
31
67
|
end
|
32
68
|
|
69
|
+
# Get list of shared files on wiki
|
70
|
+
#
|
71
|
+
# @param wiki_id [Integer, String] Wiki page id
|
72
|
+
# @return [BacklogKit::Response] List of files
|
33
73
|
def get_wiki_shared_files(wiki_id)
|
34
74
|
get("wikis/#{wiki_id}/sharedFiles")
|
35
75
|
end
|
36
76
|
|
77
|
+
# Link shared files to wiki
|
78
|
+
#
|
79
|
+
# @param wiki_id [Integer, String] Wiki page id
|
80
|
+
# @param file_ids [Array] List of file ids
|
81
|
+
# @return [BacklogKit::Response] List of files
|
37
82
|
def link_wiki_shared_files(wiki_id, file_ids = [])
|
38
83
|
post("wikis/#{wiki_id}/sharedFiles", file_id: file_ids)
|
39
84
|
end
|
40
85
|
|
86
|
+
# Unlink a shared file on wiki
|
87
|
+
#
|
88
|
+
# @param wiki_id [Integer, String] Wiki page id
|
89
|
+
# @param file_id [Integer, String] Shared file id
|
90
|
+
# @return [BacklogKit::Response] The file information
|
41
91
|
def unlink_wiki_shared_file(wiki_id, file_id)
|
42
92
|
delete("wikis/#{wiki_id}/sharedFiles/#{file_id}")
|
43
93
|
end
|
44
94
|
|
95
|
+
# Get list of wiki histories
|
96
|
+
#
|
97
|
+
# @param wiki_id [Integer, String] Wiki page id
|
98
|
+
# @param params [Hash] Request parameters
|
99
|
+
# @return [BacklogKit::Response] List of histories
|
45
100
|
def get_wiki_histories(wiki_id, params = {})
|
46
101
|
get("wikis/#{wiki_id}/history", params)
|
47
102
|
end
|
48
103
|
|
104
|
+
# Get list of wiki stars
|
105
|
+
#
|
106
|
+
# @param wiki_id [Integer, String] Wiki page id
|
107
|
+
# @return [BacklogKit::Response] List of stars
|
49
108
|
def get_wiki_stars(wiki_id)
|
50
109
|
get("wikis/#{wiki_id}/stars")
|
51
110
|
end
|
data/lib/backlog_kit/error.rb
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
module BacklogKit
|
2
|
+
|
3
|
+
# Custom error class for rescuing from Backlog errors
|
4
|
+
#
|
5
|
+
# @see http://developer.nulab-inc.com/docs/backlog/error-response
|
2
6
|
class Error < StandardError
|
7
|
+
|
8
|
+
# Make a custom error message
|
9
|
+
#
|
10
|
+
# @param response [Hash] Error response
|
11
|
+
# @param index [Integer] Index of the error
|
12
|
+
# @return [String] Error message
|
3
13
|
def self.build_error_message(response, index)
|
4
14
|
message = "[ERROR #{index}] "
|
5
15
|
message += "#{self.name.demodulize} - #{response['message']} (CODE: #{response['code']})"
|
data/lib/backlog_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backlog_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- emsk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.10.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.10.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +164,34 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.8.1
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: yard
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.8.7
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.8.7
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: redcarpet
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '3.3'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '3.3'
|
167
195
|
description: Client library for the Nulab's Backlog API version 2 written in Ruby.
|
168
196
|
email:
|
169
197
|
- emsk1987@gmail.com
|
@@ -175,6 +203,7 @@ files:
|
|
175
203
|
- ".gitignore"
|
176
204
|
- ".rspec"
|
177
205
|
- ".travis.yml"
|
206
|
+
- ".yardopts"
|
178
207
|
- Gemfile
|
179
208
|
- LICENSE.txt
|
180
209
|
- README.md
|
@@ -218,7 +247,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
247
|
requirements:
|
219
248
|
- - ">="
|
220
249
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
250
|
+
version: 2.0.0
|
222
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
252
|
requirements:
|
224
253
|
- - ">="
|
@@ -231,3 +260,4 @@ signing_key:
|
|
231
260
|
specification_version: 4
|
232
261
|
summary: Wrapper for the Backlog API v2.
|
233
262
|
test_files: []
|
263
|
+
has_rdoc:
|