fake_dynamo 0.2.3 → 0.2.4

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: f5b33d3831cfed29e43bc2069f399848d8ce85b0
4
- data.tar.gz: 18b3f3f18376a1983da21a68db5173b7dc8d9a3c
3
+ metadata.gz: 8333d5e9d5e01c91f1ec911ad7b6ba01af87b16a
4
+ data.tar.gz: c95189c6e7ef0b1bb321b1facd746ea49ee3f840
5
5
  SHA512:
6
- metadata.gz: 76808c298df2b11d7ef08e42c282db6f3769e66208386157f244f22b7a9f27852e71a0919d14c6d8531c41fb3e303f21273a6613276a0d58ed48ae29d85de03f
7
- data.tar.gz: adda14d9f182d9c0fe9f9722aac1b5580bfe90bfbe749e32e709b73446621236a281bbd7371efd90802eb49f87760cff07f0f75b9f7db1416ceaab8ff64c5019
6
+ metadata.gz: 51aea4e7d2e47b6c9c16017b5704157c5ca39156a68e80a9825107a2aade9a745362a189ba1c2905afcfa98b5a41f6556efa0312f7b2fb77e56787f714687dbe
7
+ data.tar.gz: 6adbf3ac4ce20bc9b89af8ee7717d2adbc86f066a305203926c5fa02acbc2ce68a1bbf4d8df31234182f73057b94ab3769e01319b9dba478ee641328527365e9
@@ -0,0 +1,4 @@
1
+ ## 0.2.4 <2013-07-17>
2
+
3
+ * Remove attribute if the set becomes empty - #27
4
+ * Do not append '\n' at the end of base64 encoded binary - #24
data/README.md CHANGED
@@ -4,10 +4,10 @@ local hosted, inmemory Amazon DynamoDB emulator.
4
4
 
5
5
  ## Versions
6
6
 
7
- | Amazon DynamoDB | FakeDynamo |
8
- | --------------- | ----------- |
9
- | 2012-08-10 | 0.2.3 |
10
- | 2011-12-05 | 0.1.3 |
7
+ | Amazon DynamoDB API version | FakeDynamo gem version|
8
+ | --------------------------- | ----------------------|
9
+ | [2012-08-10][v2] | 0.2.4 |
10
+ | [2011-12-05][v1] | 0.1.3 |
11
11
 
12
12
 
13
13
  ## Caveats
@@ -19,7 +19,7 @@ local hosted, inmemory Amazon DynamoDB emulator.
19
19
  __requires ruby >= 1.9__
20
20
 
21
21
  ````
22
- gem install fake_dynamo --version 0.2.0
22
+ gem install fake_dynamo --version 0.2.3
23
23
 
24
24
  fake_dynamo --port 4567
25
25
  ````
@@ -32,7 +32,7 @@ curl -X DELETE http://localhost:4567
32
32
 
33
33
  ## Clients
34
34
 
35
- * aws-sdk-ruby (AWS SDK for Ruby)
35
+ * [aws-sdk-ruby](https://github.com/aws/aws-sdk-ruby) (AWS SDK for Ruby)
36
36
 
37
37
  ````ruby
38
38
  AWS.config(:use_ssl => false,
@@ -42,7 +42,7 @@ AWS.config(:use_ssl => false,
42
42
  :secret_access_key => "xxx")
43
43
  ````
44
44
 
45
- * aws-sdk-js (AWS SDK for Node.js)
45
+ * [aws-sdk-js](https://github.com/aws/aws-sdk-js) (AWS SDK for Node.js)
46
46
 
47
47
  ````js
48
48
  AWS.config.update({apiVersion: "2012-08-10",
@@ -63,3 +63,7 @@ starting the server. Because of the way fake_dynamo stores the data,
63
63
  file size tend to grow by time. so fake_dynamo will compact the database
64
64
  during start up if the file size is greater than 100mb. you can
65
65
  manually compact it by passing --compact flag.
66
+
67
+
68
+ [v2]: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Operations.html
69
+ [v1]: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Appendix.APIv20111205.html
@@ -942,7 +942,7 @@
942
942
  - :boolean
943
943
  ReturnValues:
944
944
  - :string
945
- - :enum: [ALL_NEW, UPDATED_OLD, ALL_OLD, NONE, UPDATED_NEW]
945
+ - :enum: [ALL_OLD, NONE]
946
946
  ReturnConsumedCapacity:
947
947
  - :string
948
948
  - :enum: [TOTAL, NONE]
@@ -39,8 +39,8 @@ module FakeDynamo
39
39
 
40
40
  def decode(value)
41
41
  case @type
42
- when 'B' then Base64.decode64(value)
43
- when 'BS' then value.map { |v| Base64.decode64(v) }
42
+ when 'B' then Base64.strict_decode64(value)
43
+ when 'BS' then value.map { |v| Base64.strict_decode64(v) }
44
44
  when 'N' then Num.new(value)
45
45
  when 'NS' then value.map { |v| Num.new(v) }
46
46
  else value
@@ -49,8 +49,8 @@ module FakeDynamo
49
49
 
50
50
  def encode(value)
51
51
  case @type
52
- when 'B' then Base64.encode64(value)
53
- when 'BS' then value.map { |v| Base64.encode64(v) }
52
+ when 'B' then Base64.strict_encode64(value)
53
+ when 'BS' then value.map { |v| Base64.strict_encode64(v) }
54
54
  when 'N' then value.to_s
55
55
  when 'NS' then value.map(&:to_s)
56
56
  else value
@@ -80,6 +80,9 @@ module FakeDynamo
80
80
  end
81
81
  attribute = Attribute.from_hash(name, value)
82
82
  old_attribute.value -= attribute.value
83
+ if old_attribute.value.empty?
84
+ attributes.delete(name)
85
+ end
83
86
  end
84
87
  end
85
88
 
@@ -1,3 +1,3 @@
1
1
  module FakeDynamo
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -10,7 +10,7 @@ module FakeDynamo
10
10
  describe Filter do
11
11
 
12
12
  def encode(bytes)
13
- Base64.encode64(bytes.pack('c*'))
13
+ Base64.strict_encode64(bytes.pack('c*'))
14
14
  end
15
15
 
16
16
  subject { FilterTest.new }
@@ -50,6 +50,12 @@ module FakeDynamo
50
50
  subject.delete('friends', { "NS" => ["2", "4"]})
51
51
  subject.attributes['friends'].value.should == [Num.new("1")]
52
52
  end
53
+
54
+ it "should remove empty sets" do
55
+ subject.attributes['friends'] = Attribute.new('friends', ["1", "2"], "NS")
56
+ subject.delete('friends', { "NS" => ["1", "2"]})
57
+ subject.attributes['friends'].should be_nil
58
+ end
53
59
  end
54
60
 
55
61
  context "#put" do
@@ -18,8 +18,8 @@ module FakeDynamo
18
18
  {'TableName' => 'User',
19
19
  'Item' => { 'id' => { 'S' => (i % 100).to_s },
20
20
  'name' => { 'S' => "╩tr¥in" },
21
- 'binary' => { 'B' => Base64.encode64("binary") },
22
- 'binary' => { 'BS' => [Base64.encode64("binary")] }}
21
+ 'binary' => { 'B' => Base64.strict_encode64("binary") },
22
+ 'binary' => { 'BS' => [Base64.strict_encode64("binary")] }}
23
23
  }
24
24
  end
25
25
 
@@ -31,8 +31,8 @@ module FakeDynamo
31
31
  'AttributeName1' => { 'S' => "test" },
32
32
  'AttributeName2' => { 'N' => '11' },
33
33
  'AttributeName3' => { 'S' => "another" },
34
- 'binary' => { 'B' => Base64.encode64("binary") },
35
- 'binary_set' => { 'BS' => [Base64.encode64("binary")] }
34
+ 'binary' => { 'B' => Base64.strict_encode64("binary") },
35
+ 'binary_set' => { 'BS' => [Base64.strict_encode64("binary")] }
36
36
  },
37
37
  'ReturnConsumedCapacity' => 'TOTAL'
38
38
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anantha Kumaran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-07 00:00:00.000000000 Z
11
+ date: 2013-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -63,6 +63,7 @@ files:
63
63
  - .gitignore
64
64
  - .rspec
65
65
  - .travis.yml
66
+ - CHANGELOG.md
66
67
  - Gemfile
67
68
  - Guardfile
68
69
  - LICENSE