strawberry_api 0.5.4 → 0.6.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 +4 -4
- data/.rubocop.yml +4022 -4
- data/doc/HTTParty/Response.html +1 -1
- data/doc/StrawberryAPI.html +2 -2
- data/doc/StrawberryAPI/AccessRight.html +1 -1
- data/doc/StrawberryAPI/ApiKey.html +1 -1
- data/doc/StrawberryAPI/ArchiveStrategy.html +1 -1
- data/doc/StrawberryAPI/ArchiveStrategyState.html +1 -1
- data/doc/StrawberryAPI/Asset.html +1 -1
- data/doc/StrawberryAPI/AssetCopyToStrategy.html +1 -1
- data/doc/StrawberryAPI/AssetFeedback.html +1 -1
- data/doc/StrawberryAPI/Client.html +2 -2
- data/doc/StrawberryAPI/Client/ApiKeys.html +1 -1
- data/doc/StrawberryAPI/Client/ArchiveStrategies.html +1 -1
- data/doc/StrawberryAPI/Client/AssetCopyToStrategies.html +1 -1
- data/doc/StrawberryAPI/Client/AssetFeedbacks.html +1 -1
- data/doc/StrawberryAPI/Client/Assets.html +1 -1
- data/doc/StrawberryAPI/Client/Collections.html +1 -1
- data/doc/StrawberryAPI/Client/CopyToFeedbacks.html +1 -1
- data/doc/StrawberryAPI/Client/CustomMetadata.html +1 -1
- data/doc/StrawberryAPI/Client/CustomMetadataFields.html +1 -1
- data/doc/StrawberryAPI/Client/CustomMetadataOptions.html +1 -1
- data/doc/StrawberryAPI/Client/CustomMetadataSets.html +1 -1
- data/doc/StrawberryAPI/Client/Edits.html +1 -1
- data/doc/StrawberryAPI/Client/Features.html +1 -1
- data/doc/StrawberryAPI/Client/Libraries.html +1 -1
- data/doc/StrawberryAPI/Client/Markers.html +1 -1
- data/doc/StrawberryAPI/Client/ProjectCopyToStrategies.html +1 -1
- data/doc/StrawberryAPI/Client/ProjectFeedbacks.html +1 -1
- data/doc/StrawberryAPI/Client/Projects.html +92 -9
- data/doc/StrawberryAPI/Client/Roles.html +1 -1
- data/doc/StrawberryAPI/Client/Schedules.html +1 -1
- data/doc/StrawberryAPI/Client/Searches.html +1 -1
- data/doc/StrawberryAPI/Client/Sessions.html +1 -1
- data/doc/StrawberryAPI/Client/Settings.html +1 -1
- data/doc/StrawberryAPI/Client/StatusFlags.html +1 -1
- data/doc/StrawberryAPI/Client/Teams.html +1 -1
- data/doc/StrawberryAPI/Client/Templates.html +1 -1
- data/doc/StrawberryAPI/Client/Users.html +1 -1
- data/doc/StrawberryAPI/Collection.html +1 -1
- data/doc/StrawberryAPI/Configuration.html +1 -1
- data/doc/StrawberryAPI/CopyToFeedback.html +1 -1
- data/doc/StrawberryAPI/CustomMetadataField.html +1 -1
- data/doc/StrawberryAPI/CustomMetadataOption.html +1 -1
- data/doc/StrawberryAPI/CustomMetadataSet.html +1 -1
- data/doc/StrawberryAPI/CustomMetadatum.html +1 -1
- data/doc/StrawberryAPI/Edit.html +1 -1
- data/doc/StrawberryAPI/Feature.html +1 -1
- data/doc/StrawberryAPI/Feedback.html +1 -1
- data/doc/StrawberryAPI/HttpClient.html +1 -1
- data/doc/StrawberryAPI/Library.html +1 -1
- data/doc/StrawberryAPI/Marker.html +1 -1
- data/doc/StrawberryAPI/Metadatum.html +1 -1
- data/doc/StrawberryAPI/Project.html +1 -1
- data/doc/StrawberryAPI/ProjectCopyToStrategy.html +1 -1
- data/doc/StrawberryAPI/ProjectFeedback.html +1 -1
- data/doc/StrawberryAPI/Proxy.html +1 -1
- data/doc/StrawberryAPI/Role.html +1 -1
- data/doc/StrawberryAPI/Schedule.html +1 -1
- data/doc/StrawberryAPI/Session.html +1 -1
- data/doc/StrawberryAPI/Setting.html +1 -1
- data/doc/StrawberryAPI/StatusFlag.html +1 -1
- data/doc/StrawberryAPI/Strategy.html +1 -1
- data/doc/StrawberryAPI/Team.html +1 -1
- data/doc/StrawberryAPI/Template.html +1 -1
- data/doc/StrawberryAPI/User.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +87 -103
- data/doc/index.html +87 -103
- data/doc/method_list.html +343 -335
- data/doc/top-level-namespace.html +1 -1
- data/lib/strawberry_api.rb +4 -4
- data/lib/strawberry_api/client.rb +61 -61
- data/lib/strawberry_api/client/projects.rb +36 -36
- data/lib/strawberry_api/http_client.rb +11 -11
- data/lib/strawberry_api/version.rb +1 -1
- data/samples/test.rb +1 -1
- data/strawberry_api.gemspec +21 -22
- metadata +3 -3
@@ -100,7 +100,7 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Thu Mar 26 12:41:04 2020 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
105
|
0.9.16 (ruby-2.5.0).
|
106
106
|
</div>
|
data/lib/strawberry_api.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require_relative 'strawberry_api/configuration'
|
2
|
+
require_relative 'strawberry_api/http_client'
|
3
|
+
require_relative 'strawberry_api/client'
|
4
|
+
require_relative 'strawberry_api/version'
|
5
5
|
|
6
6
|
# module StrawberryAPI provides access to Strawberry REST API
|
7
7
|
#
|
@@ -1,63 +1,63 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
1
|
+
require_relative 'access_right'
|
2
|
+
require_relative 'api_key'
|
3
|
+
require_relative 'asset'
|
4
|
+
require_relative 'client'
|
5
|
+
require_relative 'collection'
|
6
|
+
require_relative 'metadatum'
|
7
|
+
require_relative 'custom_metadatum'
|
8
|
+
require_relative 'custom_metadata/custom_metadata_field'
|
9
|
+
require_relative 'custom_metadata/custom_metadata_option'
|
10
|
+
require_relative 'custom_metadata/custom_metadata_set'
|
11
|
+
require_relative 'edit'
|
12
|
+
require_relative 'feature'
|
13
|
+
require_relative 'feedback'
|
14
|
+
require_relative 'feedback/asset_feedback'
|
15
|
+
require_relative 'feedback/copy_to_feedback'
|
16
|
+
require_relative 'feedback/project_feedback'
|
17
|
+
require_relative 'library'
|
18
|
+
require_relative 'marker'
|
19
|
+
require_relative 'project'
|
20
|
+
require_relative 'proxy'
|
21
|
+
require_relative 'role'
|
22
|
+
require_relative 'schedule'
|
23
|
+
require_relative 'session'
|
24
|
+
require_relative 'setting'
|
25
|
+
require_relative 'status_flag'
|
26
|
+
require_relative 'strategy'
|
27
|
+
require_relative 'strategy/archive_strategy'
|
28
|
+
require_relative 'strategy/archive_strategy_state'
|
29
|
+
require_relative 'strategy/asset_copy_to_strategy'
|
30
|
+
require_relative 'strategy/project_copy_to_strategy'
|
31
|
+
require_relative 'team'
|
32
|
+
require_relative 'template'
|
33
|
+
require_relative 'user'
|
34
|
+
require_relative 'client/api_keys'
|
35
|
+
require_relative 'client/assets'
|
36
|
+
require_relative 'client/asset_feedbacks'
|
37
|
+
require_relative 'client/copy_to_feedbacks'
|
38
|
+
require_relative 'client/project_feedbacks'
|
39
|
+
require_relative 'client/collections'
|
40
|
+
require_relative 'client/custom_metadata'
|
41
|
+
require_relative 'client/custom_metadata_fields'
|
42
|
+
require_relative 'client/custom_metadata_options'
|
43
|
+
require_relative 'client/custom_metadata_sets'
|
44
|
+
require_relative 'client/edits'
|
45
|
+
require_relative 'client/features'
|
46
|
+
require_relative 'client/libraries'
|
47
|
+
require_relative 'client/markers'
|
48
|
+
require_relative 'client/projects'
|
49
|
+
require_relative 'client/roles'
|
50
|
+
require_relative 'client/schedules'
|
51
|
+
require_relative 'client/searches'
|
52
|
+
require_relative 'client/sessions'
|
53
|
+
require_relative 'client/settings'
|
54
|
+
require_relative 'client/status_flags'
|
55
|
+
require_relative 'client/archive_strategies'
|
56
|
+
require_relative 'client/asset_copy_to_strategies'
|
57
|
+
require_relative 'client/project_copy_to_strategies'
|
58
|
+
require_relative 'client/teams'
|
59
|
+
require_relative 'client/templates'
|
60
|
+
require_relative 'client/users'
|
61
61
|
|
62
62
|
module StrawberryAPI
|
63
63
|
# Class Client provides methods for querying Strawberry API resources
|
@@ -93,4 +93,4 @@ module StrawberryAPI
|
|
93
93
|
include StrawberryAPI::Client::Templates
|
94
94
|
include StrawberryAPI::Client::Users
|
95
95
|
end
|
96
|
-
end
|
96
|
+
end
|
@@ -7,7 +7,7 @@ module StrawberryAPI
|
|
7
7
|
# @option [Boolean] include_libraries false Include project libraries
|
8
8
|
#
|
9
9
|
# @return [Array<StrawberryAPI::Project>] A list of projects
|
10
|
-
#
|
10
|
+
#
|
11
11
|
def projects(include_libraries: false)
|
12
12
|
projects = get("/projects").parse['projects']&.map do |project|
|
13
13
|
Project.new(project)
|
@@ -26,12 +26,12 @@ module StrawberryAPI
|
|
26
26
|
#
|
27
27
|
#
|
28
28
|
# @return [Array<StrawberryAPI::Project>] A list of library projects
|
29
|
-
#
|
29
|
+
#
|
30
30
|
def library_projects
|
31
31
|
projects = get("/projects").parse['projects']&.map do |project|
|
32
32
|
Project.new(project)
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
projects.keep_if do |project|
|
36
36
|
project.is_library_project
|
37
37
|
end
|
@@ -41,7 +41,7 @@ module StrawberryAPI
|
|
41
41
|
#
|
42
42
|
#
|
43
43
|
# @return [Array<StrawberryAPI::Project>] A list of online projects
|
44
|
-
#
|
44
|
+
#
|
45
45
|
def online_projects
|
46
46
|
projects.select do |project|
|
47
47
|
project.archive_strategy_id.nil? && !project.deleted && !project.is_library_project
|
@@ -52,7 +52,7 @@ module StrawberryAPI
|
|
52
52
|
#
|
53
53
|
#
|
54
54
|
# @return [Array<StrawberryAPI::Project>] A list of archived projects
|
55
|
-
#
|
55
|
+
#
|
56
56
|
def archived_projects
|
57
57
|
projects.select do |project|
|
58
58
|
project.archive_strategy_id && !project.deleted && !project.is_library_project
|
@@ -64,7 +64,7 @@ module StrawberryAPI
|
|
64
64
|
# @param [Integer] id Id of the project to retrieve
|
65
65
|
#
|
66
66
|
# @return [StrawberryAPI::Project] The fetched project
|
67
|
-
#
|
67
|
+
#
|
68
68
|
def project(id:)
|
69
69
|
data = get("/projects/#{id}").parse['project']
|
70
70
|
data.nil? ? nil : Project.new(data)
|
@@ -76,7 +76,7 @@ module StrawberryAPI
|
|
76
76
|
# @param [String] templatename Name of the template to use
|
77
77
|
#
|
78
78
|
# @return [StrawberryAPI::Project] The created project
|
79
|
-
#
|
79
|
+
#
|
80
80
|
def create_project(name:, templatename:, custom_metadata: nil)
|
81
81
|
if custom_metadata
|
82
82
|
custom_metadata = custom_metadata.each_with_object(Array.new) do |field, memo|
|
@@ -90,7 +90,7 @@ module StrawberryAPI
|
|
90
90
|
custom_metadata: custom_metadata
|
91
91
|
}.to_json
|
92
92
|
|
93
|
-
|
93
|
+
temp = post("/projects", body: body).parse['job']
|
94
94
|
|
95
95
|
data.nil? ? nil : Project.new(data)
|
96
96
|
end
|
@@ -101,7 +101,7 @@ module StrawberryAPI
|
|
101
101
|
# @param [Hash] options Hash of options
|
102
102
|
#
|
103
103
|
# @return [StrawberryAPI::Project] The updated project
|
104
|
-
#
|
104
|
+
#
|
105
105
|
def update_project(id:, options: {})
|
106
106
|
data = put("/projects/#{id}", body: options.to_json).parse['project']
|
107
107
|
data.nil? ? nil : Project.new(data)
|
@@ -112,7 +112,7 @@ module StrawberryAPI
|
|
112
112
|
# @param [Integer] id Id of the project to delete
|
113
113
|
#
|
114
114
|
# @return [Boolean] Success
|
115
|
-
#
|
115
|
+
#
|
116
116
|
def delete_project(id:)
|
117
117
|
delete("/projects/#{id}").success?
|
118
118
|
end
|
@@ -122,7 +122,7 @@ module StrawberryAPI
|
|
122
122
|
# @param [Integer] id Id of the project to open
|
123
123
|
#
|
124
124
|
# @return [Boolean] Success
|
125
|
-
#
|
125
|
+
#
|
126
126
|
def open_project(id:)
|
127
127
|
put("/projects/#{id}/open").success?
|
128
128
|
end
|
@@ -132,7 +132,7 @@ module StrawberryAPI
|
|
132
132
|
# @param [Integer] id Id of the project to sync
|
133
133
|
#
|
134
134
|
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
135
|
-
#
|
135
|
+
#
|
136
136
|
def sync_project(id:)
|
137
137
|
data = put("/projects/#{id}/sync").parse['job']
|
138
138
|
data.nil? ? nil : ProjectFeedback.new(data)
|
@@ -143,7 +143,7 @@ module StrawberryAPI
|
|
143
143
|
# @param [Integer] id Id of the project to freeze
|
144
144
|
#
|
145
145
|
# @return [Boolean] Success
|
146
|
-
#
|
146
|
+
#
|
147
147
|
def freeze_project(id:)
|
148
148
|
put("/projects/#{id}/freeze").success?
|
149
149
|
end
|
@@ -153,17 +153,17 @@ module StrawberryAPI
|
|
153
153
|
# @param [Integer] id Id of the project to unfreeze
|
154
154
|
#
|
155
155
|
# @return [Boolean] Success
|
156
|
-
#
|
156
|
+
#
|
157
157
|
def unfreeze_project(id:)
|
158
158
|
delete("/projects/#{id}/unfreeze").success?
|
159
159
|
end
|
160
|
-
|
160
|
+
|
161
161
|
# Closes a project
|
162
162
|
#
|
163
163
|
# @param [Integer] id Id of the project to close
|
164
164
|
#
|
165
165
|
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
166
|
-
#
|
166
|
+
#
|
167
167
|
def close_project(id:, edit:)
|
168
168
|
delete("/projects/#{id}/close", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
169
169
|
data.nil? ? nil : ProjectFeedback.new(data)
|
@@ -174,7 +174,7 @@ module StrawberryAPI
|
|
174
174
|
# @param [Integer] id Id of the project to forceclose
|
175
175
|
#
|
176
176
|
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
177
|
-
#
|
177
|
+
#
|
178
178
|
def forceclose_project(id:, edit:)
|
179
179
|
data = delete("/projects/#{id}/forceclose", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
180
180
|
data.nil? ? nil : ProjectFeedback.new(data)
|
@@ -185,7 +185,7 @@ module StrawberryAPI
|
|
185
185
|
# @param [Integer] id Id of the project to mount
|
186
186
|
#
|
187
187
|
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
188
|
-
#
|
188
|
+
#
|
189
189
|
def mount_project(id:, edit:)
|
190
190
|
data = put("/projects/#{id}/mount", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
191
191
|
data.nil? ? nil : ProjectFeedback.new(data)
|
@@ -196,7 +196,7 @@ module StrawberryAPI
|
|
196
196
|
# @param [Integer] id Id of the project to unmount
|
197
197
|
#
|
198
198
|
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
199
|
-
#
|
199
|
+
#
|
200
200
|
def umount_project(id:, edit:)
|
201
201
|
data = delete("/projects/#{id}/umount", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
202
202
|
data.nil? ? nil : ProjectFeedback.new(data)
|
@@ -207,7 +207,7 @@ module StrawberryAPI
|
|
207
207
|
# @param [Integer] id Id of the mounted project to refresh
|
208
208
|
#
|
209
209
|
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
210
|
-
#
|
210
|
+
#
|
211
211
|
def refresh_mounted_project(id:)
|
212
212
|
data = put("/projects/#{id}/refreshmountedproject", headers: {'X-FLAVOURSYS-EDIT' => edit}).parse['job']
|
213
213
|
data.nil? ? nil : ProjectFeedback.new(data)
|
@@ -218,13 +218,13 @@ module StrawberryAPI
|
|
218
218
|
# @param [Integer] id Id of the project to archive
|
219
219
|
#
|
220
220
|
# @return [StrawberryAPI::ProjectFeedback] The operation status
|
221
|
-
#
|
221
|
+
#
|
222
222
|
def archive_project(id:, archive_strategy_id:, exclude_linked_files: 'false')
|
223
223
|
body = {
|
224
224
|
strategy: archive_strategy_id,
|
225
225
|
exclude_linked_files: exclude_linked_files
|
226
226
|
}.to_json
|
227
|
-
|
227
|
+
|
228
228
|
data = put("/projects/#{id}/archive", body: body).parse['archivestrategystate']
|
229
229
|
data.nil? ? nil : ArchiveStrategyState.new(data)
|
230
230
|
end
|
@@ -234,7 +234,7 @@ module StrawberryAPI
|
|
234
234
|
# @param [Integer] id Id of the project to unarchive
|
235
235
|
#
|
236
236
|
# @return [StrawberryAPI::ArchiveStrategyState] The operation status
|
237
|
-
#
|
237
|
+
#
|
238
238
|
def unarchive_project(id:)
|
239
239
|
data = put("/projects/#{id}/unarchive").parse['archivestrategystate']
|
240
240
|
data.nil? ? nil : ArchiveStrategyState.new(data)
|
@@ -245,7 +245,7 @@ module StrawberryAPI
|
|
245
245
|
# @param [String] name Substring to look for
|
246
246
|
#
|
247
247
|
# @return [Array<StrawberryAPI::Project>] A list of project matching the substring
|
248
|
-
#
|
248
|
+
#
|
249
249
|
def search_project(name:)
|
250
250
|
get("/projects/search", body: {name: name}).parse['projects']&.map do |project|
|
251
251
|
Project.new(project)
|
@@ -257,7 +257,7 @@ module StrawberryAPI
|
|
257
257
|
# @param [Interger] id If of the project to retrieve teams from
|
258
258
|
#
|
259
259
|
# @return [Array<StrawberryAPI::Team>] The fetched project teams
|
260
|
-
#
|
260
|
+
#
|
261
261
|
def project_teams(id:)
|
262
262
|
teams = get("/projects/#{id}/teams").parse['array']
|
263
263
|
teams.map do |team|
|
@@ -269,8 +269,8 @@ module StrawberryAPI
|
|
269
269
|
#
|
270
270
|
# @param [Integer] id Id of the project to retrieve access rights from
|
271
271
|
#
|
272
|
-
# @return [Array<StrawberryAPI::AccessRight>] The fetched project access rights
|
273
|
-
#
|
272
|
+
# @return [Array<StrawberryAPI::AccessRight>] The fetched project access rights
|
273
|
+
#
|
274
274
|
def project_effective_access_rights(id:)
|
275
275
|
access_rights = get("/projects/#{id}/effective_access_rights").parse['hash']
|
276
276
|
access_rights.map do |accessright|
|
@@ -285,7 +285,7 @@ module StrawberryAPI
|
|
285
285
|
# @param [Boolean] write false Write access to the project
|
286
286
|
#
|
287
287
|
# @return [Boolean] Success
|
288
|
-
#
|
288
|
+
#
|
289
289
|
def add_team_to_project(id:, team_id:, write: false)
|
290
290
|
body = {
|
291
291
|
team_id: team_id,
|
@@ -301,7 +301,7 @@ module StrawberryAPI
|
|
301
301
|
# @param [Integer] team_id Id of the team to remove from the project
|
302
302
|
#
|
303
303
|
# @return [Boolean] Success
|
304
|
-
#
|
304
|
+
#
|
305
305
|
def remove_team_from_project(id:, team_id:)
|
306
306
|
delete("/projects/#{id}/teams/#{team_id}").success?
|
307
307
|
end
|
@@ -311,7 +311,7 @@ module StrawberryAPI
|
|
311
311
|
# @param [Integer] id Id of the project to retrieve status flags from
|
312
312
|
#
|
313
313
|
# @return [Hash] The fetched project status flags
|
314
|
-
#
|
314
|
+
#
|
315
315
|
def project_status_flags(id:)
|
316
316
|
status_flags = get("/projects/#{id}/status_flags").parse['array']
|
317
317
|
end
|
@@ -321,7 +321,7 @@ module StrawberryAPI
|
|
321
321
|
# @param [Integer] id Id of the project to retrieve custom metadata from
|
322
322
|
#
|
323
323
|
# @return [Array<StrawberryAPI::CustomMetadata>] The fetched project custom metadata
|
324
|
-
#
|
324
|
+
#
|
325
325
|
def project_custom_metadata(id:)
|
326
326
|
custom_metadata = get("/projects/#{id}/custom_metadata").parse['array']
|
327
327
|
custom_metadata.map do |custom_metadata|
|
@@ -335,7 +335,7 @@ module StrawberryAPI
|
|
335
335
|
# @param [Hash] custom_metadata Custom metadata to update the project with
|
336
336
|
#
|
337
337
|
# @return [Boolean] Success
|
338
|
-
#
|
338
|
+
#
|
339
339
|
def update_project_custom_metadata(id:, custom_metadata: nil)
|
340
340
|
filthy_hash = StrawberryAPI::CustomMetadatum.filthify(custom_metadata: custom_metadata)
|
341
341
|
put("/projects/#{id}/update_metadata", query: filthy_hash).success?
|
@@ -346,7 +346,7 @@ module StrawberryAPI
|
|
346
346
|
# @param [Integer] id Id of the project to retrieve which to retrieve assets from
|
347
347
|
#
|
348
348
|
# @return [Array<StrawberryAPI::Asset>] The fetched project assets
|
349
|
-
#
|
349
|
+
#
|
350
350
|
def project_assets(id:)
|
351
351
|
assets = get("/projects/#{id}/assets").parse['assets']
|
352
352
|
assets.map do |asset|
|
@@ -358,7 +358,7 @@ module StrawberryAPI
|
|
358
358
|
#
|
359
359
|
#
|
360
360
|
# @return [Hash] The fetched projects size
|
361
|
-
#
|
361
|
+
#
|
362
362
|
def projects_size
|
363
363
|
get("/total_project_size").parse
|
364
364
|
end
|
@@ -367,11 +367,11 @@ module StrawberryAPI
|
|
367
367
|
#
|
368
368
|
#
|
369
369
|
# @return [Hash] The fetched projects report
|
370
|
-
#
|
370
|
+
#
|
371
371
|
def projects_repor
|
372
372
|
get("/projects_report").parse
|
373
373
|
end
|
374
374
|
|
375
375
|
end
|
376
376
|
end
|
377
|
-
end
|
377
|
+
end
|
@@ -10,7 +10,7 @@ module StrawberryAPI
|
|
10
10
|
|
11
11
|
include HTTParty
|
12
12
|
headers 'Accept': 'application/json', 'Content-Type': 'application/json', 'X-FLAVOURSYS-CLIENT': 'API client 1.0'
|
13
|
-
|
13
|
+
|
14
14
|
# Class HTTParty::Response provides methods to handle HTTP reponses
|
15
15
|
#
|
16
16
|
# @author John Nunemaker <nunemaker@gmail.com>
|
@@ -44,7 +44,7 @@ module StrawberryAPI
|
|
44
44
|
|
45
45
|
if api_key
|
46
46
|
self.class.get("/session", headers: {Authorization: "Bearer #{api_key}"}).success?
|
47
|
-
|
47
|
+
|
48
48
|
@headers = self.class.headers.dup
|
49
49
|
@headers[:Authorization] = "Bearer #{api_key}"
|
50
50
|
elsif username && password
|
@@ -61,9 +61,9 @@ module StrawberryAPI
|
|
61
61
|
def request(method, path, mute_failure: false, **options)
|
62
62
|
options[:headers] = @headers
|
63
63
|
options[:cookies] = @cookies
|
64
|
-
|
64
|
+
|
65
65
|
response = self.class.send(method, path, options)
|
66
|
-
|
66
|
+
|
67
67
|
if mute_failure
|
68
68
|
response
|
69
69
|
else
|
@@ -78,7 +78,7 @@ module StrawberryAPI
|
|
78
78
|
# @return [HTTParty::Response] HTTP reponse
|
79
79
|
#
|
80
80
|
# @raise [String] Indicates the reponse error code and information
|
81
|
-
#
|
81
|
+
#
|
82
82
|
def handle_response(response)
|
83
83
|
if response.success?
|
84
84
|
response
|
@@ -86,14 +86,14 @@ module StrawberryAPI
|
|
86
86
|
raise "#{response.code} #{response['error']}"
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
# Overrides HTTPary reponse handling
|
91
91
|
#
|
92
92
|
# @param [String] path
|
93
93
|
# @param [String] mute_failure Prevents error raise if request fails
|
94
94
|
#
|
95
95
|
# @return [HTTParty::Response] API response
|
96
|
-
#
|
96
|
+
#
|
97
97
|
def get(path, mute_failure: false, **options)
|
98
98
|
request(:get, path, mute_failure: false, **options)
|
99
99
|
end
|
@@ -104,7 +104,7 @@ module StrawberryAPI
|
|
104
104
|
# @param [String] mute_failure Prevents error raise if request fails
|
105
105
|
#
|
106
106
|
# @return [HTTParty::Response] API response
|
107
|
-
#
|
107
|
+
#
|
108
108
|
def post(path, mute_failure: false, **options)
|
109
109
|
request(:post, path, mute_failure: false, **options)
|
110
110
|
end
|
@@ -115,7 +115,7 @@ module StrawberryAPI
|
|
115
115
|
# @param [String] mute_failure Prevents error raise if request fails
|
116
116
|
#
|
117
117
|
# @return [HTTParty::Response] API response
|
118
|
-
#
|
118
|
+
#
|
119
119
|
def put(path, mute_failure: false, **options)
|
120
120
|
request(:put, path, mute_failure: false, **options)
|
121
121
|
end
|
@@ -126,10 +126,10 @@ module StrawberryAPI
|
|
126
126
|
# @param [String] mute_failure Prevents error raise if request fails
|
127
127
|
#
|
128
128
|
# @return [HTTParty::Response] API response
|
129
|
-
#
|
129
|
+
#
|
130
130
|
def delete(path, mute_failure: false, **options)
|
131
131
|
request(:delete, path, mute_failure: false, **options)
|
132
132
|
end
|
133
133
|
|
134
134
|
end
|
135
|
-
end
|
135
|
+
end
|