strawberry_api 0.4.8 → 0.5.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.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/doc/HTTParty/Response.html +1 -1
  3. data/doc/StrawberryAPI.html +4 -4
  4. data/doc/StrawberryAPI/AccessRight.html +1 -1
  5. data/doc/StrawberryAPI/ApiKey.html +1 -1
  6. data/doc/StrawberryAPI/ArchiveStrategy.html +1 -1
  7. data/doc/StrawberryAPI/ArchiveStrategyState.html +1 -1
  8. data/doc/StrawberryAPI/Asset.html +2 -2
  9. data/doc/StrawberryAPI/AssetCopyToStrategy.html +1 -1
  10. data/doc/StrawberryAPI/AssetFeedback.html +1 -1
  11. data/doc/StrawberryAPI/Client.html +9 -9
  12. data/doc/StrawberryAPI/Client/ApiKeys.html +5 -5
  13. data/doc/StrawberryAPI/Client/ArchiveStrategies.html +1 -1
  14. data/doc/StrawberryAPI/Client/AssetCopyToStrategies.html +5 -5
  15. data/doc/StrawberryAPI/Client/AssetFeedbacks.html +1 -1
  16. data/doc/StrawberryAPI/Client/Assets.html +6 -6
  17. data/doc/StrawberryAPI/Client/Collections.html +1 -1
  18. data/doc/StrawberryAPI/Client/CopyToFeedbacks.html +1 -1
  19. data/doc/StrawberryAPI/Client/CustomMetadata.html +1 -1
  20. data/doc/StrawberryAPI/Client/CustomMetadataFields.html +1 -1
  21. data/doc/StrawberryAPI/Client/CustomMetadataOptions.html +1 -1
  22. data/doc/StrawberryAPI/Client/CustomMetadataSets.html +1 -1
  23. data/doc/StrawberryAPI/Client/Edits.html +1 -1
  24. data/doc/StrawberryAPI/Client/Features.html +1 -1
  25. data/doc/StrawberryAPI/Client/Libraries.html +294 -2
  26. data/doc/StrawberryAPI/Client/Markers.html +1 -1
  27. data/doc/StrawberryAPI/Client/ProjectCopyToStrategies.html +5 -5
  28. data/doc/StrawberryAPI/Client/ProjectFeedbacks.html +1 -1
  29. data/doc/StrawberryAPI/Client/Projects.html +410 -152
  30. data/doc/StrawberryAPI/Client/Roles.html +1 -1
  31. data/doc/StrawberryAPI/Client/Schedules.html +1 -1
  32. data/doc/StrawberryAPI/Client/Searches.html +1 -1
  33. data/doc/StrawberryAPI/Client/Sessions.html +1 -1
  34. data/doc/StrawberryAPI/Client/Settings.html +1 -1
  35. data/doc/StrawberryAPI/Client/StatusFlags.html +1 -1
  36. data/doc/StrawberryAPI/Client/Teams.html +5 -5
  37. data/doc/StrawberryAPI/Client/Templates.html +1 -1
  38. data/doc/StrawberryAPI/Client/Users.html +5 -5
  39. data/doc/StrawberryAPI/Collection.html +1 -1
  40. data/doc/StrawberryAPI/Configuration.html +1 -1
  41. data/doc/StrawberryAPI/CopyToFeedback.html +1 -1
  42. data/doc/StrawberryAPI/CustomMetadataField.html +1 -1
  43. data/doc/StrawberryAPI/CustomMetadataOption.html +1 -1
  44. data/doc/StrawberryAPI/CustomMetadataSet.html +1 -1
  45. data/doc/StrawberryAPI/CustomMetadatum.html +1 -1
  46. data/doc/StrawberryAPI/Edit.html +1 -1
  47. data/doc/StrawberryAPI/Feature.html +1 -1
  48. data/doc/StrawberryAPI/Feedback.html +1 -1
  49. data/doc/StrawberryAPI/HttpClient.html +1 -1
  50. data/doc/StrawberryAPI/Library.html +1 -1
  51. data/doc/StrawberryAPI/Marker.html +1 -1
  52. data/doc/StrawberryAPI/Metadatum.html +567 -0
  53. data/doc/StrawberryAPI/Project.html +1 -1
  54. data/doc/StrawberryAPI/ProjectCopyToStrategy.html +1 -1
  55. data/doc/StrawberryAPI/ProjectFeedback.html +1 -1
  56. data/doc/StrawberryAPI/Proxy.html +1 -1
  57. data/doc/StrawberryAPI/Role.html +1 -1
  58. data/doc/StrawberryAPI/Schedule.html +1 -1
  59. data/doc/StrawberryAPI/Session.html +1 -1
  60. data/doc/StrawberryAPI/Setting.html +1 -1
  61. data/doc/StrawberryAPI/StatusFlag.html +1 -1
  62. data/doc/StrawberryAPI/Strategy.html +1 -1
  63. data/doc/StrawberryAPI/Team.html +1 -1
  64. data/doc/StrawberryAPI/Template.html +1 -1
  65. data/doc/StrawberryAPI/User.html +1 -1
  66. data/doc/_index.html +8 -1
  67. data/doc/class_list.html +1 -1
  68. data/doc/file.README.html +1 -1
  69. data/doc/index.html +1 -1
  70. data/doc/method_list.html +541 -461
  71. data/doc/top-level-namespace.html +1 -1
  72. data/lib/strawberry_api/asset.rb +1 -1
  73. data/lib/strawberry_api/client.rb +1 -0
  74. data/lib/strawberry_api/client/api_keys.rb +1 -1
  75. data/lib/strawberry_api/client/asset_copy_to_strategies.rb +1 -1
  76. data/lib/strawberry_api/client/assets.rb +2 -2
  77. data/lib/strawberry_api/client/libraries.rb +34 -0
  78. data/lib/strawberry_api/client/project_copy_to_strategies.rb +1 -1
  79. data/lib/strawberry_api/client/projects.rb +32 -3
  80. data/lib/strawberry_api/client/teams.rb +1 -1
  81. data/lib/strawberry_api/client/users.rb +1 -1
  82. data/lib/strawberry_api/metadatum.rb +18 -0
  83. data/lib/strawberry_api/version.rb +1 -1
  84. data/samples/test.rb +2 -1
  85. metadata +4 -2
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Sun Sep 23 15:55:27 2018 by
103
+ Generated on Mon Oct 22 13:11:46 2018 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>
@@ -28,7 +28,7 @@ module StrawberryAPI
28
28
  v = Proxy.new(v)
29
29
  elsif k == 'metadata'
30
30
  v&.map! do |metadatum|
31
- metadatum.transform_keys(&:to_sym)
31
+ Metadatum.new(metadatum)
32
32
  end
33
33
  end
34
34
 
@@ -3,6 +3,7 @@ require 'strawberry_api/api_key'
3
3
  require 'strawberry_api/asset'
4
4
  require 'strawberry_api/client'
5
5
  require 'strawberry_api/collection'
6
+ require 'strawberry_api/metadatum'
6
7
  require 'strawberry_api/custom_metadatum'
7
8
  require 'strawberry_api/custom_metadata/custom_metadata_field'
8
9
  require 'strawberry_api/custom_metadata/custom_metadata_option'
@@ -40,7 +40,7 @@ module StrawberryAPI
40
40
  #
41
41
  # @return [Boolean] Success
42
42
  #
43
- def destroy_api_key(user_id:, api_key_id:)
43
+ def delete_api_key(user_id:, api_key_id:)
44
44
  delete("/users/#{user_id}/api_keys/#{api_key_id}").success?
45
45
  end
46
46
 
@@ -74,7 +74,7 @@ module StrawberryAPI
74
74
  #
75
75
  # @return [Boolean] Success
76
76
  #
77
- def destroy_asset_copy_to_strategy(id:)
77
+ def delete_asset_copy_to_strategy(id:)
78
78
  delete("/asset_copy_to_strategies/#{id}").success?
79
79
  end
80
80
 
@@ -61,7 +61,7 @@ module StrawberryAPI
61
61
  #
62
62
  # @return [Boolean] Success
63
63
  #
64
- def destroy_assets(project_id:, asset_ids:)
64
+ def delete_assets(project_id:, asset_ids:)
65
65
  delete("/assets/destroy", body: {data: {project_id => {asset_ids: asset_ids}}}).success?
66
66
  end
67
67
 
@@ -83,7 +83,7 @@ module StrawberryAPI
83
83
  # @return [Boolean] Success
84
84
  #
85
85
  def update_asset_custom_metadata(id:, custom_metadata:)
86
- filthy_hash = StrawberryAPI::CustomMetadata.filthify(custom_metadata: custom_metadata)
86
+ filthy_hash = StrawberryAPI::CustomMetadatum.filthify(custom_metadata: custom_metadata)
87
87
  put("/assets/#{id}/update_metadata", query: filthy_hash).success?
88
88
  end
89
89
 
@@ -25,6 +25,40 @@ module StrawberryAPI
25
25
  end
26
26
  end
27
27
 
28
+ # Creates a library
29
+ #
30
+ # @param [Integer] project_id Id of the project where to ingest media
31
+ # @param [String] ingest_storage Name of the storage to ingest into
32
+ # @param [<type>] ingest_path Watchfoler path
33
+ # @param [<type>] external false Whether to keep in place ingest media
34
+ # @param [<type>] options {mxf_handling: false} Hash of options
35
+ #
36
+ # @return [StrawberryAPI::Library] The created library
37
+ #
38
+ def create_library(project_id:, ingest_storage: 'media_1', ingest_path:, external: false, options: {mxf_handling: false})
39
+ update_project(id: project_id, options: {is_library_project: true, encoding_priority: 'high'})
40
+
41
+ body = {
42
+ project_id: project_id,
43
+ ingest_storage: ingest_storage,
44
+ ingest_path: ingest_path,
45
+ external: external,
46
+ options: options
47
+ }.to_json
48
+
49
+ data = post("/library_ingests", body: body).parse['libraryingest']
50
+ data.nil? ? nil : Library.new(data)
51
+ end
52
+
53
+ # Deletes a library
54
+ #
55
+ # @param [Integer] id Id of the library to delete
56
+ #
57
+ # @return [Boolean] Success
58
+ #
59
+ def delete_library(id:)
60
+ delete("/library_ingests/#{id}").success?
61
+ end
28
62
  end
29
63
  end
30
64
  end
@@ -79,7 +79,7 @@ module StrawberryAPI
79
79
  #
80
80
  # @return [Boolean>] Success
81
81
  #
82
- def destroy_project_copy_to_strategy(id:)
82
+ def delete_project_copy_to_strategy(id:)
83
83
  delete("/project_copy_to_strategies/#{id}").success?
84
84
  end
85
85
 
@@ -77,23 +77,40 @@ module StrawberryAPI
77
77
  #
78
78
  # @return [StrawberryAPI::Project] The created project
79
79
  #
80
- def create_project(name:, templatename:)
80
+ def create_project(name:, templatename:, custom_metadata: nil)
81
+ custom_metadata = custom_metadata.each_with_object(Array.new) do |field, memo|
82
+ memo.push({custom_metadata_field: field[0], value: field[1]})
83
+ end
84
+
81
85
  body = {
82
86
  name: name,
83
- templatename: templatename
87
+ templatename: templatename,
88
+ custom_metadata: custom_metadata
84
89
  }.to_json
85
90
 
86
91
  data = post("/projects", body: body).parse['project']
87
92
  data.nil? ? nil : Project.new(data)
88
93
  end
89
94
 
95
+ # Updates a project
96
+ #
97
+ # @param [Interger] id Id of the project to update
98
+ # @param [Hash] options Hash of options
99
+ #
100
+ # @return [StrawberryAPI::Project] The updated project
101
+ #
102
+ def update_project(id:, options: {})
103
+ data = put("/projects/#{id}", body: options.to_json).parse['project']
104
+ data.nil? ? nil : Project.new(data)
105
+ end
106
+
90
107
  # Deletes a project
91
108
  #
92
109
  # @param [Integer] id Id of the project to delete
93
110
  #
94
111
  # @return [Boolean] Success
95
112
  #
96
- def destroy_project(id:)
113
+ def delete_project(id:)
97
114
  delete("/projects/#{id}").success?
98
115
  end
99
116
 
@@ -309,6 +326,18 @@ module StrawberryAPI
309
326
  end
310
327
  end
311
328
 
329
+ # Updates an project custom metadata
330
+ #
331
+ # @param [Integer] id Id of the project which to update custom metadata
332
+ # @param [Hash] custom_metadata Custom metadata to update the project with
333
+ #
334
+ # @return [Boolean] Success
335
+ #
336
+ def update_project_custom_metadata(id:, custom_metadata: nil)
337
+ filthy_hash = StrawberryAPI::CustomMetadatum.filthify(custom_metadata: custom_metadata)
338
+ put("/projects/#{id}/update_metadata", query: filthy_hash).success?
339
+ end
340
+
312
341
  # Fetches a project assets
313
342
  #
314
343
  # @param [Integer] id Id of the project to retrieve which to retrieve assets from
@@ -76,7 +76,7 @@ module StrawberryAPI
76
76
  #
77
77
  # @return [Boolean] Success
78
78
  #
79
- def destroy_team(id:)
79
+ def delete_team(id:)
80
80
  delete("/teams/#{id}").success?
81
81
  end
82
82
 
@@ -74,7 +74,7 @@ module StrawberryAPI
74
74
  #
75
75
  # @return [Boolean] Success
76
76
  #
77
- def destroy_user(id:)
77
+ def delete_user(id:)
78
78
  delete("/users/#{id}").success?
79
79
  end
80
80
 
@@ -0,0 +1,18 @@
1
+ module StrawberryAPI
2
+
3
+ class Metadatum
4
+
5
+ attr_accessor :id
6
+ attr_accessor :asset_id
7
+ attr_accessor :source
8
+ attr_accessor :property
9
+ attr_accessor :value
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
@@ -1,3 +1,3 @@
1
1
  module StrawberryAPI
2
- VERSION = "0.4.8"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -8,4 +8,5 @@ StrawberryAPI.configure do |c|
8
8
  end
9
9
 
10
10
  strawberry = StrawberryAPI::Client.new
11
- p strawberry.libraries
11
+
12
+ #strawberry.destroy_project(id: 98)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strawberry_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Lebrun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-29 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -118,6 +118,7 @@ files:
118
118
  - doc/StrawberryAPI/HttpClient.html
119
119
  - doc/StrawberryAPI/Library.html
120
120
  - doc/StrawberryAPI/Marker.html
121
+ - doc/StrawberryAPI/Metadatum.html
121
122
  - doc/StrawberryAPI/Project.html
122
123
  - doc/StrawberryAPI/ProjectCopyToStrategy.html
123
124
  - doc/StrawberryAPI/ProjectFeedback.html
@@ -192,6 +193,7 @@ files:
192
193
  - lib/strawberry_api/http_client.rb
193
194
  - lib/strawberry_api/library.rb
194
195
  - lib/strawberry_api/marker.rb
196
+ - lib/strawberry_api/metadatum.rb
195
197
  - lib/strawberry_api/project.rb
196
198
  - lib/strawberry_api/proxy.rb
197
199
  - lib/strawberry_api/role.rb