Sha256: e64d9a343a88184a58f3bf54bacd3207c2629f8eda6233be2b848f6655f0e57f

Contents?: true

Size: 749 Bytes

Versions: 30

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

module AtlasRb
  class FileSet < Resource
    ROUTE = "/file_sets/"
  end

  def self.find(id)
    connection({}).get(ROUTE + id)&.body
  end

  def self.create(id, classification)
    connection({ work_id: id, classification: classification }).post(ROUTE)&.body
  end

  def self.destroy(id)
    connection({}).delete(ROUTE + id)
  end

  def self.update(id, blob_path)
    # Need to figure out blob vs XML
    payload = { binary: Faraday::Multipart::FilePart.new(File.open(blob_path),
                                                         "application/octet-stream",
                                                         File.basename(blob_path)) }
    multipart({}).patch(ROUTE + id, payload)&.body
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
atlas_rb-0.0.35 lib/atlas_rb/file_set.rb
atlas_rb-0.0.34 lib/atlas_rb/file_set.rb
atlas_rb-0.0.33 lib/atlas_rb/file_set.rb
atlas_rb-0.0.32 lib/atlas_rb/file_set.rb
atlas_rb-0.0.31 lib/atlas_rb/file_set.rb
atlas_rb-0.0.30 lib/atlas_rb/file_set.rb
atlas_rb-0.0.29 lib/atlas_rb/file_set.rb
atlas_rb-0.0.27 lib/atlas_rb/file_set.rb
atlas_rb-0.0.26 lib/atlas_rb/file_set.rb
atlas_rb-0.0.21 lib/atlas_rb/file_set.rb