Sha256: 1af0cb2f79b51d8ec729b86ce495282b50a0f2502771a1624056adb308a00613
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true module AtlasRb class Collection < Resource ROUTE = "/collections/" def self.find(id) JSON.parse(connection({}).get(ROUTE + id)&.body)["collection"] end def self.create(id) # params[:parent_id] JSON.parse(connection({ parent_id: id }).post(ROUTE)&.body)["collection"] end def self.destroy(id) connection({}).delete(ROUTE + id) end def self.children(id) JSON.parse(connection({}).get(ROUTE + id + '/children')&.body) 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.metadata(id, values) JSON.parse(connection({ metadata: values }).patch(ROUTE + id)&.body) end def self.mods(id) connection({}).get(ROUTE + id + '/mods.html')&.body end def self.xml(id) connection({}).get(ROUTE + id + '/mods')&.body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
atlas_rb-0.0.42 | lib/atlas_rb/collection.rb |