Class: RestfulObjects::TypeList
- Inherits:
-
Object
- Object
- RestfulObjects::TypeList
show all
- Extended by:
- Forwardable
- Includes:
- LinkGenerator
- Defined in:
- lib/restful_objects/type_list.rb
Instance Method Summary
collapse
#generate_rel, #generate_repr_type, #link_to, #underscore_to_hyphen_string
Constructor Details
6
7
8
|
# File 'lib/restful_objects/type_list.rb', line 6
def initialize
@types = Hash.new
end
|
Instance Method Details
#add(name) ⇒ Object
10
11
12
|
# File 'lib/restful_objects/type_list.rb', line 10
def add(name)
@types[name] = Type.new(name)
end
|
#get_representation ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/restful_objects/type_list.rb', line 14
def get_representation
response = {
'links' => [
link_to(:self, '/domain-types', :type_list),
link_to(:up, '/', :homepage),
],
'value' => []
}
each { |name, type| response['value'] << link_to(:domain_type, "/domain-types/#{name}", :domain_type) }
response.to_json
end
|