naranya_ecm-sdk 0.0.10 → 0.0.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c9a175c239a31d8728e584d8b27a7148e1656f2
4
- data.tar.gz: c84ee0e576f09966b65dd13f2b69f76938045ffa
3
+ metadata.gz: ea0998e99cb07c88fd0e848be0c22cd4a5a4a819
4
+ data.tar.gz: 66abcbeff7670f31910337d152c6422b8a36ed14
5
5
  SHA512:
6
- metadata.gz: ad52b4d08347b041e6dc41eaa2bc872c07e4f0f5a44a18c0240ce87ec9f897b8b598efc42cce37d510d5c1665940fa3e8e07dbb9321abcfa5d3e52809c51a473
7
- data.tar.gz: 07fdf0be3095ab83d4e4da486bb5fcb2776db34a4e0533207671deb1d1639a290080d513a5f5a8549ff502de1dc3e47fe71dcf6b3edf29cec54c16d9a0e8f4a9
6
+ metadata.gz: fafd50c83e14296b89eafd626eef4c60be7e318a44dad6eb65ec9842cecb55696d05f6aa6e528e00663937341d14dcd2083651ddb46b1492048955c8a9b7be8a
7
+ data.tar.gz: ebaf50c25bec1094c1a334402693cabda2a2d17b6d787d4045c5687602b3a6e90c32ee2b06d4572997d888ff1a0f4286f20bd0934fee5ff3f9145828ae680ee3
@@ -7,6 +7,7 @@ module NaranyaEcm::Behaviors
7
7
  included do
8
8
  self.site = NaranyaEcm.options.site
9
9
  before_save :normalize_attributes
10
+ after_save :reload
10
11
  end
11
12
 
12
13
  def normalize_attributes
@@ -16,5 +17,6 @@ module NaranyaEcm::Behaviors
16
17
  .keys.each { |attribute_name| self.attributes.delete attribute_name }
17
18
 
18
19
  end
20
+
19
21
  end
20
22
  end
@@ -3,7 +3,7 @@ require 'active_resource'
3
3
  module NaranyaEcm::Models
4
4
  class Content < ::ActiveResource::Base
5
5
 
6
- #include ActiveModel::Dirty
6
+ include ActiveModel::Dirty
7
7
 
8
8
  include NaranyaEcm::Behaviors::Resourceable
9
9
 
@@ -41,7 +41,19 @@ module NaranyaEcm::Models
41
41
  if NaranyaEcm.options[:extra_attributes] && NaranyaEcm.options[:extra_attributes][:content]
42
42
  NaranyaEcm.options[:extra_attributes][:content].each { |key, val| attribute key, val }
43
43
  end
44
-
44
+
45
+ end
46
+
47
+ schema_attrs = self.schema.keys.map(&:to_sym)
48
+ define_attribute_methods(*schema_attrs)
49
+ schema_attrs.each do |attr_sym|
50
+ # getter:
51
+ define_method(attr_sym) { @attributes[attr_sym] }
52
+ # setter:
53
+ define_method("#{attr_sym}=".to_sym) do |value|
54
+ self.send "#{attr_sym}_will_change!".to_sym unless value == @attributes[attr_sym]
55
+ @attributes[attr_sym] = value
56
+ end
45
57
  end
46
58
 
47
59
  delegate :title, to: :title_translations
@@ -56,6 +68,16 @@ module NaranyaEcm::Models
56
68
 
57
69
  include NaranyaEcm::Behaviors::Timestampable
58
70
 
71
+ before_save :keywords_array!
72
+
73
+ def keywords_array!
74
+ unless self.attributes[:keywords].is_a?(Array)
75
+ self.attributes[:keywords] = if self.attributes[:keywords]=='' then []
76
+ else [self.attributes[:keywords]]
77
+ end
78
+ end
79
+ end
80
+
59
81
  #include NaranyaEcm::Lifecycles::ContentLifecycle
60
82
 
61
83
  end
@@ -1,3 +1,3 @@
1
1
  module NaranyaEcm
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naranya_ecm-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2014-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport