dspace_rest_client 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dspace_client.rb +64 -64
- data/lib/dspace_rest_client.rb +17 -17
- data/lib/dspacerest/bitstream.rb +51 -51
- data/lib/dspacerest/builders/hash_builder.rb +18 -16
- data/lib/dspacerest/builders/model_builder.rb +61 -61
- data/lib/dspacerest/collection.rb +60 -60
- data/lib/dspacerest/community.rb +57 -57
- data/lib/dspacerest/item.rb +70 -71
- data/lib/dspacerest/metadata.rb +17 -17
- data/lib/dspacerest/policy.rb +41 -41
- data/lib/dspacerest/repositories/abstract_repository.rb +37 -20
- data/lib/dspacerest/repositories/bitstream_repository.rb +62 -58
- data/lib/dspacerest/repositories/collection_repository.rb +78 -73
- data/lib/dspacerest/repositories/community_repository.rb +76 -72
- data/lib/dspacerest/repositories/dspace_repository.rb +26 -26
- data/lib/dspacerest/repositories/item_repository.rb +80 -76
- data/lib/dspacerest/strategies/uploads/curl_strategy.rb +26 -26
- data/lib/dspacerest/strategies/uploads/rest_strategy.rb +16 -16
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2f83ca04d0ba0ceac01dbb9427a9a1aa7b777dd
|
4
|
+
data.tar.gz: 404728373c56cacdd8face45b875f50aebe5dfeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8667ed334ae8f31aa0ca970243235a839e2bf184af32aed1b5759c8ced3a5fdb0e62ad983cbf96cf05c8d1f54ff02cce2a2e3ccd20aa028bf061f4772df58820
|
7
|
+
data.tar.gz: 8a5b6e03db7f815060913e6e93533d6a328a96ba72f46ac8b8bb2973cdddf1aea135c25e896a79a6a5798beac808938da1c267f9cc7fcc78d3551f627ef73ffd
|
data/lib/dspace_client.rb
CHANGED
@@ -1,64 +1,64 @@
|
|
1
|
-
require 'rest-client'
|
2
|
-
|
3
|
-
class DspaceClient
|
4
|
-
attr_reader :rest_client, :url
|
5
|
-
|
6
|
-
def initialize(url, authenticated_token = nil)
|
7
|
-
@url = url
|
8
|
-
|
9
|
-
if (authenticated_token.nil?)
|
10
|
-
@rest_client = build_rest_client url
|
11
|
-
else
|
12
|
-
@rest_client = build_rest_client url, rest_dspace_token: authenticated_token
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def repository
|
17
|
-
@dspace_repository ||= build_repository @rest_client
|
18
|
-
end
|
19
|
-
|
20
|
-
def login(username, password)
|
21
|
-
user = JSON.generate({
|
22
|
-
email: username,
|
23
|
-
password: password
|
24
|
-
})
|
25
|
-
|
26
|
-
# send login request to server and receive the token
|
27
|
-
authenticated_token = @rest_client['/login'].post user
|
28
|
-
|
29
|
-
# overwrite the rest_client and dspace_repository
|
30
|
-
@rest_client = build_rest_client @url, rest_dspace_token: authenticated_token
|
31
|
-
@dspace_repository = build_repository @rest_client
|
32
|
-
|
33
|
-
authenticated_token
|
34
|
-
end
|
35
|
-
|
36
|
-
def logout
|
37
|
-
response = JSON.parse @rest_client['/logout'].post []
|
38
|
-
end
|
39
|
-
|
40
|
-
def status
|
41
|
-
response = JSON.parse @rest_client['/status'].get
|
42
|
-
end
|
43
|
-
|
44
|
-
def test
|
45
|
-
response = JSON.parse(@rest_client['/test'].get)
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def build_repository(rest_client)
|
51
|
-
DSpaceRest::Repositories::DspaceRepository.new rest_client
|
52
|
-
end
|
53
|
-
|
54
|
-
def build_rest_client(url, headers={})
|
55
|
-
RestClient::Resource.new(url,
|
56
|
-
verify_ssl: OpenSSL::SSL::VERIFY_NONE,
|
57
|
-
headers: headers.merge(
|
58
|
-
content_type: :json,
|
59
|
-
accept: :json
|
60
|
-
)
|
61
|
-
)
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
class DspaceClient
|
4
|
+
attr_reader :rest_client, :url
|
5
|
+
|
6
|
+
def initialize(url, authenticated_token = nil)
|
7
|
+
@url = url
|
8
|
+
|
9
|
+
if (authenticated_token.nil?)
|
10
|
+
@rest_client = build_rest_client url
|
11
|
+
else
|
12
|
+
@rest_client = build_rest_client url, rest_dspace_token: authenticated_token
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def repository
|
17
|
+
@dspace_repository ||= build_repository @rest_client
|
18
|
+
end
|
19
|
+
|
20
|
+
def login(username, password)
|
21
|
+
user = JSON.generate({
|
22
|
+
email: username,
|
23
|
+
password: password
|
24
|
+
})
|
25
|
+
|
26
|
+
# send login request to server and receive the token
|
27
|
+
authenticated_token = @rest_client['/login'].post user
|
28
|
+
|
29
|
+
# overwrite the rest_client and dspace_repository
|
30
|
+
@rest_client = build_rest_client @url, rest_dspace_token: authenticated_token
|
31
|
+
@dspace_repository = build_repository @rest_client
|
32
|
+
|
33
|
+
authenticated_token
|
34
|
+
end
|
35
|
+
|
36
|
+
def logout
|
37
|
+
response = JSON.parse @rest_client['/logout'].post []
|
38
|
+
end
|
39
|
+
|
40
|
+
def status
|
41
|
+
response = JSON.parse @rest_client['/status'].get
|
42
|
+
end
|
43
|
+
|
44
|
+
def test
|
45
|
+
response = JSON.parse(@rest_client['/test'].get)
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def build_repository(rest_client)
|
51
|
+
DSpaceRest::Repositories::DspaceRepository.new rest_client
|
52
|
+
end
|
53
|
+
|
54
|
+
def build_rest_client(url, headers={})
|
55
|
+
RestClient::Resource.new(url,
|
56
|
+
verify_ssl: OpenSSL::SSL::VERIFY_NONE,
|
57
|
+
headers: headers.merge(
|
58
|
+
content_type: :json,
|
59
|
+
accept: :json
|
60
|
+
)
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
data/lib/dspace_rest_client.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
# More logical way to require 'dspace-rest-client'
|
2
|
-
require File.dirname(__FILE__) + '/dspace_client'
|
3
|
-
require File.dirname(__FILE__) + '/dspacerest/bitstream'
|
4
|
-
require File.dirname(__FILE__) + '/dspacerest/collection'
|
5
|
-
require File.dirname(__FILE__) + '/dspacerest/community'
|
6
|
-
require File.dirname(__FILE__) + '/dspacerest/item'
|
7
|
-
require File.dirname(__FILE__) + '/dspacerest/metadata'
|
8
|
-
require File.dirname(__FILE__) + '/dspacerest/repositories/abstract_repository'
|
9
|
-
require File.dirname(__FILE__) + '/dspacerest/repositories/bitstream_repository'
|
10
|
-
require File.dirname(__FILE__) + '/dspacerest/repositories/collection_repository'
|
11
|
-
require File.dirname(__FILE__) + '/dspacerest/repositories/community_repository'
|
12
|
-
require File.dirname(__FILE__) + '/dspacerest/repositories/dspace_repository'
|
13
|
-
require File.dirname(__FILE__) + '/dspacerest/repositories/item_repository'
|
14
|
-
require File.dirname(__FILE__) + '/dspacerest/strategies/uploads/curl_strategy'
|
15
|
-
require File.dirname(__FILE__) + '/dspacerest/strategies/uploads/rest_strategy'
|
16
|
-
require File.dirname(__FILE__) + '/dspacerest/builders/hash_builder'
|
17
|
-
require File.dirname(__FILE__) + '/dspacerest/builders/model_builder'
|
1
|
+
# More logical way to require 'dspace-rest-client'
|
2
|
+
require File.dirname(__FILE__) + '/dspace_client'
|
3
|
+
require File.dirname(__FILE__) + '/dspacerest/bitstream'
|
4
|
+
require File.dirname(__FILE__) + '/dspacerest/collection'
|
5
|
+
require File.dirname(__FILE__) + '/dspacerest/community'
|
6
|
+
require File.dirname(__FILE__) + '/dspacerest/item'
|
7
|
+
require File.dirname(__FILE__) + '/dspacerest/metadata'
|
8
|
+
require File.dirname(__FILE__) + '/dspacerest/repositories/abstract_repository'
|
9
|
+
require File.dirname(__FILE__) + '/dspacerest/repositories/bitstream_repository'
|
10
|
+
require File.dirname(__FILE__) + '/dspacerest/repositories/collection_repository'
|
11
|
+
require File.dirname(__FILE__) + '/dspacerest/repositories/community_repository'
|
12
|
+
require File.dirname(__FILE__) + '/dspacerest/repositories/dspace_repository'
|
13
|
+
require File.dirname(__FILE__) + '/dspacerest/repositories/item_repository'
|
14
|
+
require File.dirname(__FILE__) + '/dspacerest/strategies/uploads/curl_strategy'
|
15
|
+
require File.dirname(__FILE__) + '/dspacerest/strategies/uploads/rest_strategy'
|
16
|
+
require File.dirname(__FILE__) + '/dspacerest/builders/hash_builder'
|
17
|
+
require File.dirname(__FILE__) + '/dspacerest/builders/model_builder'
|
data/lib/dspacerest/bitstream.rb
CHANGED
@@ -1,51 +1,51 @@
|
|
1
|
-
module DSpaceRest
|
2
|
-
class Bitstream
|
3
|
-
|
4
|
-
attr_accessor :name, :bundle_name,
|
5
|
-
:description, :format, :mime_type
|
6
|
-
|
7
|
-
attr_reader :id, :type, :link, :size_bytes,
|
8
|
-
:parent_object, :retrieve_link, :check_sum,
|
9
|
-
:sequence_id, :policies
|
10
|
-
|
11
|
-
def initialize args
|
12
|
-
@id = args['id']
|
13
|
-
@name = args['name']
|
14
|
-
@type = args['type']
|
15
|
-
@link = args['link']
|
16
|
-
@bundle_name = args['bundleName']
|
17
|
-
@description = args['description']
|
18
|
-
@format = args['format']
|
19
|
-
@mime_type = args['mimeType']
|
20
|
-
@size_bytes = args['sizeBytes']
|
21
|
-
@parent_object = args['parentObject']
|
22
|
-
@retrieve_link = args['retrieveLink']
|
23
|
-
@check_sum = args['checkSum']
|
24
|
-
@sequence_id = args['sequenceId']
|
25
|
-
@policies = DSpaceRest::Builders::ModelBuilder.build_policies(args['policies'])
|
26
|
-
@expand = args['expand']
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_h
|
30
|
-
h = {
|
31
|
-
id: @id,
|
32
|
-
name: @name,
|
33
|
-
type: @type,
|
34
|
-
link: @link,
|
35
|
-
bundleName: @bundle_name,
|
36
|
-
description: @description,
|
37
|
-
format: @format,
|
38
|
-
mimeType: @mime_type,
|
39
|
-
sizeBytes: @size_bytes,
|
40
|
-
parentObject: @parent_object,
|
41
|
-
retrieveLink: @retrieve_link,
|
42
|
-
checkSum: @check_sum,
|
43
|
-
sequenceId: @sequence_id,
|
44
|
-
policies: @policies,
|
45
|
-
expand: @expand
|
46
|
-
}
|
47
|
-
|
48
|
-
h
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
1
|
+
module DSpaceRest
|
2
|
+
class Bitstream
|
3
|
+
|
4
|
+
attr_accessor :name, :bundle_name,
|
5
|
+
:description, :format, :mime_type
|
6
|
+
|
7
|
+
attr_reader :id, :type, :link, :size_bytes,
|
8
|
+
:parent_object, :retrieve_link, :check_sum,
|
9
|
+
:sequence_id, :policies
|
10
|
+
|
11
|
+
def initialize args
|
12
|
+
@id = args['id']
|
13
|
+
@name = args['name']
|
14
|
+
@type = args['type']
|
15
|
+
@link = args['link']
|
16
|
+
@bundle_name = args['bundleName']
|
17
|
+
@description = args['description']
|
18
|
+
@format = args['format']
|
19
|
+
@mime_type = args['mimeType']
|
20
|
+
@size_bytes = args['sizeBytes']
|
21
|
+
@parent_object = args['parentObject']
|
22
|
+
@retrieve_link = args['retrieveLink']
|
23
|
+
@check_sum = args['checkSum']
|
24
|
+
@sequence_id = args['sequenceId']
|
25
|
+
@policies = DSpaceRest::Builders::ModelBuilder.build_policies(args['policies'])
|
26
|
+
@expand = args['expand']
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_h
|
30
|
+
h = {
|
31
|
+
id: @id,
|
32
|
+
name: @name,
|
33
|
+
type: @type,
|
34
|
+
link: @link,
|
35
|
+
bundleName: @bundle_name,
|
36
|
+
description: @description,
|
37
|
+
format: @format,
|
38
|
+
mimeType: @mime_type,
|
39
|
+
sizeBytes: @size_bytes,
|
40
|
+
parentObject: @parent_object,
|
41
|
+
retrieveLink: @retrieve_link,
|
42
|
+
checkSum: @check_sum,
|
43
|
+
sequenceId: @sequence_id,
|
44
|
+
policies: @policies,
|
45
|
+
expand: @expand
|
46
|
+
}
|
47
|
+
|
48
|
+
h
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,16 +1,18 @@
|
|
1
|
-
module DSpaceRest
|
2
|
-
module Builders
|
3
|
-
module HashBuilder
|
4
|
-
|
5
|
-
def self.models2hash(list)
|
6
|
-
hash = []
|
7
|
-
list.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
1
|
+
module DSpaceRest
|
2
|
+
module Builders
|
3
|
+
module HashBuilder
|
4
|
+
|
5
|
+
def self.models2hash(list)
|
6
|
+
hash = []
|
7
|
+
unless list.nil?
|
8
|
+
list.each do |m|
|
9
|
+
hash << m.to_h
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
hash
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,61 +1,61 @@
|
|
1
|
-
module DSpaceRest
|
2
|
-
module Builders
|
3
|
-
module ModelBuilder
|
4
|
-
|
5
|
-
def self.build_communities(communities=[])
|
6
|
-
return communities if communities.nil?
|
7
|
-
colls = []
|
8
|
-
communities.each do |c|
|
9
|
-
colls << DSpaceRest::Community.new(c)
|
10
|
-
end
|
11
|
-
colls
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.build_collections(collections=[])
|
15
|
-
return collections if collections.nil?
|
16
|
-
colls = []
|
17
|
-
collections.each do |c|
|
18
|
-
colls << DSpaceRest::Collection.new(c)
|
19
|
-
end
|
20
|
-
colls
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.build_items(items=[])
|
24
|
-
return items if items.nil?
|
25
|
-
colls = []
|
26
|
-
items.each do |c|
|
27
|
-
colls << DSpaceRest::Item.new(c)
|
28
|
-
end
|
29
|
-
colls
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.build_bitstreams(bitstreams=[])
|
33
|
-
return bitstreams if bitstreams.nil?
|
34
|
-
colls = []
|
35
|
-
bitstreams.each do |c|
|
36
|
-
colls << DSpaceRest::Bitstream.new(c)
|
37
|
-
end
|
38
|
-
colls
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.build_metadatas(metadatas=[])
|
42
|
-
return metadatas if metadatas.nil?
|
43
|
-
colls = []
|
44
|
-
metadatas.each do |c|
|
45
|
-
colls << DSpaceRest::Metadata.new(c)
|
46
|
-
end
|
47
|
-
colls
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.build_policies(policies=[])
|
51
|
-
return policies if policies.nil?
|
52
|
-
colls = []
|
53
|
-
policies.each do |c|
|
54
|
-
colls << DSpaceRest::Policy.new(c)
|
55
|
-
end
|
56
|
-
colls
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
1
|
+
module DSpaceRest
|
2
|
+
module Builders
|
3
|
+
module ModelBuilder
|
4
|
+
|
5
|
+
def self.build_communities(communities=[])
|
6
|
+
return communities if communities.nil?
|
7
|
+
colls = []
|
8
|
+
communities.each do |c|
|
9
|
+
colls << DSpaceRest::Community.new(c)
|
10
|
+
end
|
11
|
+
colls
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.build_collections(collections=[])
|
15
|
+
return collections if collections.nil?
|
16
|
+
colls = []
|
17
|
+
collections.each do |c|
|
18
|
+
colls << DSpaceRest::Collection.new(c)
|
19
|
+
end
|
20
|
+
colls
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.build_items(items=[])
|
24
|
+
return items if items.nil?
|
25
|
+
colls = []
|
26
|
+
items.each do |c|
|
27
|
+
colls << DSpaceRest::Item.new(c)
|
28
|
+
end
|
29
|
+
colls
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.build_bitstreams(bitstreams=[])
|
33
|
+
return bitstreams if bitstreams.nil?
|
34
|
+
colls = []
|
35
|
+
bitstreams.each do |c|
|
36
|
+
colls << DSpaceRest::Bitstream.new(c)
|
37
|
+
end
|
38
|
+
colls
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.build_metadatas(metadatas=[])
|
42
|
+
return metadatas if metadatas.nil?
|
43
|
+
colls = []
|
44
|
+
metadatas.each do |c|
|
45
|
+
colls << DSpaceRest::Metadata.new(c)
|
46
|
+
end
|
47
|
+
colls
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.build_policies(policies=[])
|
51
|
+
return policies if policies.nil?
|
52
|
+
colls = []
|
53
|
+
policies.each do |c|
|
54
|
+
colls << DSpaceRest::Policy.new(c)
|
55
|
+
end
|
56
|
+
colls
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -1,61 +1,61 @@
|
|
1
|
-
module DSpaceRest
|
2
|
-
class Collection
|
3
|
-
|
4
|
-
attr_accessor :name, :logo, :license, :copyright_text,
|
5
|
-
:introductory_text, :short_description, :sidebar_text
|
6
|
-
|
7
|
-
attr_reader :id, :handle, :type, :link, :parent_community,
|
8
|
-
:parent_community_list, :items,
|
9
|
-
:number_items, :expand
|
10
|
-
|
11
|
-
def initialize args
|
12
|
-
@id = args['id']
|
13
|
-
@name = args['name']
|
14
|
-
@handle = args['handle']
|
15
|
-
@type = args['type']
|
16
|
-
@link = args['link']
|
17
|
-
@logo = args['logo']
|
18
|
-
@license = args['license']
|
19
|
-
@copyright_text = args['copyrightText']
|
20
|
-
@introductory_text = args['introductoryText']
|
21
|
-
@short_description = args['shortDescription']
|
22
|
-
@sidebar_text = args['sidebarText']
|
23
|
-
@number_items = args['numberItems']
|
24
|
-
@expand = args['expand']
|
25
|
-
|
26
|
-
@parent_community = DSpaceRest::Community.new(args['parentCommunity']) unless args['parentCommunity'].nil?
|
27
|
-
@parent_community_list = DSpaceRest::Builders::ModelBuilder.build_communities(args['parentCommunityList'])
|
28
|
-
@items = DSpaceRest::Builders::ModelBuilder.build_items(args['items'])
|
29
|
-
end
|
30
|
-
|
31
|
-
def to_h
|
32
|
-
h = {
|
33
|
-
id: @id,
|
34
|
-
name: @name,
|
35
|
-
handle: @handle,
|
36
|
-
type: @type,
|
37
|
-
link: @link,
|
38
|
-
logo: @logo,
|
39
|
-
parentCommunity: @parent_community,
|
40
|
-
parentCommunitList: @parent_community_list,
|
41
|
-
items: obj2hash(@items),
|
42
|
-
license: @license,
|
43
|
-
copyrightText: @copyright_text,
|
44
|
-
introductoryText: @introductory_text,
|
45
|
-
shortDescription: @short_description,
|
46
|
-
sidebarText: @sidebar_text,
|
47
|
-
numberItems: @number_items,
|
48
|
-
expand: @expand
|
49
|
-
}
|
50
|
-
|
51
|
-
h
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def obj2hash(list)
|
57
|
-
DSpaceRest::Builders::HashBuilder.models2hash list
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
1
|
+
module DSpaceRest
|
2
|
+
class Collection
|
3
|
+
|
4
|
+
attr_accessor :name, :logo, :license, :copyright_text,
|
5
|
+
:introductory_text, :short_description, :sidebar_text
|
6
|
+
|
7
|
+
attr_reader :id, :handle, :type, :link, :parent_community,
|
8
|
+
:parent_community_list, :items,
|
9
|
+
:number_items, :expand
|
10
|
+
|
11
|
+
def initialize args
|
12
|
+
@id = args['id']
|
13
|
+
@name = args['name']
|
14
|
+
@handle = args['handle']
|
15
|
+
@type = args['type']
|
16
|
+
@link = args['link']
|
17
|
+
@logo = args['logo']
|
18
|
+
@license = args['license']
|
19
|
+
@copyright_text = args['copyrightText']
|
20
|
+
@introductory_text = args['introductoryText']
|
21
|
+
@short_description = args['shortDescription']
|
22
|
+
@sidebar_text = args['sidebarText']
|
23
|
+
@number_items = args['numberItems']
|
24
|
+
@expand = args['expand']
|
25
|
+
|
26
|
+
@parent_community = DSpaceRest::Community.new(args['parentCommunity']) unless args['parentCommunity'].nil?
|
27
|
+
@parent_community_list = DSpaceRest::Builders::ModelBuilder.build_communities(args['parentCommunityList'])
|
28
|
+
@items = DSpaceRest::Builders::ModelBuilder.build_items(args['items'])
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_h
|
32
|
+
h = {
|
33
|
+
id: @id,
|
34
|
+
name: @name,
|
35
|
+
handle: @handle,
|
36
|
+
type: @type,
|
37
|
+
link: @link,
|
38
|
+
logo: @logo,
|
39
|
+
parentCommunity: @parent_community,
|
40
|
+
parentCommunitList: @parent_community_list,
|
41
|
+
items: obj2hash(@items),
|
42
|
+
license: @license,
|
43
|
+
copyrightText: @copyright_text,
|
44
|
+
introductoryText: @introductory_text,
|
45
|
+
shortDescription: @short_description,
|
46
|
+
sidebarText: @sidebar_text,
|
47
|
+
numberItems: @number_items,
|
48
|
+
expand: @expand
|
49
|
+
}
|
50
|
+
|
51
|
+
h
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def obj2hash(list)
|
57
|
+
DSpaceRest::Builders::HashBuilder.models2hash list
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
61
|
end
|