Sha256: 1d72e5de35ada3a5e7ba216bf185e7210d9671616e59b390286510902b8c563b
Contents?: true
Size: 884 Bytes
Versions: 5
Compression:
Stored size: 884 Bytes
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 end end
Version data entries
5 entries across 5 versions & 1 rubygems