Class: Dspace::Collection

Inherits:
Object
  • Object
show all
Includes:
Builders::HashBuilder
Defined in:
lib/dspace/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Builders::HashBuilder

#obj2hash

Constructor Details

#initialize(args) ⇒ Collection

Returns a new instance of Collection.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/dspace/collection.rb', line 12

def initialize args
  @id = args['id']
  @name = args['name']
  @handle = args['handle']
  @type = args['type']
  @link = args['link']
  @logo = args['logo']
  @license = args['license']
  @copyright_text = args['copyrightText']
  @introductory_text = args['introductoryText']
  @short_description = args['shortDescription']
  @sidebar_text = args['sidebarText']
  @number_items = args['numberItems']
  @expand = args['expand']

  @parent_community = Dspace::Community.new(args['parentCommunity']) unless args['parentCommunity'].nil?
  @parent_community_list = Dspace::Builders::ModelBuilder.build_communities(args['parentCommunityList'])
  @items = Dspace::Builders::ModelBuilder.build_items(args['items'])
end

Instance Attribute Details

Returns the value of attribute copyright_text.



5
6
7
# File 'lib/dspace/collection.rb', line 5

def copyright_text
  @copyright_text
end

#expandObject (readonly)

Returns the value of attribute expand.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def expand
  @expand
end

#handleObject (readonly)

Returns the value of attribute handle.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def id
  @id
end

#introductory_textObject

Returns the value of attribute introductory_text.



5
6
7
# File 'lib/dspace/collection.rb', line 5

def introductory_text
  @introductory_text
end

#itemsObject (readonly)

Returns the value of attribute items.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def items
  @items
end

#licenseObject

Returns the value of attribute license.



5
6
7
# File 'lib/dspace/collection.rb', line 5

def license
  @license
end

Returns the value of attribute link.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def link
  @link
end

#logoObject

Returns the value of attribute logo.



5
6
7
# File 'lib/dspace/collection.rb', line 5

def 
  @logo
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/dspace/collection.rb', line 5

def name
  @name
end

#number_itemsObject (readonly)

Returns the value of attribute number_items.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def number_items
  @number_items
end

#parent_communityObject (readonly)

Returns the value of attribute parent_community.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def parent_community
  @parent_community
end

#parent_community_listObject (readonly)

Returns the value of attribute parent_community_list.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def parent_community_list
  @parent_community_list
end

#short_descriptionObject

Returns the value of attribute short_description.



5
6
7
# File 'lib/dspace/collection.rb', line 5

def short_description
  @short_description
end

Returns the value of attribute sidebar_text.



5
6
7
# File 'lib/dspace/collection.rb', line 5

def sidebar_text
  @sidebar_text
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/dspace/collection.rb', line 8

def type
  @type
end

Instance Method Details

#to_hObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/dspace/collection.rb', line 32

def to_h
  {
      id: @id,
      name: @name,
      handle: @handle,
      type: @type,
      link: @link,
      logo: @logo,
      parentCommunity: @parent_community,
      parentCommunitList: @parent_community_list,
      items: obj2hash(@items),
      license: @license,
      copyrightText: @copyright_text,
      introductoryText: @introductory_text,
      shortDescription: @short_description,
      sidebarText: @sidebar_text,
      numberItems: @number_items,
      expand: @expand
  }
end