Class: Dspace::Community

Inherits:
Object
  • Object
show all
Defined in:
lib/dspace/community.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Community

Returns a new instance of Community.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dspace/community.rb', line 10

def initialize(args={})
  @id = args['id']
  @name = args['name']
  @handle = args['handle']
  @type = args['type']
  @link = args['link']
  @logo = args['logo']
  @parent_community = Dspace::Community.new(args['parentCommunity']) unless args['parentCommunity'].nil?
  @copyright_text = args['copyrightText']
  @introductory_text = args['introductoryText']
  @short_description = args['shortDescription']
  @sidebar_text = args['sidebarText']
  @count_items = args['countItems']
  @sub_communities = Dspace::Builders::ModelBuilder.build_communities(args['subcommunities']) unless args['subcommunities'].nil?
  @collections = Dspace::Builders::ModelBuilder.build_collections(args['collections']) unless args['collections'].nil?
  @expand = args['expand']
end

Instance Attribute Details

#collectionsObject (readonly)

Returns the value of attribute collections.



7
8
9
# File 'lib/dspace/community.rb', line 7

def collections
  @collections
end

Returns the value of attribute copyright_text.



4
5
6
# File 'lib/dspace/community.rb', line 4

def copyright_text
  @copyright_text
end

#count_itemsObject (readonly)

Returns the value of attribute count_items.



7
8
9
# File 'lib/dspace/community.rb', line 7

def count_items
  @count_items
end

#expandObject (readonly)

Returns the value of attribute expand.



7
8
9
# File 'lib/dspace/community.rb', line 7

def expand
  @expand
end

#handleObject (readonly)

Returns the value of attribute handle.



7
8
9
# File 'lib/dspace/community.rb', line 7

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/dspace/community.rb', line 7

def id
  @id
end

#introductory_textObject

Returns the value of attribute introductory_text.



4
5
6
# File 'lib/dspace/community.rb', line 4

def introductory_text
  @introductory_text
end

Returns the value of attribute link.



7
8
9
# File 'lib/dspace/community.rb', line 7

def link
  @link
end

#logoObject

Returns the value of attribute logo.



4
5
6
# File 'lib/dspace/community.rb', line 4

def 
  @logo
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/dspace/community.rb', line 4

def name
  @name
end

#parent_communityObject (readonly)

Returns the value of attribute parent_community.



7
8
9
# File 'lib/dspace/community.rb', line 7

def parent_community
  @parent_community
end

#short_descriptionObject

Returns the value of attribute short_description.



4
5
6
# File 'lib/dspace/community.rb', line 4

def short_description
  @short_description
end

Returns the value of attribute sidebar_text.



4
5
6
# File 'lib/dspace/community.rb', line 4

def sidebar_text
  @sidebar_text
end

#sub_communitiesObject (readonly)

Returns the value of attribute sub_communities.



7
8
9
# File 'lib/dspace/community.rb', line 7

def sub_communities
  @sub_communities
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/dspace/community.rb', line 7

def type
  @type
end

Instance Method Details

#to_hObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dspace/community.rb', line 28

def to_h
  {
      id: @id,
      name: @name,
      handle: @handle,
      type: @type,
      link: @link,
      logo: @logo,
      parentCommunity: @parent_community,
      subcommunities: obj2hash(@sub_communities),
      collections: obj2hash(@collections),
      copyrightText: @copyright_text,
      introductoryText: @introductory_text,
      shortDescription: @short_description,
      sidebarText: @sidebar_text,
      countItems: @count_items,
      expand: @expand
  }
end