naranya_ecm-sdk 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0c8aaacc8e0fbc47e432d4d6a5f6ec004b124f4
|
4
|
+
data.tar.gz: 09b4b60c83199ec5ac43f4267fb41a3c9b3a2b1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e98869cbd0795b57246c48f20fb1ff50e8a201993e62c908dc6ca3b113bad42ff08a961afe492cacc29fb9890de2ead37045f99b60294092e62cdca3e5fe6c6
|
7
|
+
data.tar.gz: 731a62501dccff68974ddfc63b0ec84627e259ff436a242881173d4814238b34d54dfe089da425b397ce4ae67eef839d559624b337885126dabbcdd8d8554ec0
|
@@ -18,14 +18,18 @@ module NaranyaEcm
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def load_with_caching(attributes, remove_root = false, persisted = false)
|
21
|
-
|
21
|
+
if self.new?
|
22
|
+
load_without_caching(attributes, remove_root, persisted)
|
23
|
+
else
|
24
|
+
res = load_without_caching(attributes, remove_root = false, persisted = false)
|
25
|
+
|
26
|
+
cache_options = {}
|
27
|
+
cache_options[:expires_in] = 10.minutes unless self.updated_at.present? and self.updated_at.is_a? DateTime
|
28
|
+
|
29
|
+
NaranyaEcm.cache.write cache_key, @attributes, cache_options
|
22
30
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
NaranyaEcm.cache.write cache_key, @attributes, cache_options
|
27
|
-
|
28
|
-
res
|
31
|
+
res
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
module ClassMethods
|
@@ -4,17 +4,16 @@ module NaranyaEcm
|
|
4
4
|
module Models
|
5
5
|
class DownloadAuthorization < ActiveResource::Base
|
6
6
|
|
7
|
-
|
8
|
-
# Delegar el acceso tipo "Enumerable":
|
9
|
-
delegate :any?, to: :@attributes
|
10
|
-
|
11
|
-
# Re-establece el acceso tipo Hash:
|
12
|
-
delegate :[], to: :@attributes
|
13
|
-
delegate :[]=, to: :@attributes
|
14
|
-
self.site = "http://www.example.com"
|
7
|
+
include NaranyaEcm::Cache::Methods
|
15
8
|
|
9
|
+
class Tokens < HashWithIndifferentAccess
|
10
|
+
def initialize(*args)
|
11
|
+
super()
|
12
|
+
given_attrs = args.shift
|
13
|
+
given_attrs.each { |k,v| self[k] = v } unless given_attrs.nil?
|
14
|
+
end
|
16
15
|
def to_query_params
|
17
|
-
|
16
|
+
self.map { |key, value| "#{key}=#{value}" }.join '&'
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
@@ -30,17 +29,6 @@ module NaranyaEcm
|
|
30
29
|
|
31
30
|
belongs_to :media_resource, class_name: "naranya_ecm/models/media_resource"
|
32
31
|
|
33
|
-
def media_resource=(given_media_resource)
|
34
|
-
@attributes[:media_resource_id] = given_media_resource.id
|
35
|
-
end
|
36
|
-
|
37
|
-
def initialize(attributes = {}, persisted = false)
|
38
|
-
if given_media_resource = attributes.delete(:media_resource)
|
39
|
-
attributes[:media_resource_id] = given_media_resource.id
|
40
|
-
end
|
41
|
-
super
|
42
|
-
end
|
43
|
-
|
44
32
|
def authorized_url
|
45
33
|
unless @authorized_url
|
46
34
|
uri = URI(self.media_resource.downloadable_url)
|