README.md 1.08 KB
Newer Older
1
# DSpace REST Client
Mauricio Giacomini Girardello's avatar
Mauricio Giacomini Girardello committed
2

3 4 5
## Installation

Add this line to your application's Gemfile:
Mauricio Giacomini Girardello's avatar
Mauricio Giacomini Girardello committed
6 7

```ruby
8
gem 'dspace_rest_client'
9
```
10

11
And then execute:
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
12

13
    $ bundle
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
14

15
Or install it yourself as:
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
16

17
    $ gem install dspace_rest_client
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
18

19
## Get started
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
20

21
Some requests requires user authentication.
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
22

23 24 25 26 27 28 29
```ruby
require 'dspace'
client = Dspace::Client.new(dspace_api: 'https://demo.dspace.org/')

if !client.is_running?
  raise 'Can\'t connect to DSpace API.'
end
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
30

31 32 33 34 35
# authenticate
client.login 'dspacedemo+admin@gmail.com', 'dspace'

# create an community
client.communities.create(Dspace::Community.new({'name' => 'Testando'}))
36 37 38 39

# get a bitstream and your file
bitstream = client.bitstreams.find(id: 20, expand: 'parent')
file = client.bitstreams.retrieve(id: 20)
40 41 42
```

## Development
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
43

44
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
45

46
## Contributing
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
47

48
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration.
Bruno Nocera Zanette's avatar
Bruno Nocera Zanette committed
49