restful_objects 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/restful_objects.rb +1 -2
- data/lib/restful_objects/domain_model/domain_model.rb +14 -11
- data/lib/restful_objects/domain_model/helpers/link_generator.rb +102 -90
- data/lib/restful_objects/domain_model/mixins/object.rb +10 -13
- data/lib/restful_objects/domain_model/mixins/object_actions.rb +106 -117
- data/lib/restful_objects/domain_model/mixins/object_base.rb +175 -131
- data/lib/restful_objects/domain_model/mixins/object_collections.rb +58 -71
- data/lib/restful_objects/domain_model/mixins/object_macros.rb +20 -26
- data/lib/restful_objects/domain_model/mixins/object_properties.rb +85 -98
- data/lib/restful_objects/domain_model/mixins/service.rb +9 -17
- data/lib/restful_objects/domain_model/types/action_description.rb +80 -82
- data/lib/restful_objects/domain_model/types/collection_description.rb +39 -40
- data/lib/restful_objects/domain_model/types/domain_type.rb +102 -105
- data/lib/restful_objects/domain_model/types/parameter_description.rb +42 -47
- data/lib/restful_objects/domain_model/types/parameter_description_list.rb +9 -12
- data/lib/restful_objects/domain_model/types/property_description.rb +62 -64
- data/lib/restful_objects/router.rb +6 -0
- data/lib/restful_objects/router/base.rb +23 -32
- data/lib/restful_objects/router/domain_object_resources.rb +89 -94
- data/lib/restful_objects/router/domain_type_resources.rb +24 -29
- data/lib/restful_objects/router/supporting_resources.rb +26 -31
- data/lib/restful_objects/version.rb +1 -1
- data/spec/integration/domain-types_actions_spec.rb +1 -3
- data/spec/integration/domain-types_collections_spec.rb +1 -39
- data/spec/integration/domain-types_properties_spec.rb +1 -78
- data/spec/integration/domain-types_spec.rb +39 -0
- data/spec/integration/{server-root_spec.rb → homepage_spec.rb} +2 -3
- data/spec/integration/objects_actions_spec.rb +7 -0
- data/spec/integration/objects_collections_spec.rb +169 -0
- data/spec/integration/objects_properties_spec.rb +122 -0
- data/spec/{acceptance/generate_json_representations_spec.rb → integration/objects_spec.rb} +12 -4
- data/spec/unit/object_actions_spec.rb +5 -5
- data/spec/unit/object_collections_spec.rb +1 -1
- data/spec/unit/object_properties_spec.rb +6 -6
- data/spec/unit/object_spec.rb +9 -9
- data/spec/unit/service_spec.rb +5 -5
- metadata +54 -35
- data/spec/integration/domain_model_spec.rb +0 -35
- data/spec/unit/type_list_spec.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6daedde1839a6d282abef3882e0611a409206afc
|
4
|
+
data.tar.gz: b787995164e0c9beffde4e8cab005110daba1ffd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab0df304178a6f7b0a15915e13d9d8f84f279e454b1b59e374516ee6517523506d372058bd8a63fdd0fbcbc5aa78349840e24a648853c7aaabe91ea2ecb12152
|
7
|
+
data.tar.gz: d04efcf54e7e54c066117529ac0410efe3bc4c8b5cdfa56d65e8f926e0c789fb88a67c191dec05811c8aff0ce8fea076582729f6a18a98484ac781f9248cf0f6
|
data/lib/restful_objects.rb
CHANGED
@@ -54,7 +54,11 @@ module RestfulObjects
|
|
54
54
|
@types[name] = DomainType.new(name)
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
57
|
+
def get_homepage_representation_response
|
58
|
+
[HTTP_OK, { 'Content-Type' => 'application/json' }, get_homepage_representation.to_json]
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_homepage_representation
|
58
62
|
{ 'links' => [
|
59
63
|
link_to(:self, '/', :homepage),
|
60
64
|
link_to(:user, '/user', :user),
|
@@ -62,15 +66,15 @@ module RestfulObjects
|
|
62
66
|
link_to(:version, '/version', :version),
|
63
67
|
link_to(:domain_types, '/domain-types', :type_list)
|
64
68
|
],
|
65
|
-
'extensions' => {}
|
66
|
-
}.to_json
|
69
|
+
'extensions' => {} }
|
67
70
|
end
|
68
71
|
|
69
|
-
def
|
70
|
-
{ '
|
71
|
-
|
72
|
-
|
73
|
-
|
72
|
+
def get_version_representation_response
|
73
|
+
[HTTP_OK, { 'Content-Type' => 'application/json' }, get_version_representation.to_json]
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_version_representation
|
77
|
+
{ 'links' => [ link_to(:self, '/version', :version), link_to(:up, '/', :homepage) ],
|
74
78
|
'specVersion' => '1.0',
|
75
79
|
'optionalCapabilities' => {
|
76
80
|
'blobsClobs' => true,
|
@@ -79,8 +83,7 @@ module RestfulObjects
|
|
79
83
|
'protoPersistentObjects' => true,
|
80
84
|
'validateOnly' => false
|
81
85
|
},
|
82
|
-
'extensions' => {}
|
83
|
-
}.to_json
|
86
|
+
'extensions' => {} }
|
84
87
|
end
|
85
88
|
|
86
89
|
def get_user
|
@@ -130,7 +133,7 @@ module RestfulObjects
|
|
130
133
|
values = []
|
131
134
|
@services.each do |name, service|
|
132
135
|
element = link_to(:service, "/services/#{name}", :object, service_id: name)
|
133
|
-
element['title'] = service.
|
136
|
+
element['title'] = service.ro_title
|
134
137
|
values << element
|
135
138
|
end
|
136
139
|
values
|
@@ -1,104 +1,116 @@
|
|
1
|
-
module RestfulObjects
|
2
|
-
|
3
|
-
def link_to(rel, href, type, options = {})
|
4
|
-
link = {
|
5
|
-
'rel' => generate_rel(rel, options),
|
6
|
-
'href' => RestfulObjects::DomainModel.current.base_url + href,
|
7
|
-
'type' => generate_repr_type(type, options[:domain_type], options[:element_type]),
|
8
|
-
'method' => options[:method] || 'GET' }
|
1
|
+
module RestfulObjects::LinkGenerator
|
2
|
+
HTTP_OK = 200
|
9
3
|
|
10
|
-
|
4
|
+
def link_to(rel, href, type, options = {})
|
5
|
+
link = {
|
6
|
+
'rel' => generate_rel(rel, options),
|
7
|
+
'href' => RestfulObjects::DomainModel.current.base_url + href,
|
8
|
+
'type' => generate_repr_type(type, options[:domain_type], options[:element_type]),
|
9
|
+
'method' => options[:method] || 'GET' }
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
link['arguments'] = options[:arguments] if options[:arguments]
|
12
|
+
|
13
|
+
link
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
53
|
-
when :invoke
|
54
|
-
if options[:action]
|
55
|
-
'invoke;action="' + options[:action] + '"'
|
56
|
-
elsif options[:type_action]
|
57
|
-
'invoke;typeaction="' + options[:type_action] + '"'
|
58
|
-
else
|
59
|
-
raise 'option not found for invoke rel'
|
60
|
-
end
|
61
|
-
when :modify
|
62
|
-
'modify;property="' + options[:property] + '"'
|
63
|
-
when :remove_from
|
64
|
-
'remove-from;collection="' + options[:collection] + '"'
|
65
|
-
when :service
|
66
|
-
'service;serviceId="' + options[:service_id] + '"'
|
67
|
-
when :value
|
68
|
-
if options[:property]
|
69
|
-
'value;property="' + options[:property] + '"'
|
70
|
-
elsif options[:collection]
|
71
|
-
'value;collection="' + options[:collection] + '"'
|
72
|
-
else
|
73
|
-
raise 'option not found for value rel'
|
74
|
-
end
|
75
|
-
else
|
76
|
-
raise "rel invalid: #{rel}"
|
16
|
+
def generate_rel(rel, options = {})
|
17
|
+
if [:self, :up, :next, :previous, :icon, :help].include?(rel)
|
18
|
+
rel.to_s
|
19
|
+
elsif rel == :described_by
|
20
|
+
'describedby'
|
21
|
+
else
|
22
|
+
if [:action, :action_param, :collection, :delete, :domain_type, :domain_types, :element, :element_type, :persist,
|
23
|
+
:property, :return_type, :services, :update, :user, :version].include?(rel)
|
24
|
+
'urn:org.restfulobjects:rels/' + underscore_to_hyphen_string(rel)
|
25
|
+
else
|
26
|
+
'urn:org.restfulobjects:rels/' +
|
27
|
+
case rel
|
28
|
+
when :add_to
|
29
|
+
'add-to;collection="' + options[:collection] + '"'
|
30
|
+
when :attachment
|
31
|
+
'attachment;property="' + options[:property] + '"'
|
32
|
+
when :choice
|
33
|
+
if options[:property]
|
34
|
+
'choice;property="' + options[:property] + '"'
|
35
|
+
elsif options[:action]
|
36
|
+
'choice;action="' + options[:action] + '"'
|
37
|
+
elsif options[:param]
|
38
|
+
'choice;param="' + options[:param] + '"'
|
39
|
+
else
|
40
|
+
raise 'option not found for choice rel'
|
41
|
+
end
|
42
|
+
when :clear
|
43
|
+
'clear;property="' + options[:property] + '"'
|
44
|
+
when :details
|
45
|
+
if options[:property]
|
46
|
+
'details;property="' + options[:property] + '"'
|
47
|
+
elsif options[:collection]
|
48
|
+
'details;collection="' + options[:collection] + '"'
|
49
|
+
elsif options[:action]
|
50
|
+
'details;action="' + options[:action] + '"'
|
51
|
+
else
|
52
|
+
raise 'option not found for details rel'
|
77
53
|
end
|
54
|
+
when :invoke
|
55
|
+
if options[:action]
|
56
|
+
'invoke;action="' + options[:action] + '"'
|
57
|
+
elsif options[:type_action]
|
58
|
+
'invoke;typeaction="' + options[:type_action] + '"'
|
59
|
+
else
|
60
|
+
raise 'option not found for invoke rel'
|
61
|
+
end
|
62
|
+
when :modify
|
63
|
+
'modify;property="' + options[:property] + '"'
|
64
|
+
when :remove_from
|
65
|
+
'remove-from;collection="' + options[:collection] + '"'
|
66
|
+
when :service
|
67
|
+
'service;serviceId="' + options[:service_id] + '"'
|
68
|
+
when :value
|
69
|
+
if options[:property]
|
70
|
+
'value;property="' + options[:property] + '"'
|
71
|
+
elsif options[:collection]
|
72
|
+
'value;collection="' + options[:collection] + '"'
|
73
|
+
else
|
74
|
+
raise 'option not found for value rel'
|
75
|
+
end
|
76
|
+
else
|
77
|
+
raise "rel invalid: #{rel}"
|
78
78
|
end
|
79
|
-
end
|
80
79
|
end
|
80
|
+
end
|
81
|
+
end
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
def generate_repr_type(type, domain_type = nil, element_type = nil)
|
84
|
+
valid_repr = [:homepage, :user, :version, :list, :object, :object_property, :object_collection, :object_action,
|
85
|
+
:object_result, :action_result, :type_list, :domain_type, :property_description, :collection_description,
|
86
|
+
:action_description, :action_param_description, :type_action_result, :error, :services]
|
86
87
|
|
87
|
-
|
88
|
+
raise "repr-type invalid: #{type.to_s}" if not valid_repr.include?(type)
|
88
89
|
|
89
|
-
|
90
|
+
repr = 'application/json;profile="urn:org.restfulobjects:repr-types/' + underscore_to_hyphen_string(type) + '"'
|
90
91
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
if domain_type && [:object, :action].include?(type)
|
93
|
+
repr += ';x-ro-domain-type="' + domain_type + '"'
|
94
|
+
elsif element_type && [:object_collection, :action].include?(type)
|
95
|
+
repr +=';x-ro-element-type="' + element_type + '"'
|
96
|
+
end
|
96
97
|
|
97
|
-
|
98
|
-
|
98
|
+
repr
|
99
|
+
end
|
99
100
|
|
100
|
-
|
101
|
-
|
102
|
-
|
101
|
+
def underscore_to_hyphen_string(symbol)
|
102
|
+
symbol.to_s.sub('_', '-')
|
103
|
+
end
|
104
|
+
|
105
|
+
def ro_content_type_for_object(domain_type)
|
106
|
+
"application/json;profile=\"urn:org.restfulobjects:repr-types/object\";x-ro-domain-type=\"#{domain_type}\""
|
107
|
+
end
|
108
|
+
|
109
|
+
def ro_content_type_for_property
|
110
|
+
"application/json;profile=\"urn:org.restfulobjects:repr-types/object-property\""
|
111
|
+
end
|
112
|
+
|
113
|
+
def ro_content_type_for_object_collection(element_type)
|
114
|
+
"application/json;profile=\"urn:org.restfulobjects:repr-types/object-collection\";x-ro-element-type=\"#{element_type}\""
|
103
115
|
end
|
104
116
|
end
|
@@ -4,21 +4,18 @@ require_relative 'object_properties'
|
|
4
4
|
require_relative 'object_collections'
|
5
5
|
require_relative 'object_actions'
|
6
6
|
|
7
|
-
module RestfulObjects
|
8
|
-
|
9
|
-
include LinkGenerator
|
7
|
+
module RestfulObjects::Object
|
8
|
+
include RestfulObjects::LinkGenerator
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
def self.included(base)
|
11
|
+
RestfulObjects::DomainModel.current.register_type(base.name)
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
13
|
+
base.class_eval do
|
14
|
+
extend RestfulObjects::ObjectMacros
|
15
|
+
include RestfulObjects::ObjectBase
|
16
|
+
include RestfulObjects::ObjectProperties
|
17
|
+
include RestfulObjects::ObjectCollections
|
18
|
+
include RestfulObjects::ObjectActions
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
24
|
-
|
@@ -1,135 +1,124 @@
|
|
1
|
-
module RestfulObjects
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
rs_type.actions.each do |name, action|
|
6
|
-
members[name] = {
|
7
|
-
'memberType' => 'action',
|
8
|
-
'links' => [
|
9
|
-
!is_service ?
|
10
|
-
link_to(:details, "/objects/#{self.class.name}/#{object_id}/actions/#{name}", :object_action, action: name)
|
11
|
-
:
|
12
|
-
link_to(:details, "/services/#{self.class.name}/actions/#{name}", :object_action, action: name)
|
13
|
-
],
|
14
|
-
'extensions' => action.metadata
|
15
|
-
}
|
16
|
-
end
|
17
|
-
members
|
18
|
-
end
|
1
|
+
module RestfulObjects::ObjectActions
|
2
|
+
def ro_get_action_type(name)
|
3
|
+
ro_domain_type.actions[name]
|
4
|
+
end
|
19
5
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
6
|
+
def ro_get_action_response(name)
|
7
|
+
{ 'id' => name,
|
8
|
+
'parameters' => generate_parameters(name),
|
9
|
+
'links' => [ rs_action_link(name), rs_action_up_link, rs_invoke_link(name) ],
|
10
|
+
'extensions' => ro_get_action_type(name).metadata
|
11
|
+
}.to_json
|
12
|
+
end
|
27
13
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
14
|
+
def ro_parse_action_arguments(name, arguments, json)
|
15
|
+
result = []
|
16
|
+
ro_get_action_type(name).parameters.each do |name, parameter|
|
17
|
+
case parameter.type
|
18
|
+
when :int
|
19
|
+
result << arguments[name.to_s]['value'].to_i
|
20
|
+
else
|
21
|
+
result << arguments[name.to_s]['value']
|
35
22
|
end
|
36
|
-
parameters
|
37
23
|
end
|
24
|
+
result
|
25
|
+
end
|
38
26
|
|
39
|
-
|
40
|
-
raise 'action does not exists' if not rs_type.actions.include?(action)
|
41
|
-
action_description = rs_type.actions[action]
|
42
|
-
json == '' ? {} : arguments = JSON.parse(json)
|
43
|
-
parameters = []
|
44
|
-
action_description.parameters.each do |name, parameter|
|
45
|
-
case parameter.type
|
46
|
-
when :int
|
47
|
-
parameters << arguments[name.to_s]['value'].to_i
|
48
|
-
else
|
49
|
-
parameters << arguments[name.to_s]['value']
|
50
|
-
end
|
51
|
-
end
|
27
|
+
def ro_encode_action_result
|
52
28
|
|
53
|
-
|
29
|
+
end
|
30
|
+
|
31
|
+
def ro_invoke_action_and_get_response(name, json)
|
32
|
+
raise 'action does not exists' unless ro_get_action_type(name)
|
33
|
+
|
34
|
+
arguments = json == '' ? {} : JSON.parse(json)
|
35
|
+
|
36
|
+
result = send(name, *ro_parse_action_arguments(name, arguments, json))
|
54
37
|
|
55
|
-
|
56
|
-
|
38
|
+
action_link = link_to(:self, "/objects/#{self.class.name}/#{object_id}/actions/#{name}/invoke", :action_result)
|
39
|
+
action_link['arguments'] = arguments
|
57
40
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
'extensions' => { }
|
64
|
-
},
|
41
|
+
response = {
|
42
|
+
'links' => [ action_link ],
|
43
|
+
'resultType' => 'scalar',
|
44
|
+
'result' => {
|
45
|
+
'links' => [],
|
65
46
|
'extensions' => { }
|
66
|
-
}
|
67
|
-
|
68
|
-
|
69
|
-
if result.nil?
|
70
|
-
response['result'] = nil
|
71
|
-
else
|
72
|
-
case action_description.kind_result_type
|
73
|
-
when :scalar
|
74
|
-
response['resultType'] = 'scalar'
|
75
|
-
response['result']['value'] = encode_value(result, action_description.result_type)
|
76
|
-
response['result']['links'] = [ link_to(:return_type, '/domain-types/int', :domain_type) ]
|
77
|
-
when :object
|
78
|
-
response['resultType'] = 'object'
|
79
|
-
response['result'] = result.representation
|
80
|
-
when :proto_object
|
81
|
-
response['resultType'] = 'object'
|
82
|
-
response['result'] = result
|
83
|
-
when :list
|
84
|
-
response['resultType'] = 'list'
|
85
|
-
response['result']['links'] =
|
86
|
-
[ link_to(:element_type, "/domain-types/#{action_description.result_type.to_s}", :domain_type) ]
|
87
|
-
list = []
|
88
|
-
result.each do |member|
|
89
|
-
member_link = link_to(:element, "/objects/#{action_description.result_type.to_s}/#{member.rs_instance_id}", :object)
|
90
|
-
member_link['title'] = member.title
|
91
|
-
list << member_link
|
92
|
-
end
|
93
|
-
response['result']['value'] = list
|
94
|
-
end
|
95
|
-
end
|
47
|
+
},
|
48
|
+
'extensions' => { }
|
49
|
+
}
|
96
50
|
|
97
|
-
|
51
|
+
response['resultType'] = ro_get_action_type(name).kind_result_type.to_s
|
52
|
+
if result.nil?
|
53
|
+
response['result'] = nil
|
54
|
+
else
|
55
|
+
case ro_get_action_type(name).kind_result_type
|
56
|
+
when :scalar
|
57
|
+
response['resultType'] = 'scalar'
|
58
|
+
response['result']['value'] = encode_value(result, ro_get_action_type(name).result_type)
|
59
|
+
response['result']['links'] = [ link_to(:return_type, '/domain-types/int', :domain_type) ]
|
60
|
+
when :object
|
61
|
+
response['resultType'] = 'object'
|
62
|
+
response['result'] = result.ro_get_representation
|
63
|
+
when :proto_object
|
64
|
+
response['resultType'] = 'object'
|
65
|
+
response['result'] = result
|
66
|
+
when :list
|
67
|
+
response['resultType'] = 'list'
|
68
|
+
response['result']['links'] =
|
69
|
+
[ link_to(:element_type, "/domain-types/#{ro_get_action_type(name).result_type.to_s}", :domain_type) ]
|
70
|
+
list = []
|
71
|
+
result.each do |member|
|
72
|
+
member_link = link_to(:element, "/objects/#{ro_get_action_type(name).result_type.to_s}/#{member.ro_instance_id}", :object)
|
73
|
+
member_link['title'] = member.ro_title
|
74
|
+
list << member_link
|
75
|
+
end
|
76
|
+
response['result']['value'] = list
|
77
|
+
end
|
98
78
|
end
|
99
79
|
|
100
|
-
|
101
|
-
|
80
|
+
response.to_json
|
81
|
+
end
|
82
|
+
|
83
|
+
# def action_return_type(name)
|
84
|
+
# ro_get_action_type(name).result_type
|
85
|
+
# end
|
86
|
+
|
87
|
+
protected
|
88
|
+
|
89
|
+
def generate_parameters(action_name)
|
90
|
+
result = {}
|
91
|
+
ro_get_action_type(action_name).parameters.each do |name, parameter|
|
92
|
+
result[name] = { 'links' => [], 'extensions' => parameter.metadata }
|
102
93
|
end
|
94
|
+
result
|
95
|
+
end
|
103
96
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
invoke_link
|
116
|
-
end
|
97
|
+
def rs_invoke_link(action)
|
98
|
+
invoke_link = ro_is_service? ?
|
99
|
+
link_to(:invoke, "/services/#{ro_domain_type.id}/actions/#{action}/invoke", :action_result, action: action)
|
100
|
+
:
|
101
|
+
link_to(:invoke, "/objects/#{ro_domain_type.id}/#{object_id}/actions/#{action}/invoke", :action_result, action: action)
|
102
|
+
invoke_link['arguments'] = {}
|
103
|
+
ro_domain_type.actions[action].parameters.each do |name, action|
|
104
|
+
invoke_link['arguments'][name] = { 'value' => nil }
|
105
|
+
end
|
106
|
+
invoke_link
|
107
|
+
end
|
117
108
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
109
|
+
def rs_action_link(action)
|
110
|
+
if ro_is_service?
|
111
|
+
link_to(:self, "/services/#{self.class.name}/actions/#{action}", :object_action)
|
112
|
+
else
|
113
|
+
link_to(:self, "/objects/#{self.class.name}/#{object_id}/actions/#{action}", :object_action)
|
114
|
+
end
|
115
|
+
end
|
125
116
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
end
|
117
|
+
def rs_action_up_link
|
118
|
+
if ro_is_service?
|
119
|
+
link_to(:up, "/services/#{ro_domain_type.id}", :object)
|
120
|
+
else
|
121
|
+
link_to(:up, "/objects/#{self.class.name}/#{object_id}", :object)
|
122
|
+
end
|
133
123
|
end
|
134
124
|
end
|
135
|
-
|