Commit 7a2196a3 authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette

Implement POST_item

parent 532be445
......@@ -34,7 +34,7 @@ module DSpaceRest
collections
end
def items
def get_items
response = @request["/collections/#{id}/items"].get
items = []
JSON.parse(response).each do |item|
......@@ -43,6 +43,18 @@ module DSpaceRest
items
end
def post_item(item)
array_metadata = []
item.metadata.each_value do |m|
array_metadata << m.to_h
end
rqst = JSON.generate({"metadata" => array_metadata})
response = @request["/collections/#{id}/items"].post rqst
Item.new(JSON.parse(response), @request)
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment