Class: Dgrid::API::Link

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

Instance Attribute Summary collapse

Attributes inherited from Entity

#description, #id, #workspaces

Class Method Summary collapse

Instance Method Summary collapse

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

included

Constructor Details

#initialize(options) ⇒ Link

Returns a new instance of Link.



15
16
17
18
19
20
# File 'lib/dgrid/api/link.rb', line 15

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

Instance Attribute Details

#auto_linkedObject (readonly)

Returns the value of attribute auto_linked.



6
7
8
# File 'lib/dgrid/api/link.rb', line 6

def auto_linked
  @auto_linked
end

#descriptoionObject

Returns the value of attribute descriptoion.



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

def descriptoion
  @descriptoion
end

#left_guidObject

Returns the value of attribute left_guid.



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

def left_guid
  @left_guid
end

#left_typeObject

Returns the value of attribute left_type.



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

def left_type
  @left_type
end

#right_guidObject

Returns the value of attribute right_guid.



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

def right_guid
  @right_guid
end

#right_typeObject

Returns the value of attribute right_type.



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

def right_type
  @right_type
end

Class Method Details

.db_fieldsObject



22
23
24
# File 'lib/dgrid/api/link.rb', line 22

def self.db_fields
  %w(id description auto_linked left_type left_guid left_id right_type right_guid right_id)
end

.pluralizedObject



26
27
28
# File 'lib/dgrid/api/link.rb', line 26

def self.pluralized
  'links'
end

Instance Method Details

#to_hashObject



30
31
32
33
34
35
36
37
# File 'lib/dgrid/api/link.rb', line 30

def to_hash
	h = { :description => description,
        :left_type => left_type,
        :left_guid => left_guid,
        :right_type => right_type,
        :right_guid => right_guid
      }
end