Sha256: 8a9896056d17ec1dc5dca999803714b55c8d2caa72f5ab36a04cbbff4eb23122

Contents?: true

Size: 712 Bytes

Versions: 3

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true

module AtlasRb
  class Work < Resource
    ROUTE = "/works/"

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

    def self.create(id)
      # params[:collection_id]
      connection({ collection_id: id }).post(ROUTE)&.body
    end

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

    def self.update(id, xml_path)
      payload = { binary: Faraday::Multipart::FilePart.new(File.open(xml_path),
                                                           "application/xml",
                                                           File.basename(xml_path)) }
      multipart({}).patch(ROUTE + id, payload)&.body
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
atlas_rb-0.0.27 lib/atlas_rb/work.rb
atlas_rb-0.0.26 lib/atlas_rb/work.rb
atlas_rb-0.0.21 lib/atlas_rb/work.rb