vidibus-resource 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md
CHANGED
@@ -6,7 +6,7 @@ class Api::ResourcesController < ApiController
|
|
6
6
|
# Creates resource consumer on provider.
|
7
7
|
def create
|
8
8
|
@instance.add_resource_consumer(params["service"])
|
9
|
-
render(:json => {:resource => @instance.
|
9
|
+
render(:json => {:resource => JSON.generate(@instance.resourceable_hash)})
|
10
10
|
end
|
11
11
|
|
12
12
|
# Updates resource on consumer.
|
@@ -23,9 +23,8 @@ module Vidibus::Resource
|
|
23
23
|
|
24
24
|
# Registers this consumer with provider.
|
25
25
|
def add_resource_consumer
|
26
|
-
response =
|
27
|
-
|
28
|
-
self.resource_attributes = fix_resource_attributes(data)
|
26
|
+
response = register_resource_consumer
|
27
|
+
self.resource_attributes = JSON.parse(response["resource"])
|
29
28
|
set_resource_attributes(true)
|
30
29
|
true # ensure true!
|
31
30
|
end
|
@@ -98,6 +97,10 @@ module Vidibus::Resource
|
|
98
97
|
|
99
98
|
private
|
100
99
|
|
100
|
+
def register_resource_consumer
|
101
|
+
resource_provider.post("/api/resources/#{self.class.to_s.tableize}/#{uuid}")
|
102
|
+
end
|
103
|
+
|
101
104
|
module ClassMethods
|
102
105
|
|
103
106
|
# Sets up resource provider service type and realm.
|
@@ -16,8 +16,10 @@ module Vidibus::Resource
|
|
16
16
|
# Adds given resource consumer.
|
17
17
|
def add_resource_consumer(service_uuid)
|
18
18
|
list = resource_consumers || []
|
19
|
-
list
|
20
|
-
|
19
|
+
unless list.include?(service_uuid)
|
20
|
+
list << service_uuid
|
21
|
+
update_attributes(:resource_consumers => list.uniq)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
# Removes given resource consumer.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andre Pankratz
|