dynamo_record 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dynamo_record/persistence.rb +6 -0
- data/lib/dynamo_record/version.rb +1 -1
- data/spec/dynamo_record/persistence_spec.rb +8 -14
- data/spec/dynamo_record/query_spec.rb +0 -6
- data/spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/creates_record.yml +52 -0
- data/spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/saves_record.yml +52 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c42a04f7ee938c30519383db4bdfc01de103034
|
4
|
+
data.tar.gz: 66c664a51bb28725f882ad2b9619cce9b4b5822b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b954a9aef9785857b7a977916fb9f5fb3a50cdbf6172f7876fc091a323717d0b3a6e2c18bf16cbd9c822e4464d6434dcf84c19e2ca951f015b30a53cbdeef853
|
7
|
+
data.tar.gz: e5c88e4aa692ca48071b7c70df0fb00e6edd20bc6cef45d94b31bf6140e9216afb4c3027fef08c5257019eabbedda447d2e654526f808bc00e26f546c49dd8c6
|
@@ -49,19 +49,18 @@ RSpec.describe DynamoRecord::Persistence, :vcr do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'saves record' do
|
52
|
-
expect(SecureRandom).to receive(:uuid).and_return('
|
53
|
-
client = spy('client')
|
54
|
-
allow(Person).to receive(:client).and_return(client)
|
55
|
-
|
52
|
+
expect(SecureRandom).to receive(:uuid).and_return('de7551fa-17df-49d8-9dc0-c0266aeeab49')
|
56
53
|
person = Person.new(name: 'A person')
|
57
54
|
person.save
|
55
|
+
expect(person.new_record).to be_falsy
|
56
|
+
expect(person.id).to eq('de7551fa-17df-49d8-9dc0-c0266aeeab49')
|
57
|
+
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
name: 'A person'}})
|
59
|
+
it 'creates record' do
|
60
|
+
expect(SecureRandom).to receive(:uuid).and_return('5831f7ba-3c5a-4bad-9a83-47712fe877e4')
|
61
|
+
person = Person.create(name: 'A person')
|
63
62
|
expect(person.new_record).to be_falsy
|
64
|
-
expect(person.id).to eq('
|
63
|
+
expect(person.id).to eq('5831f7ba-3c5a-4bad-9a83-47712fe877e4')
|
65
64
|
end
|
66
65
|
|
67
66
|
it 'does not overwrite existing record' do
|
@@ -73,11 +72,6 @@ RSpec.describe DynamoRecord::Persistence, :vcr do
|
|
73
72
|
end
|
74
73
|
|
75
74
|
it 'updates record' do
|
76
|
-
DynamoRecord.configure do |config|
|
77
|
-
config.access_key_id = 'key'
|
78
|
-
config.secret_access_key = 'TfWvbWtJ96DPM+QduJDXVkGKGbwhIyAYpPSnXad1'
|
79
|
-
end
|
80
|
-
|
81
75
|
person = Person.find('f9b351b0-d06d-4fff-b8d4-8af162e2b8ba')
|
82
76
|
person.name = 'New name'
|
83
77
|
person.save
|
@@ -1,12 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe DynamoRecord::Query, :vcr do
|
4
|
-
before do
|
5
|
-
DynamoRecord.configure do |config|
|
6
|
-
config.access_key_id = 'key'
|
7
|
-
config.secret_access_key = 'TfWvbWtJ96DPM+QduJDXVkGKGbwhIyAYpPSnXad1'
|
8
|
-
end
|
9
|
-
end
|
10
4
|
|
11
5
|
describe '#all' do
|
12
6
|
it 'find all records' do
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://dynamodb.us-east-1.amazonaws.com/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"TableName":"people","Item":{"name":{"S":"A person"},"id":{"S":"5831f7ba-3c5a-4bad-9a83-47712fe877e4"}}}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-amz-json-1.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- ''
|
14
|
+
User-Agent:
|
15
|
+
- aws-sdk-ruby2/2.0.17 ruby/2.1.2 x86_64-darwin14.0
|
16
|
+
X-Amz-Target:
|
17
|
+
- DynamoDB_20120810.PutItem
|
18
|
+
X-Amz-Date:
|
19
|
+
- 20141231T100257Z
|
20
|
+
Host:
|
21
|
+
- dynamodb.us-east-1.amazonaws.com
|
22
|
+
X-Amz-Content-Sha256:
|
23
|
+
- 6f19e26cee48e62f701ce0c872d23d0b12242cdb88dc632a033cf0782a96dd52
|
24
|
+
Authorization:
|
25
|
+
- AWS4-HMAC-SHA256 Credential=key/20141231/us-east-1/dynamodb/aws4_request,
|
26
|
+
SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target,
|
27
|
+
Signature=ce71fc2f6980bb81cd947891a7eda4932abe1351f011a7e555b6dcddb44fd239
|
28
|
+
Content-Length:
|
29
|
+
- '105'
|
30
|
+
Accept:
|
31
|
+
- "*/*"
|
32
|
+
response:
|
33
|
+
status:
|
34
|
+
code: 200
|
35
|
+
message: OK
|
36
|
+
headers:
|
37
|
+
X-Amzn-Requestid:
|
38
|
+
- E2O56UFDGIJKUVQNTA85CGGEK7VV4KQNSO5AEMVJF66Q9ASUAAJG
|
39
|
+
X-Amz-Crc32:
|
40
|
+
- '2745614147'
|
41
|
+
Content-Type:
|
42
|
+
- application/x-amz-json-1.0
|
43
|
+
Content-Length:
|
44
|
+
- '2'
|
45
|
+
Date:
|
46
|
+
- Wed, 31 Dec 2014 10:02:57 GMT
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: "{}"
|
50
|
+
http_version:
|
51
|
+
recorded_at: Wed, 31 Dec 2014 10:02:58 GMT
|
52
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://dynamodb.us-east-1.amazonaws.com/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"TableName":"people","Item":{"name":{"S":"A person"},"id":{"S":"de7551fa-17df-49d8-9dc0-c0266aeeab49"}}}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-amz-json-1.0
|
12
|
+
Accept-Encoding:
|
13
|
+
- ''
|
14
|
+
User-Agent:
|
15
|
+
- aws-sdk-ruby2/2.0.17 ruby/2.1.2 x86_64-darwin14.0
|
16
|
+
X-Amz-Target:
|
17
|
+
- DynamoDB_20120810.PutItem
|
18
|
+
X-Amz-Date:
|
19
|
+
- 20141231T100447Z
|
20
|
+
Host:
|
21
|
+
- dynamodb.us-east-1.amazonaws.com
|
22
|
+
X-Amz-Content-Sha256:
|
23
|
+
- e947307a3e56bed9a3afbb1b35bf5ce13927129a44f66fbd9c0c45c91e7d42d4
|
24
|
+
Authorization:
|
25
|
+
- AWS4-HMAC-SHA256 Credential=key/20141231/us-east-1/dynamodb/aws4_request,
|
26
|
+
SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target,
|
27
|
+
Signature=c12991133fa308bbb873ae70691bbbf4480145b9b76a9c7643027ce86680641f
|
28
|
+
Content-Length:
|
29
|
+
- '105'
|
30
|
+
Accept:
|
31
|
+
- "*/*"
|
32
|
+
response:
|
33
|
+
status:
|
34
|
+
code: 200
|
35
|
+
message: OK
|
36
|
+
headers:
|
37
|
+
X-Amzn-Requestid:
|
38
|
+
- 3TK9KQT1C09UQDDB8R1B7PBFHBVV4KQNSO5AEMVJF66Q9ASUAAJG
|
39
|
+
X-Amz-Crc32:
|
40
|
+
- '2745614147'
|
41
|
+
Content-Type:
|
42
|
+
- application/x-amz-json-1.0
|
43
|
+
Content-Length:
|
44
|
+
- '2'
|
45
|
+
Date:
|
46
|
+
- Wed, 31 Dec 2014 10:04:48 GMT
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: "{}"
|
50
|
+
http_version:
|
51
|
+
recorded_at: Wed, 31 Dec 2014 10:04:49 GMT
|
52
|
+
recorded_with: VCR 2.9.3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamo_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nguyen Vu Nguyen
|
@@ -145,7 +145,9 @@ files:
|
|
145
145
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Fields/_find/when_record_doesn_t_exists/returns_empty_object.yml
|
146
146
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/with_index/creates_table.yml
|
147
147
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/without_index/creates_table.yml
|
148
|
+
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/creates_record.yml
|
148
149
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/does_not_overwrite_existing_record.yml
|
150
|
+
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/saves_record.yml
|
149
151
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/updates_record.yml
|
150
152
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records.yml
|
151
153
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records_with_limie.yml
|
@@ -197,7 +199,9 @@ test_files:
|
|
197
199
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Fields/_find/when_record_doesn_t_exists/returns_empty_object.yml
|
198
200
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/with_index/creates_table.yml
|
199
201
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/without_index/creates_table.yml
|
202
|
+
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/creates_record.yml
|
200
203
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/does_not_overwrite_existing_record.yml
|
204
|
+
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/saves_record.yml
|
201
205
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/updates_record.yml
|
202
206
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records.yml
|
203
207
|
- spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records_with_limie.yml
|