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: 2ea93a84c6487716b367c31b4e0c416de8cdd281
4
- data.tar.gz: dff98318c7c4d3997dc0dc9fec891fcdf4ce8ac2
3
+ metadata.gz: b0c8aaacc8e0fbc47e432d4d6a5f6ec004b124f4
4
+ data.tar.gz: 09b4b60c83199ec5ac43f4267fb41a3c9b3a2b1f
5
5
  SHA512:
6
- metadata.gz: 4ee9589ea02b1d9491d55354942ba58989d9e01e9f018c360e0e48b20c2fe1bde4ce6cba5de6b0aa4d3cd5b90bbcc68b1651ceed878a0c2f0083d27025afcaa1
7
- data.tar.gz: 7850ded288a43ff49690f3c3813e1bac47639df640143b4107689dde841944ea7c2683714b628ccc704bb8cd12e2aa003266fd3c091b8a98f817aab3c7691874
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
- res = load_without_caching(attributes, remove_root = false, persisted = false)
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
- cache_options = {}
24
- cache_options[:expires_in] = 10.minutes unless self.updated_at.present? and self.updated_at.is_a? DateTime
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
- class Tokens < ::ActiveResource::Base
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
- @attributes.map { |key, value| "#{key}=#{value}" }.join '&'
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)
@@ -1,3 +1,3 @@
1
1
  module NaranyaEcm
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naranya_ecm-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla