tiny_dyno 0.1.25 → 0.1.26

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: a28ed2299af93a8ee3d0eaf97b8d521c1a51531f
4
- data.tar.gz: 78a16ab4e0d9ddbc94110951e477dfcd7cf0968d
3
+ metadata.gz: 9eeb470ea3ff16112977ef9123bef59454ed3e54
4
+ data.tar.gz: afcd41202cfc3958393994b8ef64656bfb74a3d7
5
5
  SHA512:
6
- metadata.gz: ada511b7ef70a2946480ac122e32c18ec4c49262d74c4f000649733f09abd494d227ab4391e5fae3e0528b28304b391d7dd62bdf71bd99c37c84be67680f01e7
7
- data.tar.gz: bc90054e297b8217765955095a362e185919b9bf2be20539db223bcec28ef004a9b03c9f824eb8da12c9ca2c128a2f7c05f6cef2aa51933ec98123fca56cbb0a
6
+ metadata.gz: ca7cd810a35c5dd278430ae2a22c753ec511a7c9341814eeffd2b760e492039636df3a2ac99aa45aff1bd022ae60d6351845c349b27daa0386e9e7ab351a9cf1
7
+ data.tar.gz: 8014ce0e91ce9342d161834c58af6bef1fe101952e4b93b726309f0549b4343bd291a1ec7123375ee324744d494e009b347aa7e543c84564c65ef75948fa94df
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.2
1
+ 2.2.3
data/CHANGES.md CHANGED
@@ -1,4 +1,9 @@
1
- 0.1.24 (2015-09-11)
1
+ 0.1.26 (2015-09-11)
2
+ -------------------
3
+
4
+ * FIX: Discard empty string attributes before saving the document, since DynamoDB does not store these by design
5
+
6
+ 0.1.25 (2015-09-11)
2
7
  -------------------
3
8
 
4
9
  * Add missing syntax update for primary_key hash
@@ -6,6 +6,7 @@ module TinyDyno
6
6
  unless options.has_key?(:validate) && options[:validate] == false
7
7
  return false unless self.valid?
8
8
  end
9
+ remove_empty_attributes
9
10
  if new_record?
10
11
  if request_put_item(options)
11
12
  changes_applied
@@ -26,6 +27,15 @@ module TinyDyno
26
27
 
27
28
  private
28
29
 
30
+ def remove_empty_attributes
31
+ self.class.fields
32
+ @attributes.each_pair do |k,v|
33
+ next unless self.class.fields[k].options[:type].to_s == 'String'
34
+ next unless v.respond_to?(:to_s)
35
+ @attributes.delete(k) if v.to_s.nil? or v.to_s.empty?
36
+ end
37
+ end
38
+
29
39
  def request_put_item(options)
30
40
  request = request_as_new_record(build_put_item_request)
31
41
  return(TinyDyno::Adapter.put_item(put_item_request: request))
@@ -1,3 +1,3 @@
1
1
  module TinyDyno
2
- VERSION = '0.1.25'
2
+ VERSION = '0.1.26'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_dyno
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gerschner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-11 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler