Class: Dgrid::API::NamedEntity

Inherits:
Entity
  • Object
show all
Defined in:
lib/dgrid/api/named_entity.rb

Direct Known Subclasses

Incident, Item, Keyword, Lens, Organization, Person, Place

Instance Attribute Summary collapse

Attributes inherited from Entity

#description, #id, #workspaces

Instance Method Summary collapse

Methods inherited from Entity

#add_entity, #add_workspace, #attach, #connection, #first_workspace, #in_workspace?, #link_to, #new_record?, pluralized, singular, #type, type

Methods included from SetMembersFromHash

#change_string_keys_to_symbol_keys, #set_members_from_hash, #split_hash

Methods included from Dgrid::ArgumentValidation

included

Constructor Details

#initialize(options) ⇒ NamedEntity

Returns a new instance of NamedEntity.



8
9
10
11
12
# File 'lib/dgrid/api/named_entity.rb', line 8

def initialize(options)
	parent_opts, my_opts = split_hash(options,[:id, :description])
  super(parent_opts)
  set_members_from_hash(my_opts)
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/dgrid/api/named_entity.rb', line 5

def name
  @name
end

Instance Method Details

#to_hashObject



14
15
16
# File 'lib/dgrid/api/named_entity.rb', line 14

def to_hash
  { :name => name, :description => description }
end