gnoso-remote_entity 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,22 +1,6 @@
|
|
1
1
|
module RemoteEntity
|
2
2
|
module EntityRecord
|
3
|
-
|
4
|
-
def self.included(base)
|
5
|
-
base.class_eval do
|
6
|
-
alias_method :old_to_xml, :to_xml
|
7
|
-
def to_xml(options = {})
|
8
|
-
if !options[:methods]
|
9
|
-
options[:methods] = [ :remote_entity_id ]
|
10
|
-
else
|
11
|
-
options[:methods] << :remote_entity_id
|
12
|
-
end
|
13
|
-
|
14
|
-
old_to_xml(options)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
3
|
|
19
|
-
attr_accessor :remote_entity_id
|
20
4
|
def remote_entity_id
|
21
5
|
if id
|
22
6
|
return "#{RemoteEntity.service}-#{self.class.name.underscore.gsub("/", "_")}-#{id}"
|
@@ -7,7 +7,7 @@ module RemoteEntity
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module ClassMethods
|
10
|
-
def
|
10
|
+
def belongs_to_remote(association_id, options = {})
|
11
11
|
if options[:class_name].nil?
|
12
12
|
options[:class_name] = association_id.to_s.camelize.to_sym
|
13
13
|
end
|
@@ -49,6 +49,12 @@ module RemoteEntity
|
|
49
49
|
def self.update_site
|
50
50
|
self.site = RemoteEntity.service_uri(self.service,
|
51
51
|
self.version)
|
52
|
+
api_key = RemoteEntity.lookup_service(self.service)[:api_key]
|
53
|
+
|
54
|
+
if !api_key.nil?
|
55
|
+
self.user = api_key
|
56
|
+
self.password = ""
|
57
|
+
end
|
52
58
|
end
|
53
59
|
end
|
54
60
|
end
|