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.59 lib/atlas_rb/file_set.rb
atlas_rb-0.0.58 lib/atlas_rb/file_set.rb
atlas_rb-0.0.57 lib/atlas_rb/file_set.rb
atlas_rb-0.0.56 lib/atlas_rb/file_set.rb
atlas_rb-0.0.54 lib/atlas_rb/file_set.rb
atlas_rb-0.0.53 lib/atlas_rb/file_set.rb
atlas_rb-0.0.52 lib/atlas_rb/file_set.rb
atlas_rb-0.0.51 lib/atlas_rb/file_set.rb
atlas_rb-0.0.49 lib/atlas_rb/file_set.rb
atlas_rb-0.0.48 lib/atlas_rb/file_set.rb
atlas_rb-0.0.47 lib/atlas_rb/file_set.rb
atlas_rb-0.0.46 lib/atlas_rb/file_set.rb
atlas_rb-0.0.45 lib/atlas_rb/file_set.rb
atlas_rb-0.0.42 lib/atlas_rb/file_set.rb
atlas_rb-0.0.41 lib/atlas_rb/file_set.rb
atlas_rb-0.0.40 lib/atlas_rb/file_set.rb
atlas_rb-0.0.39 lib/atlas_rb/file_set.rb
atlas_rb-0.0.38 lib/atlas_rb/file_set.rb
atlas_rb-0.0.37 lib/atlas_rb/file_set.rb
atlas_rb-0.0.36 lib/atlas_rb/file_set.rb