strawberry_api 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +4 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +135 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/HTTParty/Response.html +148 -0
- data/doc/StrawberryAPI/AccessRight.html +431 -0
- data/doc/StrawberryAPI/ApiKey.html +637 -0
- data/doc/StrawberryAPI/ArchiveStrategy.html +365 -0
- data/doc/StrawberryAPI/ArchiveStrategyState.html +1057 -0
- data/doc/StrawberryAPI/Asset.html +1791 -0
- data/doc/StrawberryAPI/AssetCopyToStrategy.html +145 -0
- data/doc/StrawberryAPI/AssetFeedback.html +370 -0
- data/doc/StrawberryAPI/Client/ApiKeys.html +904 -0
- data/doc/StrawberryAPI/Client/ArchiveStrategies.html +784 -0
- data/doc/StrawberryAPI/Client/AssetCopyToStrategies.html +805 -0
- data/doc/StrawberryAPI/Client/AssetFeedbacks.html +232 -0
- data/doc/StrawberryAPI/Client/Assets.html +888 -0
- data/doc/StrawberryAPI/Client/Collections.html +319 -0
- data/doc/StrawberryAPI/Client/CopyToFeedbacks.html +232 -0
- data/doc/StrawberryAPI/Client/CustomMetadata.html +210 -0
- data/doc/StrawberryAPI/Client/CustomMetadataFields.html +214 -0
- data/doc/StrawberryAPI/Client/CustomMetadataOptions.html +214 -0
- data/doc/StrawberryAPI/Client/CustomMetadataSets.html +214 -0
- data/doc/StrawberryAPI/Client/Edits.html +485 -0
- data/doc/StrawberryAPI/Client/Features.html +319 -0
- data/doc/StrawberryAPI/Client/Libraries.html +321 -0
- data/doc/StrawberryAPI/Client/Markers.html +234 -0
- data/doc/StrawberryAPI/Client/ProjectCopyToStrategies.html +857 -0
- data/doc/StrawberryAPI/Client/ProjectFeedbacks.html +232 -0
- data/doc/StrawberryAPI/Client/Projects.html +2764 -0
- data/doc/StrawberryAPI/Client/Roles.html +214 -0
- data/doc/StrawberryAPI/Client/Schedules.html +319 -0
- data/doc/StrawberryAPI/Client/Searches.html +293 -0
- data/doc/StrawberryAPI/Client/Sessions.html +376 -0
- data/doc/StrawberryAPI/Client/Settings.html +210 -0
- data/doc/StrawberryAPI/Client/StatusFlags.html +315 -0
- data/doc/StrawberryAPI/Client/Teams.html +1067 -0
- data/doc/StrawberryAPI/Client/Templates.html +319 -0
- data/doc/StrawberryAPI/Client/Users.html +1255 -0
- data/doc/StrawberryAPI/Client.html +487 -0
- data/doc/StrawberryAPI/Collection.html +427 -0
- data/doc/StrawberryAPI/Configuration.html +481 -0
- data/doc/StrawberryAPI/CopyToFeedback.html +220 -0
- data/doc/StrawberryAPI/CustomMetadataField.html +999 -0
- data/doc/StrawberryAPI/CustomMetadataOption.html +567 -0
- data/doc/StrawberryAPI/CustomMetadataSet.html +649 -0
- data/doc/StrawberryAPI/CustomMetadatum.html +718 -0
- data/doc/StrawberryAPI/Edit.html +637 -0
- data/doc/StrawberryAPI/Feature.html +567 -0
- data/doc/StrawberryAPI/Feedback.html +641 -0
- data/doc/StrawberryAPI/HttpClient.html +971 -0
- data/doc/StrawberryAPI/Library.html +637 -0
- data/doc/StrawberryAPI/Marker.html +847 -0
- data/doc/StrawberryAPI/Project.html +2395 -0
- data/doc/StrawberryAPI/ProjectCopyToStrategy.html +365 -0
- data/doc/StrawberryAPI/ProjectFeedback.html +370 -0
- data/doc/StrawberryAPI/Proxy.html +1267 -0
- data/doc/StrawberryAPI/Role.html +567 -0
- data/doc/StrawberryAPI/Schedule.html +2387 -0
- data/doc/StrawberryAPI/Session.html +121 -0
- data/doc/StrawberryAPI/Setting.html +207 -0
- data/doc/StrawberryAPI/StatusFlag.html +207 -0
- data/doc/StrawberryAPI/Strategy.html +641 -0
- data/doc/StrawberryAPI/Team.html +789 -0
- data/doc/StrawberryAPI/Template.html +707 -0
- data/doc/StrawberryAPI/User.html +999 -0
- data/doc/StrawberryAPI.html +483 -0
- data/doc/_index.html +632 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +222 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +222 -0
- data/doc/js/app.js +292 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +3059 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/strawberry_api/access_right.rb +18 -0
- data/lib/strawberry_api/api_key.rb +19 -0
- data/lib/strawberry_api/asset.rb +51 -0
- data/lib/strawberry_api/client/api_keys.rb +49 -0
- data/lib/strawberry_api/client/archive_strategies.rb +87 -0
- data/lib/strawberry_api/client/asset_copy_to_strategies.rb +83 -0
- data/lib/strawberry_api/client/asset_feedbacks.rb +18 -0
- data/lib/strawberry_api/client/assets.rb +92 -0
- data/lib/strawberry_api/client/collections.rb +29 -0
- data/lib/strawberry_api/client/copy_to_feedbacks.rb +18 -0
- data/lib/strawberry_api/client/custom_metadata.rb +16 -0
- data/lib/strawberry_api/client/custom_metadata_fields.rb +18 -0
- data/lib/strawberry_api/client/custom_metadata_options.rb +18 -0
- data/lib/strawberry_api/client/custom_metadata_sets.rb +18 -0
- data/lib/strawberry_api/client/edits.rb +47 -0
- data/lib/strawberry_api/client/features.rb +29 -0
- data/lib/strawberry_api/client/libraries.rb +30 -0
- data/lib/strawberry_api/client/markers.rb +19 -0
- data/lib/strawberry_api/client/project_copy_to_strategies.rb +88 -0
- data/lib/strawberry_api/client/project_feedbacks.rb +18 -0
- data/lib/strawberry_api/client/projects.rb +305 -0
- data/lib/strawberry_api/client/roles.rb +18 -0
- data/lib/strawberry_api/client/schedules.rb +29 -0
- data/lib/strawberry_api/client/searches.rb +25 -0
- data/lib/strawberry_api/client/sessions.rb +33 -0
- data/lib/strawberry_api/client/settings.rb +16 -0
- data/lib/strawberry_api/client/status_flags.rb +27 -0
- data/lib/strawberry_api/client/teams.rb +107 -0
- data/lib/strawberry_api/client/templates.rb +29 -0
- data/lib/strawberry_api/client/users.rb +125 -0
- data/lib/strawberry_api/client.rb +95 -0
- data/lib/strawberry_api/collection.rb +16 -0
- data/lib/strawberry_api/configuration.rb +19 -0
- data/lib/strawberry_api/custom_metadata/custom_metadata_field.rb +30 -0
- data/lib/strawberry_api/custom_metadata/custom_metadata_option.rb +18 -0
- data/lib/strawberry_api/custom_metadata/custom_metadata_set.rb +25 -0
- data/lib/strawberry_api/custom_metadatum.rb +30 -0
- data/lib/strawberry_api/edit.rb +19 -0
- data/lib/strawberry_api/feature.rb +18 -0
- data/lib/strawberry_api/feedback/asset_feedback.rb +15 -0
- data/lib/strawberry_api/feedback/copy_to_feedback.rb +12 -0
- data/lib/strawberry_api/feedback/project_feedback.rb +15 -0
- data/lib/strawberry_api/feedback.rb +19 -0
- data/lib/strawberry_api/http_client.rb +135 -0
- data/lib/strawberry_api/library.rb +19 -0
- data/lib/strawberry_api/marker.rb +22 -0
- data/lib/strawberry_api/project.rb +48 -0
- data/lib/strawberry_api/proxy.rb +28 -0
- data/lib/strawberry_api/role.rb +18 -0
- data/lib/strawberry_api/schedule.rb +44 -0
- data/lib/strawberry_api/session.rb +7 -0
- data/lib/strawberry_api/setting.rb +12 -0
- data/lib/strawberry_api/status_flag.rb +12 -0
- data/lib/strawberry_api/strategy/archive_strategy.rb +10 -0
- data/lib/strawberry_api/strategy/archive_strategy_state.rb +25 -0
- data/lib/strawberry_api/strategy/asset_copy_to_strategy.rb +6 -0
- data/lib/strawberry_api/strategy/project_copy_to_strategy.rb +9 -0
- data/lib/strawberry_api/strategy.rb +19 -0
- data/lib/strawberry_api/team.rb +27 -0
- data/lib/strawberry_api/template.rb +20 -0
- data/lib/strawberry_api/user.rb +30 -0
- data/lib/strawberry_api/version.rb +3 -0
- data/lib/strawberry_api.rb +36 -0
- data/samples/README.md +14 -0
- data/samples/list_assets_links.rb +15 -0
- data/samples/list_projects.rb +14 -0
- data/samples/login.rb +18 -0
- data/samples/test.rb +12 -0
- data/strawberry_api.gemspec +40 -0
- metadata +242 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Edits
|
4
|
+
|
5
|
+
# Fetches all edits
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::Edit>] A list of edits
|
9
|
+
#
|
10
|
+
def edits
|
11
|
+
get("/edits").parse['edits']&.map do |edit|
|
12
|
+
Edit.new(edit)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches an edit
|
17
|
+
#
|
18
|
+
# @param [Integer] id Id of the edit to retrieve
|
19
|
+
#
|
20
|
+
# @return [StrawberryAPI::Edit] The fetched edit
|
21
|
+
#
|
22
|
+
def edit(id:)
|
23
|
+
data = get("/edits/#{id}").parse['edit']
|
24
|
+
data.nil? ? nil : Edit.new(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Fetches an edit status
|
28
|
+
#
|
29
|
+
#
|
30
|
+
# @return [<type>] <description>
|
31
|
+
#
|
32
|
+
def edit_status
|
33
|
+
get("/edit/status").parse['hash']
|
34
|
+
end
|
35
|
+
|
36
|
+
# Clears an edit
|
37
|
+
#
|
38
|
+
#
|
39
|
+
# @return [Boolean] Success
|
40
|
+
#
|
41
|
+
def edit_clear
|
42
|
+
put("/edit/clear").success?
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Features
|
4
|
+
|
5
|
+
# Fetches all features
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::Feature>] A list of features
|
9
|
+
#
|
10
|
+
def features
|
11
|
+
get("/features").parse['features']&.map do |feature|
|
12
|
+
Feature.new(feature)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches a feature
|
17
|
+
#
|
18
|
+
# @param [Integer] id Id of the feature to retrieve
|
19
|
+
#
|
20
|
+
# @return [StrawberryAPI::Feature] The fetched feature
|
21
|
+
#
|
22
|
+
def feature(id:)
|
23
|
+
data = get("/features/#{id}").parse['feature']
|
24
|
+
data.nil? ? nil : Feature.new(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Libraries
|
4
|
+
|
5
|
+
# Fetches all libraries
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::Library>] A list of libraries
|
9
|
+
#
|
10
|
+
def libraries
|
11
|
+
get("/library_ingests").parse['array']&.map do |library|
|
12
|
+
Library.new(library)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches a library
|
17
|
+
#
|
18
|
+
# @param [Integer] id Id of the library to retrieve
|
19
|
+
#
|
20
|
+
# @return [StrawberryAPI::Library] The fetched library
|
21
|
+
#
|
22
|
+
def library(id: nil, project_id: nil)
|
23
|
+
libraries.find do |library|
|
24
|
+
library.id == id.to_i || library.project_id == project_id.to_i
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Markers
|
4
|
+
|
5
|
+
# Fetches an asset marker descriptions
|
6
|
+
#
|
7
|
+
# @param [Interger] asset_id Id of the asset to retrieve marker descriptions from
|
8
|
+
#
|
9
|
+
# @return [Array<StrawberryAPI::Marker>] The fetched asset marker descriptions
|
10
|
+
#
|
11
|
+
def marker(asset_id:)
|
12
|
+
get("/assets/#{asset_id}/marker_descriptions").parse['array']&.map do |marker|
|
13
|
+
Marker.new(marker)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module ProjectCopyToStrategies
|
4
|
+
|
5
|
+
# Fetches all project copy to strategies
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::ProjectCopyToStrategy>] A list of project copy to strategies
|
9
|
+
#
|
10
|
+
def project_copy_to_strategies
|
11
|
+
get("/project_copy_to_strategies").parse['array']&.map do |project_copy_to_strategy|
|
12
|
+
ProjectCopyToStrategy.new(project_copy_to_strategy)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches a project copy to strategy
|
17
|
+
#
|
18
|
+
# @param [Integer] id Id of the project copy to strategy to retrieve
|
19
|
+
#
|
20
|
+
# @return [StrawberryAPI::ProjectCopyToStrategy] The fetched project copy to strategy
|
21
|
+
#
|
22
|
+
def project_copy_to_strategy(id:)
|
23
|
+
data = get("/project_copy_to_strategies/#{id}").parse['projectcopytostrategy']
|
24
|
+
data.nil? ? nil : ProjectCopyToStrategy.new(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Creates a project copy to strategy
|
28
|
+
#
|
29
|
+
# @param [String] name
|
30
|
+
# @param [String] destination
|
31
|
+
# @param [String] format 'plain'
|
32
|
+
# @param [Boolean] admin_only true
|
33
|
+
# @param [String] includes 'none'
|
34
|
+
# @param [String] enabled true
|
35
|
+
# @param [String] strategy_type 'native'
|
36
|
+
# @param [String] contents 'both'
|
37
|
+
# @param [Boolean] delete_project false
|
38
|
+
#
|
39
|
+
# @return [StrawberryAPI::ProjectCopyToStrategy] The created project copy to strategy
|
40
|
+
#
|
41
|
+
def create_project_copy_to_strategy(name:, destination:, format: 'plain', admin_only: true, includes: 'none', enabled: true, strategy_type: 'native', contents: 'both', delete_project: false)
|
42
|
+
body = {
|
43
|
+
name: name,
|
44
|
+
destination: destination,
|
45
|
+
format: format,
|
46
|
+
admin_only: admin_only,
|
47
|
+
enabled: enabled,
|
48
|
+
contents: contents,
|
49
|
+
includes: includes,
|
50
|
+
delete_project: delete_project
|
51
|
+
}.to_json
|
52
|
+
|
53
|
+
data = post("/project_copy_to_strategies", body: body).parse['projectcopytostrategy']
|
54
|
+
data.nil? ? nil : ProjectCopyToStrategy.new(data)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Updates a project copy to trategy
|
58
|
+
#
|
59
|
+
# @param [Integer] id Id of the user to update
|
60
|
+
# @option options [String] :username
|
61
|
+
# @option options [String] :firstname
|
62
|
+
# @option options [String] :lastname
|
63
|
+
# @option options [String] :password
|
64
|
+
# @option options [String] :role_id
|
65
|
+
# @option options [String] :user_matrix_attributes
|
66
|
+
#
|
67
|
+
# @return [StrawberryAPI::ProjectCopyToStrategy] The updated project copy to strategy
|
68
|
+
#
|
69
|
+
def update_project_copy_to_strategy(id:, **options)
|
70
|
+
body = args.to_json
|
71
|
+
|
72
|
+
data = put("/project_copy_to_strategies/#{id}", body: body).parse['projectcopytostrategy']
|
73
|
+
data.nil? ? nil : ProjectCopyToStrategy.new(data)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Deletes a project copy to strategy
|
77
|
+
#
|
78
|
+
# @param [Integer] id Id of the project copy to strategy to delete
|
79
|
+
#
|
80
|
+
# @return [Boolean>] Success
|
81
|
+
#
|
82
|
+
def destroy_project_copy_to_strategy(id:)
|
83
|
+
delete("/project_copy_to_strategies/#{id}").success?
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module ProjectFeedbacks
|
4
|
+
|
5
|
+
# Fetches a project feedback
|
6
|
+
#
|
7
|
+
# @param [Integer] id Id of the project feedback to retrieve
|
8
|
+
#
|
9
|
+
# @return [StrawberryAPI::ProjectFeedback] The fetched project feedback
|
10
|
+
#
|
11
|
+
def project_feedback(id:)
|
12
|
+
data = get("/status/#{id}").parse['job']
|
13
|
+
data.nil? ? nil : ProjectFeedback.new(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,305 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Projects
|
4
|
+
|
5
|
+
# Fetches all projects
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::Project>] A list of projects
|
9
|
+
#
|
10
|
+
def projects
|
11
|
+
get("/projects").parse['projects']&.map do |project|
|
12
|
+
Project.new(project)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches all library projects
|
17
|
+
#
|
18
|
+
#
|
19
|
+
# @return [Array<StrawberryAPI::Project>] A list of library projects
|
20
|
+
#
|
21
|
+
def library_projects
|
22
|
+
projects.select do |project|
|
23
|
+
!project.deleted && project.is_library_project
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Fetches all online projects
|
28
|
+
#
|
29
|
+
#
|
30
|
+
# @return [Array<StrawberryAPI::Project>] A list of online projects
|
31
|
+
#
|
32
|
+
def online_projects
|
33
|
+
projects.select do |project|
|
34
|
+
project.archive_strategy_id.nil? && !project.deleted && !project.is_library_project
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Fetches all archived projects
|
39
|
+
#
|
40
|
+
#
|
41
|
+
# @return [Array<StrawberryAPI::Project>] A list of archived projects
|
42
|
+
#
|
43
|
+
def archived_projects
|
44
|
+
projects.select do |project|
|
45
|
+
project.archive_strategy_id && !project.deleted && !project.is_library_project
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Fetches a project
|
50
|
+
#
|
51
|
+
# @param [Integer] id Id of the project to retrieve
|
52
|
+
#
|
53
|
+
# @return [StrawberryAPI::Project] The fetched project
|
54
|
+
#
|
55
|
+
def project(id:)
|
56
|
+
data = get("/projects/#{id}").parse['project']
|
57
|
+
data.nil? ? nil : Project.new(data)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Creates a project
|
61
|
+
#
|
62
|
+
# @param [String] name Name of the project to create
|
63
|
+
# @param [String] templatename Name of the template to use
|
64
|
+
#
|
65
|
+
# @return [StrawberryAPI::Project] The created project
|
66
|
+
#
|
67
|
+
def create_project(name:, templatename:)
|
68
|
+
body = {
|
69
|
+
name: name,
|
70
|
+
templatename: templatename
|
71
|
+
}.to_json
|
72
|
+
|
73
|
+
data = post("/projects", body: body).parse['project']
|
74
|
+
data.nil? ? nil : Project.new(data)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Deletes a project
|
78
|
+
#
|
79
|
+
# @param [Integer] id Id of the project to delete
|
80
|
+
#
|
81
|
+
# @return [Boolean] Success
|
82
|
+
#
|
83
|
+
def destroy_project(id:)
|
84
|
+
delete("/projects/#{id}").success?
|
85
|
+
end
|
86
|
+
|
87
|
+
# Opens a project
|
88
|
+
#
|
89
|
+
# @param [Integer] id Id of the project to open
|
90
|
+
#
|
91
|
+
# @return [Boolean] Success
|
92
|
+
#
|
93
|
+
def open_project(id:)
|
94
|
+
put("/projects/#{id}/open").success?
|
95
|
+
end
|
96
|
+
|
97
|
+
# Syncs a project
|
98
|
+
#
|
99
|
+
# @param [Integer] id Id of the project to sync
|
100
|
+
#
|
101
|
+
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
102
|
+
#
|
103
|
+
def sync_project(id:)
|
104
|
+
data = put("/projects/#{id}/sync").parse['job']
|
105
|
+
data.nil? ? nil : ProjectFeedback.new(data)
|
106
|
+
end
|
107
|
+
|
108
|
+
# Closes a project
|
109
|
+
#
|
110
|
+
# @param [Integer] id Id of the project to close
|
111
|
+
#
|
112
|
+
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
113
|
+
#
|
114
|
+
def close_project(id:, edit:)
|
115
|
+
delete("/projects/#{id}/close", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
116
|
+
data.nil? ? nil : ProjectFeedback.new(data)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Forcecloses a project
|
120
|
+
#
|
121
|
+
# @param [Integer] id Id of the project to forceclose
|
122
|
+
#
|
123
|
+
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
124
|
+
#
|
125
|
+
def forceclose_project(id:, edit:)
|
126
|
+
data = delete("/projects/#{id}/forceclose", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
127
|
+
data.nil? ? nil : ProjectFeedback.new(data)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Mounts a project
|
131
|
+
#
|
132
|
+
# @param [Integer] id Id of the project to mount
|
133
|
+
#
|
134
|
+
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
135
|
+
#
|
136
|
+
def mount_project(id:, edit:)
|
137
|
+
data = put("/projects/#{id}/mount", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
138
|
+
data.nil? ? nil : ProjectFeedback.new(data)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Unmounts a project
|
142
|
+
#
|
143
|
+
# @param [Integer] id Id of the project to unmount
|
144
|
+
#
|
145
|
+
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
146
|
+
#
|
147
|
+
def umount_project(id:, edit:)
|
148
|
+
data = delete("/projects/#{id}/umount", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
149
|
+
data.nil? ? nil : ProjectFeedback.new(data)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Refreshes a mounted project
|
153
|
+
#
|
154
|
+
# @param [Integer] id Id of the mounted project to refresh
|
155
|
+
#
|
156
|
+
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
157
|
+
#
|
158
|
+
def refresh_mounted_project(id:)
|
159
|
+
put("/projects/#{id}/refreshmountedproject", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
160
|
+
data.nil? ? nil : ProjectFeedback.new(data)
|
161
|
+
end
|
162
|
+
|
163
|
+
# Archives a project
|
164
|
+
#
|
165
|
+
# @param [Integer] id Id of the project to archive
|
166
|
+
#
|
167
|
+
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
168
|
+
#
|
169
|
+
def archive_project(id:, archive_strategy_id:, exclude_linked_files: false)
|
170
|
+
body = {
|
171
|
+
strategy: archive_strategy_id,
|
172
|
+
exclude_linked_files: exclude_linked_files
|
173
|
+
}.to_json
|
174
|
+
|
175
|
+
put("/projects/#{id}/archive", body: body).parse['archivestrategystate']&.map do |state|
|
176
|
+
ArchiveStrategyState.new(state)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Unarchives a project
|
181
|
+
#
|
182
|
+
# @param [Integer] id Id of the project to unarchive
|
183
|
+
#
|
184
|
+
# @return [StrawberryAPI::ArchiveStrategyState] The operation status
|
185
|
+
#
|
186
|
+
def unarchive_project(id:)
|
187
|
+
put("/projects/#{id}/unarchive").parse['archivestrategystate']&.map do |state|
|
188
|
+
ArchiveStrategyState.new(state)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# Searches for a substring in project names
|
193
|
+
#
|
194
|
+
# @param [String] name Substring to look for
|
195
|
+
#
|
196
|
+
# @return [Array<StrawberryAPI::Project>] A list of project matching the substring
|
197
|
+
#
|
198
|
+
def search_project(name:)
|
199
|
+
get("/projects/search", body: {name: name}).parse['projects']&.map do |project|
|
200
|
+
Project.new(project)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Fetches all teams assigned to a project
|
205
|
+
#
|
206
|
+
# @param [Interger] id If of the project to retrieve teams from
|
207
|
+
#
|
208
|
+
# @return [Array<StrawberryAPI::Team>] The fetched project teams
|
209
|
+
#
|
210
|
+
def project_teams(id:)
|
211
|
+
teams = get("/projects/#{id}/teams").parse['array']
|
212
|
+
teams.map do |team|
|
213
|
+
Team.new(team.first)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# Fetches all access rights of a project
|
218
|
+
#
|
219
|
+
# @param [Integer] id Id of the project to retrieve access rights from
|
220
|
+
#
|
221
|
+
# @return [Array<StrawberryAPI::AccessRight>] The fetched project access rights
|
222
|
+
#
|
223
|
+
def project_effective_access_rights(id:)
|
224
|
+
access_rights = get("/projects/#{id}/effective_access_rights").parse['hash']
|
225
|
+
access_rights.map do |accessright|
|
226
|
+
AccessRight.new(accessright)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
# Assigns a team to a project
|
231
|
+
#
|
232
|
+
# @param [Integer] id Id of the project to which the team should be added
|
233
|
+
# @param [Integer] team_id Id of the team to add to the project
|
234
|
+
# @param [Boolean] write false Write access to the project
|
235
|
+
#
|
236
|
+
# @return [Boolean] Success
|
237
|
+
#
|
238
|
+
def add_team_to_project(id:, team_id:, write: false)
|
239
|
+
body = {
|
240
|
+
team_id: team_id,
|
241
|
+
write: write
|
242
|
+
}.to_json
|
243
|
+
|
244
|
+
put("/projects/#{id}/teams", body: body).success?
|
245
|
+
end
|
246
|
+
|
247
|
+
# Removes a team from a project
|
248
|
+
#
|
249
|
+
# @param [Integer] id Id of the project from which the team should be deleted
|
250
|
+
# @param [Integer] team_id Id of the team to remove from the project
|
251
|
+
#
|
252
|
+
# @return [Boolean] Success
|
253
|
+
#
|
254
|
+
def remove_team_from_project(id:, team_id:)
|
255
|
+
delete("/projects/#{id}/teams/#{team_id}").success?
|
256
|
+
end
|
257
|
+
|
258
|
+
# Fetches a project status flags
|
259
|
+
#
|
260
|
+
# @param [Integer] id Id of the project to retrieve status flags from
|
261
|
+
#
|
262
|
+
# @return [Hash] The fetched project status flags
|
263
|
+
#
|
264
|
+
def project_status_flags(id:)
|
265
|
+
status_flags = get("/projects/#{id}/status_flags").parse['array']
|
266
|
+
end
|
267
|
+
|
268
|
+
# Fetches a project custom metadata
|
269
|
+
#
|
270
|
+
# @param [Integer] id Id of the project to retrieve custom metadata from
|
271
|
+
#
|
272
|
+
# @return [Array<StrawberryAPI::CustomMetadata>] The fetched project custom metadata
|
273
|
+
#
|
274
|
+
def project_custom_metadata(id:)
|
275
|
+
custom_metadata = get("/projects/#{id}/custom_metadata").parse['array']
|
276
|
+
custom_metadata.map do |custom_metadata|
|
277
|
+
CustomMetadata.new(custom_metadata)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
# Fetches a project assets
|
282
|
+
#
|
283
|
+
# @param [Integer] id Id of the project to retrieve which to retrieve assets from
|
284
|
+
#
|
285
|
+
# @return [Array<StrawberryAPI::Asset>] The fetched project assets
|
286
|
+
#
|
287
|
+
def project_assets(id:)
|
288
|
+
assets = get("/projects/#{id}/assets").parse['assets']
|
289
|
+
assets.map do |asset|
|
290
|
+
Asset.new(asset)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
# Fetches projects report
|
295
|
+
#
|
296
|
+
#
|
297
|
+
# @return [Hash] The fetched projects report
|
298
|
+
#
|
299
|
+
def projects_report
|
300
|
+
get("/projects_report").parse
|
301
|
+
end
|
302
|
+
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Roles
|
4
|
+
|
5
|
+
# Fetches all roles
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::Role>] A list of roles
|
9
|
+
#
|
10
|
+
def roles
|
11
|
+
get("/roles").parse['array']&.map do |role|
|
12
|
+
Role.new(role)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Schedules
|
4
|
+
|
5
|
+
# Fetches all schedules
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::Schedule>] A list of schedules
|
9
|
+
#
|
10
|
+
def schedules
|
11
|
+
get("/schedules").parse['schedules']&.map do |schedule|
|
12
|
+
Schedule.new(schedule)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches a schedule
|
17
|
+
#
|
18
|
+
# @param [Integer] id Id of the schedule to retrieve
|
19
|
+
#
|
20
|
+
# @return [StrawberryAPI::Schedule] The fetched schedule
|
21
|
+
#
|
22
|
+
def schedule(id:)
|
23
|
+
data = get("/schedules/#{id}").parse['schedule']
|
24
|
+
data.nil? ? nil : Schedule.new(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Searches
|
4
|
+
|
5
|
+
# Searches for a term through projects and/or assets
|
6
|
+
#
|
7
|
+
# @param [String] term
|
8
|
+
# @option [String] order_by 'updated_at'
|
9
|
+
# @option [String] order 'desc'
|
10
|
+
# @option [Integer] per_page 10
|
11
|
+
# @option [Integer] page 1
|
12
|
+
# @option [Boolean] projects true
|
13
|
+
# @option [Boolean] assets true
|
14
|
+
#
|
15
|
+
# @return [Hash] A list of projets and/or assets matching the search term
|
16
|
+
#
|
17
|
+
def search(term:, order_by: 'updated_at', order: 'desc', per_page: 10, page: 1, projects: true, assets: true)
|
18
|
+
body = {term: term, order_by: order_by, order: order, per_page: per_page, page: page, projects: projets, assets: assets}
|
19
|
+
|
20
|
+
get("/search", body: body)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Sessions
|
4
|
+
|
5
|
+
# Determines whether the session is valid
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Boolean] Success
|
9
|
+
#
|
10
|
+
def logged_in?
|
11
|
+
get("/session").success?
|
12
|
+
end
|
13
|
+
|
14
|
+
# Closes the current session
|
15
|
+
#
|
16
|
+
#
|
17
|
+
# @return [Boolean] Success
|
18
|
+
#
|
19
|
+
def logout
|
20
|
+
delete('/session').success?
|
21
|
+
end
|
22
|
+
|
23
|
+
# Fetches the current user information
|
24
|
+
#
|
25
|
+
#
|
26
|
+
# @return [StrawberryAPI::User] The fetched user
|
27
|
+
#
|
28
|
+
def session_info
|
29
|
+
data = get('/session')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module StatusFlags
|
4
|
+
|
5
|
+
# Fetches all status flags
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::StatusFlag>] A list of status flags
|
9
|
+
#
|
10
|
+
def status_flags
|
11
|
+
get("/status_flags").parse['array']
|
12
|
+
end
|
13
|
+
|
14
|
+
# Fetches a status flag
|
15
|
+
#
|
16
|
+
# @param [Integer] id Id of the status flag to retrieve
|
17
|
+
#
|
18
|
+
# @return [StrawberryAPI::StatusFlag] The fetched status flag
|
19
|
+
#
|
20
|
+
def status_flag(id:)
|
21
|
+
data = get("/status_flags/#{id}").parse['status_flag']
|
22
|
+
data.nil? ? nil : StatusFlag.new(data)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|