change README

parent af34ca16
* To build:
$ gem build dspace-rest-client.gemspec
# DSpace REST Client
DSpace REST Client is a ruby gem that integrates DSpace servers with your application.
For now, the gem is under development, so some features are missing.
## Example of use:
Login
```ruby
require 'dspace-rest-client'
* To install:
$ gem install --local dspace-rest-client-0.0.1.gem
client = DspaceClient.new('https://demo.dspace.org/rest')
client.login 'dspacedemo+admin@gmail.com', 'dspace'
* Example script:
# check the status after authentication
puts client.status
```
#####################################################
List communities
```ruby
require 'dspace-rest-client'
dspaceurl='https://localhost:8443/rest'
client = DspaceClient.new('https://demo.dspace.org/rest')
community_repository = client.repository.community_repository
all_communities = community_repository.get_all_communities
# CREATE THE "REQUEST RESOURCE"
request = DSpaceRest::Client.new(:dspaceurl => dspaceurl)
all_communities.each do |c|
puts c.name
end
```
# LOGIN
request.login('admin@dspace.com','admin')
#### Bitstreams features:
- √ GET /bitstreams - Return all bitstreams in DSpace.
- √ GET /bitstreams/{bitstream id} - Return bitstream.
- GET /bitstreams/{bitstream id}/policy - Return bitstream policies.
- √ GET /bitstreams/{bitstream id}/retrieve - Return data of bitstream.
- POST /bitstreams/{bitstream id}/policy - Add policy to item. You must post a ResourcePolicy
- PUT /bitstreams/{bitstream id}/data - Update data/file of bitstream. You must put the data
- √ PUT /bitstreams/{bitstream id} - Update metadata of bitstream. You must put a Bitstream, does not alter the file/data
- DELETE /bitstreams/{bitstream id} - Delete bitstream from DSpace.
- DELETE /bitstreams/{bitstream id}/policy/{policy_id} - Delete bitstream policy.
# CREATE A NEW INSTANCE OF AN ITEM TO LATER USE IT AS AN
# ARGUMENT TO "POST_ITEM" REQUEST
new_item = request.new_item
new_item.set_metadata("dc.title","TESTING!!!","en_US")
new_item.set_metadata("dc.description","A BRIEF DESCRIPTION...","en_US")
#### Collections features:
- √ GET /communities/{communityId}/collections - Returns array of collections of community.
- √ GET /collections - Return all collections of DSpace in array.
- √ GET /collections/{collectionId} - Return collection with id.
- √ GET /collections/{collectionId}/items - Return all items of collection.
- √ POST /communities/{communityId}/collections - Create new collections in community. You must post Collection.
- √ POST /collections/{collectionId}/items - Create posted item in collection. You must post an Item
- POST /collections/find-collection - Find collection by passed name.
- PUT /collections/{collectionId} - Update collection. You must put Collection.
- DELETE /collections/{collectionId} - Delete collection from DSpace.
- DELETE /collections/{collectionId}/items/{itemId} - Delete item in collection.
- DELETE /communities/{communityId}/collections/{collectionId} - Delete collection in community.
# GETS THE COLLECTION THAT WILL STORE THE NEW ITEM
coll = request.get_collection(1)
#### Community features:
- √ GET /communities - Returns array of all communities in DSpace.
- √ GET /communities/top-communities - Returns array of all top communities in DSpace
- √ GET /communities/{communityId} - Returns community
- √ GET /communities/{communityId}/communities - Returns array of subcommunities of community.
- √ POST /communities - Create new community at top level. You must post community.
- √ POST /communities/{communityId}/communities - Create new subcommunity in community. You must post Community.
- PUT /communities/{communityId} - Update community. You must put Community
- DELETE /communities/{communityId} - Delete community.
- DELETE /communities/{communityId}/communities/{communityId2} - Delete subcommunity in community.
# POST THE NEW ITEM
# "item" VARIABLE STORE THE INFO RETURNED BY DSPACE
# ALONG WITH ID, HANDLE, ...
item = coll.post_item(new_item)
#### Item features:
- √ GET /items - Return list of items.
- √ GET /items/{item id} - Return item.
- √ GET /items/{item id}/metadata - Return item metadata.
- √ GET /items/{item id}/bitstreams - Return item bitstreams.
- POST /items/find-by-metadata-field - Find items by metadata entry. You must post a MetadataEntry. DS-2501 - wrong SQL in REST /items/find-by-metadata-field CLOSED
- √ POST /items/{item id}/metadata - Add metadata to item. You must post an array of MetadataEntry
- √ POST /items/{item id}/bitstreams - Add bitstream to item. You must post a Bitstream
- √ PUT /items/{item id}/metadata - Update metadata in item. You must put a MetadataEntry
- √ DELETE /items/{item id} - Delete item.
- DELETE /items/{item id}/metadata - Clear item metadata.
- DELETE /items/{item id}/bitstreams/{bitstream id} - Delete item bitstream.
### Version
0.9.0
### Contributors
> - Mauricio Giacomini Girardello <mgg12@inf.ufpr.br>
> - Bruno Zanette <>
### Installation
You need compile the gem:
```sh
$ gem build dspace-rest-client.gemspec
```
# MODIFY INFO OF THE ITEM THAS HAS ALREADY BEEN POSTED
item.set_metadate("dc.title","NEW NAME, BECAUSE THE ACTUAL IS NOT GOOD")
item.set_metadata("dc.author","My Name")
item.put_metadata
To install:
```sh
gem install --local dspace-rest-client-0.9.0.gem
```
# POST A NEW BITSTREAM TO THE NEW ITEM
file = item.post_bitstream('file.pdf')
### Development
Want to contribute? Great!
...
# MODIFY ITEM INFO AND PUT IT ON DSPACE
file.name = "pdf1.pdf"
file.description = "Descrição do item..."
file.put_metadata
License
----
MIT
puts " --- NEW ITEM ID: #{item.id} ---"
#####################################################
**Free Software, Hell Yeah!**
\ No newline at end of file
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