Module: StrawberryAPI::Client::Libraries
- Included in:
- StrawberryAPI::Client
- Defined in:
- lib/strawberry_api/client/libraries.rb
Instance Method Summary collapse
-
#create_library(project_id:, ingest_storage: 'media_1', ingest_path:, external: false, options: {mxf_handling: false}) ⇒ StrawberryAPI::Library
Creates a library.
-
#delete_library(id:) ⇒ Boolean
Deletes a library.
-
#libraries ⇒ Array<StrawberryAPI::Library>
Fetches all libraries.
-
#library(id: nil, project_id: nil) ⇒ StrawberryAPI::Library
Fetches a library.
Instance Method Details
#create_library(project_id:, ingest_storage: 'media_1', ingest_path:, external: false, options: {mxf_handling: false}) ⇒ StrawberryAPI::Library
Creates a library
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/strawberry_api/client/libraries.rb', line 38 def create_library(project_id:, ingest_storage: 'media_1', ingest_path:, external: false, options: {mxf_handling: false}) update_project(id: project_id, options: {is_library_project: true, encoding_priority: 'high'}) body = { project_id: project_id, ingest_storage: ingest_storage, ingest_path: ingest_path, external: external, options: }.to_json job = post("/library_ingests", body: body).parse['job'] job.nil? ? nil : library(project_id: job['project_id']) end |
#delete_library(id:) ⇒ Boolean
Deletes a library
60 61 62 |
# File 'lib/strawberry_api/client/libraries.rb', line 60 def delete_library(id:) delete("/library_ingests/#{id}").success? end |
#libraries ⇒ Array<StrawberryAPI::Library>
Fetches all libraries
10 11 12 13 14 |
# File 'lib/strawberry_api/client/libraries.rb', line 10 def libraries get("/library_ingests").parse['array']&.map do |library| Library.new(library) end end |
#library(id: nil, project_id: nil) ⇒ StrawberryAPI::Library
Fetches a library
22 23 24 25 26 |
# File 'lib/strawberry_api/client/libraries.rb', line 22 def library(id: nil, project_id: nil) libraries.find do |library| library.id == id.to_i || library.project_id == project_id.to_i end end |