Sha256: 1d4fb50acb58ee50c21cbcd90aec000b327b1a293ecfb35db8ed246861cc0d98
Contents?: true
Size: 906 Bytes
Versions: 1
Compression:
Stored size: 906 Bytes
Contents
# frozen_string_literal: true module AtlasRb class Work < Resource ROUTE = "/works/" def self.find(id) JSON.parse(connection({}).get(ROUTE + id)&.body) end def self.create(id) # params[:collection_id] JSON.parse(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)) } JSON.parse(multipart({}).patch(ROUTE + id, payload)&.body) end def self.mods(id) # optional second argument for pure json response? JSON.parse(connection({}).get(ROUTE + id + '/mods.html')&.body) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
atlas_rb-0.0.30 | lib/atlas_rb/work.rb |