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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +11 -7
- data/lib/fake_dynamo/api_2012-08-10.yml +1 -1
- data/lib/fake_dynamo/attribute.rb +4 -4
- data/lib/fake_dynamo/item.rb +3 -0
- data/lib/fake_dynamo/version.rb +1 -1
- data/spec/fake_dynamo/filter_spec.rb +1 -1
- data/spec/fake_dynamo/item_spec.rb +6 -0
- data/spec/fake_dynamo/storage_spec.rb +2 -2
- data/spec/fake_dynamo/table_spec.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8333d5e9d5e01c91f1ec911ad7b6ba01af87b16a
|
4
|
+
data.tar.gz: c95189c6e7ef0b1bb321b1facd746ea49ee3f840
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51aea4e7d2e47b6c9c16017b5704157c5ca39156a68e80a9825107a2aade9a745362a189ba1c2905afcfa98b5a41f6556efa0312f7b2fb77e56787f714687dbe
|
7
|
+
data.tar.gz: 6adbf3ac4ce20bc9b89af8ee7717d2adbc86f066a305203926c5fa02acbc2ce68a1bbf4d8df31234182f73057b94ab3769e01319b9dba478ee641328527365e9
|
data/CHANGELOG.md
ADDED
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
|
10
|
-
| 2011-12-05
|
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.
|
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
|
@@ -39,8 +39,8 @@ module FakeDynamo
|
|
39
39
|
|
40
40
|
def decode(value)
|
41
41
|
case @type
|
42
|
-
when 'B' then Base64.
|
43
|
-
when 'BS' then value.map { |v| Base64.
|
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.
|
53
|
-
when 'BS' then value.map { |v| Base64.
|
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
|
data/lib/fake_dynamo/item.rb
CHANGED
data/lib/fake_dynamo/version.rb
CHANGED
@@ -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.
|
22
|
-
'binary' => { 'BS' => [Base64.
|
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.
|
35
|
-
'binary_set' => { 'BS' => [Base64.
|
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.
|
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-
|
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
|