class Dspace::Community

Attributes

collections[R]
count_items[R]
expand[R]
handle[R]
id[R]
introductory_text[RW]
name[RW]
parent_community[R]
short_description[RW]
sidebar_text[RW]
sub_communities[R]
type[R]

Public Class Methods

new(args={}) click to toggle source
# 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

Public Instance Methods

to_h() click to toggle source
# 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

Private Instance Methods

obj2hash(list) click to toggle source
# File lib/dspace/community.rb, line 50
def obj2hash(list)
  Dspace::Builders::HashBuilder.models2hash list if list.is_a? Array
end