mongoid-kms 0.0.21 → 0.0.22

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: 5889640818fefd09ba8da7d2913101709824eb70
4
- data.tar.gz: 84db0216fc606c8f566c9e7fb144fff8e9eb4761
3
+ metadata.gz: cffedc1b6fdd40f2acea4724eb5cb66ed2b94bc2
4
+ data.tar.gz: f9cace49c7fcbaa841fb63227e4b092af17fce2f
5
5
  SHA512:
6
- metadata.gz: 8fd89f03c35e0689906b6e7db35bf41012f784b701b8f5ba6182d3b4cc79e9f33e0567a3c994425a1b56912f1d0c25d50fd6497cf20b37cbfc2f488033a1d790
7
- data.tar.gz: 432fd44f6222d35eed8b2491701b5426981869424b5dad7ac978cf3763f30851333e64e6bb40faca6e1a795b0e2503add1153bd6f3fbc5f06218d2c03a4c1bc4
6
+ metadata.gz: 7a12c1f303e1a6ff655b2aff35dc6aff21e133129834534999199abfa5af5e87535caaa493e7d4edcaf39cf87ff7a2305dff04b8cb5e7f8cca0e24d7ffc9ae03
7
+ data.tar.gz: 843812d2f3b1756cb8131f6ca9f38a224390d8a1921482b9c667875ad46d799584841d40e9caec255165b75184170cec21f7a00f5f15e66baa23749101238623
data/lib/mongoid/kms.rb CHANGED
@@ -9,10 +9,6 @@ module Mongoid
9
9
  included do
10
10
  class_attribute :kms_field_map
11
11
  self.kms_field_map ||= {}
12
-
13
- unless self.ancestors.include?(ActiveModel::Dirty)
14
- include ActiveModel::Dirty
15
- end
16
12
  end
17
13
 
18
14
  @configuration = {}
@@ -144,7 +140,7 @@ module Mongoid
144
140
  def secure_field(field_name, args)
145
141
  encrypted_field_name = get_encrypted_field_name(field_name)
146
142
 
147
- define_attribute_methods field_name.to_sym
143
+ create_dirty_methods field_name, field_name
148
144
  before_save :set_kms_values
149
145
 
150
146
  kms_field_map[field_name.to_s] = {context: args.delete(:context), type: args[:type]}
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Kms
3
- VERSION = "0.0.21"
3
+ VERSION = "0.0.22"
4
4
  end
5
5
  end
@@ -58,6 +58,21 @@ describe Mongoid::Kms do
58
58
 
59
59
  o = ExtendedClass.find(o.id)
60
60
  expect(o.additional_secure).to eq("wha!")
61
+ o.test_hash_crash
62
+ end
63
+
64
+ it "works fine with Mongoid + Hash" do
65
+ class TestHashClass
66
+ include Mongoid::Document
67
+ include Mongoid::Kms
68
+
69
+ secure_field "other", type: String, context: ["hammertime"]
70
+ field :bla, type: Hash
71
+ end
72
+
73
+ o = TestHashClass.create!(bla: {name: "samson"})
74
+ o = TestHashClass.find(o.id)
75
+ o.bla
61
76
  end
62
77
 
63
78
  end
data/spec/spec_helper.rb CHANGED
@@ -27,11 +27,12 @@ class ClassWithoutContext
27
27
  include Mongoid::Kms
28
28
 
29
29
  secure_field :secure, type: String
30
- field :unsecure
30
+ field :unsecure, type: Hash
31
31
  end
32
32
 
33
33
  class ExtendedClass < OtherClass
34
34
  secure_field :additional_secure, type: String, context: [:unsecure, :timestamp]
35
+ field :test_hash_crash, type: Hash, default: {}
35
36
  end
36
37
 
37
38
  Mongoid::Kms.configure({region: "us-east-1", key: ENV['AWS_KMS_KEY_ID']})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-kms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Winslett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid