redmine_api_helper 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of redmine_api_helper might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.gitattributes +2 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +339 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/redmine_api_helper.rb +44 -0
- data/lib/redmine_api_helper/api_helper.rb +310 -0
- data/lib/redmine_api_helper/args_helper.rb +96 -0
- data/lib/redmine_api_helper/attachments_api_helper.rb +52 -0
- data/lib/redmine_api_helper/define_api_helpers.rb +78 -0
- data/lib/redmine_api_helper/document_categories_api_helper.rb +38 -0
- data/lib/redmine_api_helper/groups_api_helper.rb +80 -0
- data/lib/redmine_api_helper/helpers.rb +48 -0
- data/lib/redmine_api_helper/issue_priorities_api_helper.rb +38 -0
- data/lib/redmine_api_helper/issue_relations_api_helper.rb +66 -0
- data/lib/redmine_api_helper/issue_statuses_api_helper.rb +36 -0
- data/lib/redmine_api_helper/issues_api_helper.rb +124 -0
- data/lib/redmine_api_helper/my_account_api_helper.rb +45 -0
- data/lib/redmine_api_helper/news_api_helper.rb +73 -0
- data/lib/redmine_api_helper/project_memberships_api_helper.rb +77 -0
- data/lib/redmine_api_helper/projects_api_helper.rb +73 -0
- data/lib/redmine_api_helper/roles_api_helper.rb +52 -0
- data/lib/redmine_api_helper/search_api_helper.rb +38 -0
- data/lib/redmine_api_helper/time_entries_api_helper.rb +73 -0
- data/lib/redmine_api_helper/time_entry_activities_api_helper.rb +38 -0
- data/lib/redmine_api_helper/trackers_api_helper.rb +38 -0
- data/lib/redmine_api_helper/users_api_helper.rb +73 -0
- data/lib/redmine_api_helper/version.rb +24 -0
- data/lib/redmine_api_helper/wiki_pages_api_helper.rb +66 -0
- data/redmine_api_helper.gemspec +33 -0
- metadata +96 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
##
|
2
|
+
# aids creating fiddles for redmine_scripting_engine
|
3
|
+
#
|
4
|
+
# Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; either version 2
|
9
|
+
# of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19
|
+
#
|
20
|
+
module RedmineAPIHelper
|
21
|
+
module AttachmentsAPIHelper
|
22
|
+
|
23
|
+
########################################################################################
|
24
|
+
# creates an attachment_url from args
|
25
|
+
########################################################################################
|
26
|
+
def attachment_url(id, **params)
|
27
|
+
url_path(args.urls.Home, "attachments", id, params)
|
28
|
+
end #def
|
29
|
+
|
30
|
+
########################################################################################
|
31
|
+
# reads attachment having id, corresponds to controller#show
|
32
|
+
########################################################################################
|
33
|
+
def read_attachment(id, **params)
|
34
|
+
read_object(:attachment, id, params)
|
35
|
+
end #def
|
36
|
+
|
37
|
+
########################################################################################
|
38
|
+
# updates an existing attachment with params, corresponds to controller#update
|
39
|
+
########################################################################################
|
40
|
+
def update_attachment(id, **params)
|
41
|
+
update_object(:attachment, id, params)
|
42
|
+
end #def
|
43
|
+
|
44
|
+
########################################################################################
|
45
|
+
# deletes an existing attachment with params, corresponds to controller#destroy
|
46
|
+
########################################################################################
|
47
|
+
def destroy_attachment(id, **params)
|
48
|
+
destroy_object(:attachment, id, params)
|
49
|
+
end #def
|
50
|
+
|
51
|
+
end #module
|
52
|
+
end #module
|
@@ -0,0 +1,78 @@
|
|
1
|
+
##
|
2
|
+
# aids creating fiddles for redmine_scripting_engine
|
3
|
+
#
|
4
|
+
# Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; either version 2
|
9
|
+
# of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19
|
+
#
|
20
|
+
module RedmineAPIHelper
|
21
|
+
module DefineAPIHelpers
|
22
|
+
|
23
|
+
########################################################################################
|
24
|
+
# defines global standard helpers for object
|
25
|
+
########################################################################################
|
26
|
+
def define_api_helpers(object)
|
27
|
+
|
28
|
+
object = object.to_s.singularize.to_sym
|
29
|
+
objects = object.to_s.pluralize.to_sym
|
30
|
+
|
31
|
+
# objects_url ########################################################################
|
32
|
+
define_singleton_method("#{objects}_url".to_sym) do |**params|
|
33
|
+
url_path(args.urls.Home, objects, params)
|
34
|
+
end
|
35
|
+
|
36
|
+
# project_objects_url ################################################################
|
37
|
+
define_singleton_method("project_#{objects}_url".to_sym) do |project_id, **params|
|
38
|
+
url_path(project_url(project_id), objects, params)
|
39
|
+
end
|
40
|
+
|
41
|
+
# object_url #########################################################################
|
42
|
+
define_singleton_method("#{object}_url".to_sym) do |id, **params|
|
43
|
+
url_path(send("#{objects}_url".to_sym), id, params)
|
44
|
+
end
|
45
|
+
|
46
|
+
# project_object_url #################################################################
|
47
|
+
define_singleton_method("project_#{object}_url".to_sym) do |project_id, id, **params|
|
48
|
+
url_path(send("project_#{objects}_url".to_sym, project_id), id, params)
|
49
|
+
end
|
50
|
+
|
51
|
+
# list_objects #######################################################################
|
52
|
+
define_singleton_method("list_#{objects}".to_sym) do |**params|
|
53
|
+
list_objects(objects, params)
|
54
|
+
end
|
55
|
+
|
56
|
+
# list_project_objects ###############################################################
|
57
|
+
define_singleton_method("list_project_#{objects}".to_sym) do |project_id, **params|
|
58
|
+
list_project_objects(project_id, objects, params)
|
59
|
+
end
|
60
|
+
|
61
|
+
# create_object ######################################################################
|
62
|
+
define_singleton_method("create_#{object}".to_sym) do |**params|
|
63
|
+
create_object(object, params)
|
64
|
+
end
|
65
|
+
|
66
|
+
# read_object ########################################################################
|
67
|
+
# update_object ######################################################################
|
68
|
+
# destroy_object #####################################################################
|
69
|
+
%w(read update destroy).each do |action|
|
70
|
+
define_singleton_method("#{action}_#{object}".to_sym) do |id, **params|
|
71
|
+
send("#{action}_object".to_sym, id, params)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end #def
|
76
|
+
|
77
|
+
end #module
|
78
|
+
end #module
|
@@ -0,0 +1,38 @@
|
|
1
|
+
##
|
2
|
+
# aids creating fiddles for redmine_scripting_engine
|
3
|
+
#
|
4
|
+
# Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; either version 2
|
9
|
+
# of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19
|
+
#
|
20
|
+
module RedmineAPIHelper
|
21
|
+
module DocumentCategoriesAPIHelper
|
22
|
+
|
23
|
+
########################################################################################
|
24
|
+
# reads document_categories_url from args
|
25
|
+
########################################################################################
|
26
|
+
def document_categories_url(**params)
|
27
|
+
url_path(args.urls.Home, "enumerations", "document_categories", params)
|
28
|
+
end #def
|
29
|
+
|
30
|
+
########################################################################################
|
31
|
+
# lists document_categories, corresponds to controller#index
|
32
|
+
########################################################################################
|
33
|
+
def list_document_categories(**params)
|
34
|
+
list_objects(:document_categories, params)
|
35
|
+
end #def
|
36
|
+
|
37
|
+
end #module
|
38
|
+
end #module
|
@@ -0,0 +1,80 @@
|
|
1
|
+
##
|
2
|
+
# aids creating fiddles for redmine_scripting_engine
|
3
|
+
#
|
4
|
+
# Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; either version 2
|
9
|
+
# of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19
|
+
#
|
20
|
+
module RedmineAPIHelper
|
21
|
+
module GroupsAPIHelper
|
22
|
+
|
23
|
+
########################################################################################
|
24
|
+
# reads groups_url from args
|
25
|
+
########################################################################################
|
26
|
+
def groups_url(**params)
|
27
|
+
url_path(args.urls.Home, "groups", params)
|
28
|
+
end #def
|
29
|
+
|
30
|
+
########################################################################################
|
31
|
+
# creates group_url
|
32
|
+
########################################################################################
|
33
|
+
def group_url(id, **params)
|
34
|
+
url_path(groups_url, id, params)
|
35
|
+
end #def
|
36
|
+
|
37
|
+
########################################################################################
|
38
|
+
# lists groups, corresponds to controller#index
|
39
|
+
########################################################################################
|
40
|
+
def list_groups(**params)
|
41
|
+
list_objects(:groups, params)
|
42
|
+
end #def
|
43
|
+
|
44
|
+
########################################################################################
|
45
|
+
# reads group having id, corresponds to controller#show
|
46
|
+
########################################################################################
|
47
|
+
def read_group(id, **params)
|
48
|
+
read_object(:group, id, params)
|
49
|
+
end #def
|
50
|
+
|
51
|
+
########################################################################################
|
52
|
+
# creates a new group with params, corresponds to controller#create
|
53
|
+
########################################################################################
|
54
|
+
def create_group(**params)
|
55
|
+
create_object(:group, params)
|
56
|
+
end #def
|
57
|
+
|
58
|
+
########################################################################################
|
59
|
+
# updates an existing group with params, corresponds to controller#update
|
60
|
+
########################################################################################
|
61
|
+
def update_group(id, **params)
|
62
|
+
update_object(:group, id, params)
|
63
|
+
end #def
|
64
|
+
|
65
|
+
########################################################################################
|
66
|
+
# updates an existing group with params, corresponds to controller#update
|
67
|
+
########################################################################################
|
68
|
+
def group_add_user(id, user_id, **params)
|
69
|
+
jpost(params.merge(:user_id => user_id), :url => url_path(groups_url, id, "users"))
|
70
|
+
end #def
|
71
|
+
|
72
|
+
########################################################################################
|
73
|
+
# deletes an existing group with params, corresponds to controller#destroy
|
74
|
+
########################################################################################
|
75
|
+
def destroy_group(id, **params)
|
76
|
+
destroy_object(:group, id, params)
|
77
|
+
end #def
|
78
|
+
|
79
|
+
end #module
|
80
|
+
end #module
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# aids creating fiddles for redmine_scripting_engine
|
4
|
+
#
|
5
|
+
# Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or
|
8
|
+
# modify it under the terms of the GNU General Public License
|
9
|
+
# as published by the Free Software Foundation; either version 2
|
10
|
+
# of the License, or (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
20
|
+
#
|
21
|
+
|
22
|
+
module RedmineAPIHelper
|
23
|
+
module Helpers
|
24
|
+
include RedmineAPIHelper::APIHelper
|
25
|
+
include RedmineAPIHelper::ArgsHelper
|
26
|
+
include RedmineAPIHelper::DefineAPIHelpers
|
27
|
+
|
28
|
+
include RedmineAPIHelper::AttachmentsAPIHelper
|
29
|
+
include RedmineAPIHelper::DocumentCategoriesAPIHelper
|
30
|
+
include RedmineAPIHelper::GroupsAPIHelper
|
31
|
+
include RedmineAPIHelper::IssuePrioritiesAPIHelper
|
32
|
+
include RedmineAPIHelper::IssueRelationsAPIHelper
|
33
|
+
include RedmineAPIHelper::IssueStatusesAPIHelper
|
34
|
+
include RedmineAPIHelper::IssuesAPIHelper
|
35
|
+
include RedmineAPIHelper::MyAccountAPIHelper
|
36
|
+
include RedmineAPIHelper::NewsAPIHelper
|
37
|
+
include RedmineAPIHelper::ProjectMembershipsAPIHelper
|
38
|
+
include RedmineAPIHelper::ProjectsAPIHelper
|
39
|
+
include RedmineAPIHelper::RolesAPIHelper
|
40
|
+
include RedmineAPIHelper::SearchAPIHelper
|
41
|
+
include RedmineAPIHelper::TimeEntriesAPIHelper
|
42
|
+
include RedmineAPIHelper::TimeEntryActivitiesAPIHelper
|
43
|
+
include RedmineAPIHelper::TrackersAPIHelper
|
44
|
+
include RedmineAPIHelper::UsersAPIHelper
|
45
|
+
include RedmineAPIHelper::WikiPagesAPIHelper
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
##
|
2
|
+
# aids creating fiddles for redmine_scripting_engine
|
3
|
+
#
|
4
|
+
# Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; either version 2
|
9
|
+
# of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19
|
+
#
|
20
|
+
module RedmineAPIHelper
|
21
|
+
module IssuePrioritiesAPIHelper
|
22
|
+
|
23
|
+
########################################################################################
|
24
|
+
# reads issue_priorities_url from args
|
25
|
+
########################################################################################
|
26
|
+
def issue_priorities_url(**params)
|
27
|
+
url_path(args.urls.Home, "enumerations", "issue_priorities", params)
|
28
|
+
end #def
|
29
|
+
|
30
|
+
########################################################################################
|
31
|
+
# lists issue_priorities, corresponds to controller#index
|
32
|
+
########################################################################################
|
33
|
+
def list_issue_priorities(**params)
|
34
|
+
list_objects(:issue_priorities, params)
|
35
|
+
end #def
|
36
|
+
|
37
|
+
end #module
|
38
|
+
end #module
|
@@ -0,0 +1,66 @@
|
|
1
|
+
##
|
2
|
+
# aids creating fiddles for redmine_scripting_engine
|
3
|
+
#
|
4
|
+
# Copyright © 2021 Stephan Wenzel <stephan.wenzel@drwpatent.de>
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; either version 2
|
9
|
+
# of the License, or (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19
|
+
#
|
20
|
+
module RedmineAPIHelper
|
21
|
+
module IssueRelationsAPIHelper
|
22
|
+
|
23
|
+
########################################################################################
|
24
|
+
# reads issue_relations_url from args
|
25
|
+
########################################################################################
|
26
|
+
def issue_relations_url(issue_id, **params)
|
27
|
+
url_path(issue_url(issue_id), "relations", params)
|
28
|
+
end #def
|
29
|
+
|
30
|
+
########################################################################################
|
31
|
+
# reads relations_url from args
|
32
|
+
########################################################################################
|
33
|
+
def relation_url(id, **params)
|
34
|
+
url_path(args.urls.Home, "relations", id, params)
|
35
|
+
end #def
|
36
|
+
|
37
|
+
########################################################################################
|
38
|
+
# lists issue_relations, corresponds to controller#index
|
39
|
+
########################################################################################
|
40
|
+
def list_issue_relations(issue_id, **params)
|
41
|
+
jget(:url => issue_relations_url(issue_id), :params => params).relations
|
42
|
+
end #def
|
43
|
+
|
44
|
+
########################################################################################
|
45
|
+
# reads issue having id, corresponds to controller#show
|
46
|
+
########################################################################################
|
47
|
+
def read_relation(id, **params)
|
48
|
+
jget(:url => relation_url(id), :params => params).relation
|
49
|
+
end #def
|
50
|
+
|
51
|
+
########################################################################################
|
52
|
+
# creates a new issue with params, corresponds to controller#create
|
53
|
+
########################################################################################
|
54
|
+
def create_issue_relation(issue_id, **params)
|
55
|
+
jpost(params, :url => issue_relations_url(issue_id)).relation
|
56
|
+
end #def
|
57
|
+
|
58
|
+
########################################################################################
|
59
|
+
# deletes an existing issue with params, corresponds to controller#destroy
|
60
|
+
########################################################################################
|
61
|
+
def destroy_relation(id, **params)
|
62
|
+
jdel(:url => relation_url(id), :params => params)
|
63
|
+
end #def
|
64
|
+
|
65
|
+
end #module
|
66
|
+
end #module
|
@@ -0,0 +1,36 @@
|
|
1
|
+
##
|
2
|
+
# aids creating fiddles for redmine_scripting_engine
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU General Public License
|
6
|
+
# as published by the Free Software Foundation; either version 2
|
7
|
+
# of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
17
|
+
#
|
18
|
+
module RedmineAPIHelper
|
19
|
+
module IssueStatusesAPIHelper
|
20
|
+
|
21
|
+
########################################################################################
|
22
|
+
# reads issue_statuses_url from args
|
23
|
+
########################################################################################
|
24
|
+
def issue_statuses_url(**params)
|
25
|
+
url_path(args.urls.Home, "issue_statuses", params)
|
26
|
+
end #def
|
27
|
+
|
28
|
+
########################################################################################
|
29
|
+
# lists issue_statuses, corresponds to controller#index
|
30
|
+
########################################################################################
|
31
|
+
def list_issue_statuses(**params)
|
32
|
+
list_objects(:issue_statuses, params)
|
33
|
+
end #def
|
34
|
+
|
35
|
+
end #module
|
36
|
+
end #module
|