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,107 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Teams
|
4
|
+
|
5
|
+
# Fetches all teams
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::Team>] A list of teams
|
9
|
+
#
|
10
|
+
def teams
|
11
|
+
get("/teams").parse['teams']&.map do |team|
|
12
|
+
Team.new(team)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches a team
|
17
|
+
#
|
18
|
+
# @param [Integer] id Id of the team to retrieve
|
19
|
+
#
|
20
|
+
# @return [StrawberryAPI::Team] The fetched team
|
21
|
+
#
|
22
|
+
def team(id:)
|
23
|
+
data = get("/teams/#{id}").parse['team']
|
24
|
+
data.nil? ? nil : Team.new(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Featches the current user team
|
28
|
+
#
|
29
|
+
#
|
30
|
+
# @return [Array<StrawberryAPI::Team>] The fetched current user teams
|
31
|
+
#
|
32
|
+
def user_owned_teams
|
33
|
+
get("/teams/user_owned").parse['teams']&.map do |team|
|
34
|
+
Team.new(team)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Creates a new team
|
39
|
+
#
|
40
|
+
# @param [String] name Name of the team to create
|
41
|
+
# @option [Integer] quota: nil Quota to assign to the team
|
42
|
+
# @option [Boolean] quota_mail_sent: false Enable quota email notification
|
43
|
+
#
|
44
|
+
# @return [StrawberryAPI::Team] The created team
|
45
|
+
#
|
46
|
+
def create_team(name:, quota: nil, quota_mail_sent: false)
|
47
|
+
body = {
|
48
|
+
name: name,
|
49
|
+
quota: quota,
|
50
|
+
quota_mail_sent: quota_mail_sent
|
51
|
+
}.to_json
|
52
|
+
|
53
|
+
data = post("/teams", body: body).parse['teams']
|
54
|
+
data.nil? ? nil : Team.new(data)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Updates a team
|
58
|
+
#
|
59
|
+
# @param [Integer] id Id of the user to update
|
60
|
+
# @option options [String] :name
|
61
|
+
# @option options [String] :quota
|
62
|
+
# @option options [String] :quota_mail_sent
|
63
|
+
#
|
64
|
+
# @return [StrawberryAPI::Team] The updated team
|
65
|
+
#
|
66
|
+
def update_team(id:, **options)
|
67
|
+
body = args.to_json
|
68
|
+
|
69
|
+
data = put("/teams/#{id}", body: body).parse['team']
|
70
|
+
data.nil? ? nil : Team.new(data)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Deletes a team
|
74
|
+
#
|
75
|
+
# @param [Integer] id Id of the team to delete
|
76
|
+
#
|
77
|
+
# @return [Boolean] Success
|
78
|
+
#
|
79
|
+
def destroy_team(id:)
|
80
|
+
delete("/teams/#{id}").success?
|
81
|
+
end
|
82
|
+
|
83
|
+
# Adds a user to a team
|
84
|
+
#
|
85
|
+
# @param [Integer] team_id Id of the team the user should be added to
|
86
|
+
# @param [Integer] user_id Id of the user to add the team to
|
87
|
+
#
|
88
|
+
# @return [Boolean] Success
|
89
|
+
#
|
90
|
+
def add_user_to_team(team_id:, user_id:)
|
91
|
+
post("/users/#{team_id}/teams/#{user_id}").success?
|
92
|
+
end
|
93
|
+
|
94
|
+
# Removes a user from a team
|
95
|
+
#
|
96
|
+
# @param [Integer] team_id Id of the team the user should be removed from
|
97
|
+
# @param [Integer] user_id Id of the user to remove from the team
|
98
|
+
#
|
99
|
+
# @return [Boolean] Success
|
100
|
+
#
|
101
|
+
def remove_user_from_team(team_id:, user_id:)
|
102
|
+
delete("/users/#{team_id}/teams/#{user_id}").success?
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Templates
|
4
|
+
|
5
|
+
# Fetches all templates
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::Template>] A list of the fetched templates
|
9
|
+
#
|
10
|
+
def templates
|
11
|
+
get("/templates").parse['templates']&.map do |template|
|
12
|
+
Template.new(template)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches a template
|
17
|
+
#
|
18
|
+
# @param [Integer] id If of the template to retrieve
|
19
|
+
#
|
20
|
+
# @return [StrawberryAPI::Template] The fetched template
|
21
|
+
#
|
22
|
+
def template(id:)
|
23
|
+
data = get("/templates/#{id}").parse['template']
|
24
|
+
data.nil? ? nil : Template.new(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Client < StrawberryAPI::HttpClient
|
3
|
+
module Users
|
4
|
+
|
5
|
+
# Fetches all users
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# @return [Array<StrawberryAPI::User>] A list of users
|
9
|
+
#
|
10
|
+
def users
|
11
|
+
get("/users").parse['users']&.map do |user|
|
12
|
+
User.new(user)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Fetches all users
|
17
|
+
#
|
18
|
+
#
|
19
|
+
# @return [Array<StrawberryAPI::User>] A list of users
|
20
|
+
#
|
21
|
+
def user(id:)
|
22
|
+
data = get("/users/#{id}?with_teams=true").parse['user']
|
23
|
+
data.nil? ? nil : User.new(data)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Creates a new user
|
27
|
+
#
|
28
|
+
# @param [String] username Username of the user to create
|
29
|
+
# @param [String] firstname nil Firstname of the user to create
|
30
|
+
# @param [String] lastname nil Lastname of the user to create
|
31
|
+
# @param [String] password Password of the user to create
|
32
|
+
# @param [Integer] role_id Id of the role to assign the the user to
|
33
|
+
# @option [String] user_matrix_attributes Matric attributes to assign to the user to create
|
34
|
+
#
|
35
|
+
# @return [StrawberryAPI::User] The created user
|
36
|
+
#
|
37
|
+
def create_user(username:, firstname: nil, lastname: nil, password:, role_id:, user_matrix_attributes: nil)
|
38
|
+
body = {
|
39
|
+
username: username,
|
40
|
+
firstname: firstname,
|
41
|
+
lastname: lastname,
|
42
|
+
password: password,
|
43
|
+
password_confirmation: password,
|
44
|
+
role_id: role_id,
|
45
|
+
user_matrix_attributes: user_matrix_attributes
|
46
|
+
}.to_json
|
47
|
+
|
48
|
+
data = post("/users", body: body).parse['user']
|
49
|
+
data.nil? ? nil : User.new(data)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Updates a user
|
53
|
+
#
|
54
|
+
# @param [Integer] id Id of the user to update
|
55
|
+
# @option options [String] :username
|
56
|
+
# @option options [String] :firstname
|
57
|
+
# @option options [String] :lastname
|
58
|
+
# @option options [String] :password
|
59
|
+
# @option options [String] :role_id
|
60
|
+
# @option options [String] :user_matrix_attributes
|
61
|
+
#
|
62
|
+
# @return [StrawberryAPI::User] The updated user
|
63
|
+
#
|
64
|
+
def update_user(id:, **options)
|
65
|
+
body = args.to_json
|
66
|
+
|
67
|
+
data = put("/users/#{id}", body: body).parse
|
68
|
+
data.nil? ? nil : User.new(data)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Deletes a user
|
72
|
+
#
|
73
|
+
# @param [Integer] id Id of the user to delete
|
74
|
+
#
|
75
|
+
# @return [Boolean] Success
|
76
|
+
#
|
77
|
+
def destroy_user(id:)
|
78
|
+
delete("/users/#{id}").success?
|
79
|
+
end
|
80
|
+
|
81
|
+
# Adds a team to a user
|
82
|
+
#
|
83
|
+
# @param [Integer] user_id Id of the user the team should be added to
|
84
|
+
# @param [Integer] team_id Id of the team to add the user to
|
85
|
+
#
|
86
|
+
# @return [Boolean] Success
|
87
|
+
#
|
88
|
+
def add_team_to_user(user_id:, team_id:)
|
89
|
+
post("/users/#{user_id}/teams/#{team_id}").success?
|
90
|
+
end
|
91
|
+
|
92
|
+
# Removes a team from a user
|
93
|
+
#
|
94
|
+
# @param [Integer] user_id Id of the user to remove the team from
|
95
|
+
# @param [Integer] team_id Id of the team the user should be removed from
|
96
|
+
#
|
97
|
+
# @return [Boolean] Success
|
98
|
+
#
|
99
|
+
def remove_team_from_user(user_id:, team_id:)
|
100
|
+
delete("/users/#{user_id}/teams/#{team_id}").success?
|
101
|
+
end
|
102
|
+
|
103
|
+
# Fetches a user settings
|
104
|
+
#
|
105
|
+
# @param [Integer] id Id of the user to retrieve settings
|
106
|
+
#
|
107
|
+
# @return [Hash] The fetched user settings
|
108
|
+
#
|
109
|
+
def user_settings(id:)
|
110
|
+
get("/users/#{id}/settings").parse['user_settings']
|
111
|
+
end
|
112
|
+
|
113
|
+
# Fetches a user API keys
|
114
|
+
#
|
115
|
+
# @param [Integer] id Id of the user to retrieve API keys
|
116
|
+
#
|
117
|
+
# @return [StrawberryAPI::ApiKey] The fetched user API key
|
118
|
+
#
|
119
|
+
def user_api_keys(id:)
|
120
|
+
ApiKey.find(user_id: id)
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'strawberry_api/access_right'
|
2
|
+
require 'strawberry_api/api_key'
|
3
|
+
require 'strawberry_api/asset'
|
4
|
+
require 'strawberry_api/client'
|
5
|
+
require 'strawberry_api/collection'
|
6
|
+
require 'strawberry_api/custom_metadatum'
|
7
|
+
require 'strawberry_api/custom_metadata/custom_metadata_field'
|
8
|
+
require 'strawberry_api/custom_metadata/custom_metadata_option'
|
9
|
+
require 'strawberry_api/custom_metadata/custom_metadata_set'
|
10
|
+
require 'strawberry_api/edit'
|
11
|
+
require 'strawberry_api/feature'
|
12
|
+
require 'strawberry_api/feedback'
|
13
|
+
require 'strawberry_api/feedback/asset_feedback'
|
14
|
+
require 'strawberry_api/feedback/copy_to_feedback'
|
15
|
+
require 'strawberry_api/feedback/project_feedback'
|
16
|
+
require 'strawberry_api/library'
|
17
|
+
require 'strawberry_api/marker'
|
18
|
+
require 'strawberry_api/project'
|
19
|
+
require 'strawberry_api/proxy'
|
20
|
+
require 'strawberry_api/role'
|
21
|
+
require 'strawberry_api/schedule'
|
22
|
+
require 'strawberry_api/session'
|
23
|
+
require 'strawberry_api/setting'
|
24
|
+
require 'strawberry_api/status_flag'
|
25
|
+
require 'strawberry_api/strategy'
|
26
|
+
require 'strawberry_api/strategy/archive_strategy'
|
27
|
+
require 'strawberry_api/strategy/archive_strategy_state'
|
28
|
+
require 'strawberry_api/strategy/asset_copy_to_strategy'
|
29
|
+
require 'strawberry_api/strategy/project_copy_to_strategy'
|
30
|
+
require 'strawberry_api/team'
|
31
|
+
require 'strawberry_api/template'
|
32
|
+
require 'strawberry_api/user'
|
33
|
+
require 'strawberry_api/client/api_keys'
|
34
|
+
require 'strawberry_api/client/assets'
|
35
|
+
require 'strawberry_api/client/asset_feedbacks'
|
36
|
+
require 'strawberry_api/client/copy_to_feedbacks'
|
37
|
+
require 'strawberry_api/client/project_feedbacks'
|
38
|
+
require 'strawberry_api/client/collections'
|
39
|
+
require 'strawberry_api/client/custom_metadata'
|
40
|
+
require 'strawberry_api/client/custom_metadata_fields'
|
41
|
+
require 'strawberry_api/client/custom_metadata_options'
|
42
|
+
require 'strawberry_api/client/custom_metadata_sets'
|
43
|
+
require 'strawberry_api/client/edits'
|
44
|
+
require 'strawberry_api/client/features'
|
45
|
+
require 'strawberry_api/client/libraries'
|
46
|
+
require 'strawberry_api/client/markers'
|
47
|
+
require 'strawberry_api/client/projects'
|
48
|
+
require 'strawberry_api/client/roles'
|
49
|
+
require 'strawberry_api/client/schedules'
|
50
|
+
require 'strawberry_api/client/searches'
|
51
|
+
require 'strawberry_api/client/sessions'
|
52
|
+
require 'strawberry_api/client/settings'
|
53
|
+
require 'strawberry_api/client/status_flags'
|
54
|
+
require 'strawberry_api/client/archive_strategies'
|
55
|
+
require 'strawberry_api/client/asset_copy_to_strategies'
|
56
|
+
require 'strawberry_api/client/project_copy_to_strategies'
|
57
|
+
require 'strawberry_api/client/teams'
|
58
|
+
require 'strawberry_api/client/templates'
|
59
|
+
require 'strawberry_api/client/users'
|
60
|
+
|
61
|
+
module StrawberryAPI
|
62
|
+
# Class Client provides methods for querying Strawberry API resources
|
63
|
+
#
|
64
|
+
# @author Pierre Lebrun <pierreyves.lebrun@gmail.com>
|
65
|
+
#
|
66
|
+
class Client < StrawberryAPI::HttpClient
|
67
|
+
include StrawberryAPI::Client::ApiKeys
|
68
|
+
include StrawberryAPI::Client::Assets
|
69
|
+
include StrawberryAPI::Client::Collections
|
70
|
+
include StrawberryAPI::Client::CustomMetadata
|
71
|
+
include StrawberryAPI::Client::CustomMetadataFields
|
72
|
+
include StrawberryAPI::Client::CustomMetadataOptions
|
73
|
+
include StrawberryAPI::Client::CustomMetadataSets
|
74
|
+
include StrawberryAPI::Client::Edits
|
75
|
+
include StrawberryAPI::Client::AssetFeedbacks
|
76
|
+
include StrawberryAPI::Client::CopyToFeedbacks
|
77
|
+
include StrawberryAPI::Client::ProjectFeedbacks
|
78
|
+
include StrawberryAPI::Client::Features
|
79
|
+
include StrawberryAPI::Client::Libraries
|
80
|
+
include StrawberryAPI::Client::Markers
|
81
|
+
include StrawberryAPI::Client::Projects
|
82
|
+
include StrawberryAPI::Client::Roles
|
83
|
+
include StrawberryAPI::Client::Schedules
|
84
|
+
include StrawberryAPI::Client::Searches
|
85
|
+
include StrawberryAPI::Client::Sessions
|
86
|
+
include StrawberryAPI::Client::Settings
|
87
|
+
include StrawberryAPI::Client::StatusFlags
|
88
|
+
include StrawberryAPI::Client::ArchiveStrategies
|
89
|
+
include StrawberryAPI::Client::AssetCopyToStrategies
|
90
|
+
include StrawberryAPI::Client::ProjectCopyToStrategies
|
91
|
+
include StrawberryAPI::Client::Teams
|
92
|
+
include StrawberryAPI::Client::Templates
|
93
|
+
include StrawberryAPI::Client::Users
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class Collection
|
4
|
+
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :user_id
|
7
|
+
attr_accessor :name
|
8
|
+
|
9
|
+
def initialize(params = {})
|
10
|
+
params.each do |k, v|
|
11
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
class Configuration
|
3
|
+
# Hostname or IP address of Strawberry server
|
4
|
+
attr_accessor :host
|
5
|
+
|
6
|
+
# API access key of Strawberry's user
|
7
|
+
attr_accessor :api_key
|
8
|
+
|
9
|
+
# Username of Strawberry's user
|
10
|
+
attr_accessor :username
|
11
|
+
|
12
|
+
# Password of Strawberry's user
|
13
|
+
attr_accessor :password
|
14
|
+
|
15
|
+
# TODO: Use logger within the API client
|
16
|
+
# Debugging intented logger
|
17
|
+
attr_accessor :logger
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class CustomMetadataField
|
4
|
+
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :type
|
8
|
+
attr_accessor :maxlen
|
9
|
+
attr_accessor :mandatory
|
10
|
+
attr_accessor :position
|
11
|
+
attr_accessor :custom_metadata_set_id
|
12
|
+
attr_accessor :use_in_project_name
|
13
|
+
attr_accessor :restriction
|
14
|
+
attr_accessor :pattern
|
15
|
+
attr_accessor :select_field_options
|
16
|
+
|
17
|
+
def initialize(params = {})
|
18
|
+
params.each do |k, v|
|
19
|
+
if k == 'select_field_options'
|
20
|
+
v.map! do |custom_metadata_option|
|
21
|
+
CustomMetadataOption.new(custom_metadata_option)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class CustomMetadataOption
|
4
|
+
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :custom_metadata_field_id
|
8
|
+
attr_accessor :custom_metadata_sub_set_id
|
9
|
+
attr_accessor :safe_search
|
10
|
+
|
11
|
+
def initialize(params = {})
|
12
|
+
params.each do |k, v|
|
13
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class CustomMetadataSet
|
4
|
+
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :root
|
8
|
+
attr_accessor :created_at
|
9
|
+
attr_accessor :updated_at
|
10
|
+
attr_accessor :custom_metadata_fields
|
11
|
+
|
12
|
+
def initialize(params = {})
|
13
|
+
params.each do |k, v|
|
14
|
+
if k == 'custom_metadata_fields'
|
15
|
+
v.map! do |custom_metadata_field|
|
16
|
+
CustomMetadataField.new(custom_metadata_field)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class CustomMetadatum
|
4
|
+
|
5
|
+
attr_accessor :project_id
|
6
|
+
attr_accessor :asset_id
|
7
|
+
attr_accessor :custom_metadata_field_id
|
8
|
+
attr_accessor :custom_metadata_field
|
9
|
+
attr_accessor :value
|
10
|
+
attr_accessor :safe_search
|
11
|
+
|
12
|
+
def initialize(params = {})
|
13
|
+
params.each do |k, v|
|
14
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.filthify(custom_metadata:)
|
19
|
+
filthy_hash = Hash.new
|
20
|
+
|
21
|
+
custom_metadata.each_with_index do |(key, val), i|
|
22
|
+
filthy_hash["custom_metadata[#{i}][custom_metadata_field]"] = key
|
23
|
+
filthy_hash["custom_metadata[#{i}][value]"] = val
|
24
|
+
end
|
25
|
+
|
26
|
+
return filthy_hash
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class Edit
|
4
|
+
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :password
|
8
|
+
attr_accessor :created_at
|
9
|
+
attr_accessor :updated_at
|
10
|
+
attr_accessor :comment
|
11
|
+
|
12
|
+
def initialize(params = {})
|
13
|
+
params.each do |k, v|
|
14
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class Feature
|
4
|
+
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :name
|
7
|
+
attr_accessor :active
|
8
|
+
attr_accessor :created_at
|
9
|
+
attr_accessor :updated_at
|
10
|
+
|
11
|
+
def initialize(params = {})
|
12
|
+
params.each do |k, v|
|
13
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class AssetFeedback < StrawberryAPI::Feedback
|
4
|
+
|
5
|
+
attr_accessor :success
|
6
|
+
attr_accessor :failure
|
7
|
+
|
8
|
+
def initialize(params = {})
|
9
|
+
params.each do |k, v|
|
10
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class ProjectFeedback < StrawberryAPI::Feedback
|
4
|
+
|
5
|
+
attr_accessor :edit_id
|
6
|
+
attr_accessor :project_id
|
7
|
+
|
8
|
+
def initialize(params = {})
|
9
|
+
params.each do |k, v|
|
10
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module StrawberryAPI
|
2
|
+
|
3
|
+
class Feedback
|
4
|
+
|
5
|
+
attr_accessor :id
|
6
|
+
attr_accessor :action
|
7
|
+
attr_accessor :state
|
8
|
+
attr_accessor :error
|
9
|
+
attr_accessor :created_at
|
10
|
+
attr_accessor :updated_at
|
11
|
+
|
12
|
+
def initialize(params = {})
|
13
|
+
params.each do |k, v|
|
14
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|