Class: Dgrid::API::Keyword
- Inherits:
-
NamedEntity
- Object
- Entity
- NamedEntity
- Dgrid::API::Keyword
- Defined in:
- lib/dgrid/api/keyword.rb
Instance Attribute Summary collapse
-
#synonyms ⇒ Object
Returns the value of attribute synonyms.
-
#triggers_alert ⇒ Object
Returns the value of attribute triggers_alert.
Attributes inherited from NamedEntity
Attributes inherited from Entity
#description, #id, #workspaces
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Keyword
constructor
A new instance of Keyword.
- #to_hash ⇒ Object
Methods inherited from Entity
#add_entity, #add_workspace, #attach, #connection, #first_workspace, #in_workspace?, #link_to, #new_record?, singular, #type, type
Methods included from SetMembersFromHash
#change_string_keys_to_symbol_keys, #set_members_from_hash, #split_hash
Methods included from Dgrid::ArgumentValidation
Constructor Details
#initialize(options) ⇒ Keyword
Returns a new instance of Keyword.
11 12 13 14 15 16 |
# File 'lib/dgrid/api/keyword.rb', line 11 def initialize() parent_opts, my_opts = split_hash(,[:id, :name]) super(parent_opts) set_members_from_hash(my_opts) end |
Instance Attribute Details
#synonyms ⇒ Object
Returns the value of attribute synonyms.
4 5 6 |
# File 'lib/dgrid/api/keyword.rb', line 4 def synonyms @synonyms end |
#triggers_alert ⇒ Object
Returns the value of attribute triggers_alert.
5 6 7 |
# File 'lib/dgrid/api/keyword.rb', line 5 def triggers_alert @triggers_alert end |
Class Method Details
.db_fields ⇒ Object
18 19 20 |
# File 'lib/dgrid/api/keyword.rb', line 18 def self.db_fields %w(id name synonyms triggers_alert) end |
.pluralized ⇒ Object
31 32 33 |
# File 'lib/dgrid/api/keyword.rb', line 31 def self.pluralized 'keywords' end |
Instance Method Details
#to_hash ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/dgrid/api/keyword.rb', line 22 def to_hash h = super h.delete(:description) h.merge!( { :synonyms => synonyms, :triggers_alert => triggers_alert }) h end |