README.md 1.08 KB
Newer Older
1
# DSpace REST Client
2

3 4 5
## Installation

Add this line to your application's Gemfile:
6 7

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

11
And then execute:
12

13
    $ bundle
14

15
Or install it yourself as:
16

17
    $ gem install dspace_rest_client
18

19
## Get started
20

21
Some requests requires user authentication.
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
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
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.
45

46
## Contributing
47

48
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration.
49