dynamo_record 0.0.14 → 0.0.16

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: fdc77988251b96b7ff26fe7b64c795030a25535d
4
- data.tar.gz: a1d350928ed4043313511a43138fb455202be0ca
3
+ metadata.gz: d5a7aacd7cf741404335e060193dca054ef994ba
4
+ data.tar.gz: d4306cda8f6a72a196057d69879f723802d82436
5
5
  SHA512:
6
- metadata.gz: 8bc834611cf2826a3adb31404bb0f3acfab75de05a169d4d6ff72974797332f113cdf56019b3ffd6225d262445b0da51ef9de4f2d5f31477c96488fbea26e565
7
- data.tar.gz: 74ffa1efc05cdd8268e8b6c1f2004f34e809198cdcb9b80b790956e3ba7a8dc2bc9a72af7e5e905595b89713fdb8b090d822dece8bd73f4f3b8d8a88abd12107
6
+ metadata.gz: 5603c12d1de45c7383077d3fe754f4902c59dfdfc5f5ad4dd8585779d76eec11368687e4756bf5ebf7e5b83e883dab672de701995c8fc2051d55e2c72bb93bcf
7
+ data.tar.gz: f3b789c3431436630d0cfd3624ccc67e0fd4967537588af83d0ae415aa182bf6537af2061c20a193a87d79b47ac0633649f7f9fc56a5bdfed58b696e7ccc943f
@@ -90,5 +90,12 @@ module DynamoRecord
90
90
  false
91
91
  end
92
92
 
93
+ def destroy
94
+ options = self.class.default_options
95
+ response = self.class.client.delete_item(
96
+ options.merge(key: { 'id' => self.id} )
97
+ )
98
+ end
99
+
93
100
  end
94
101
  end
@@ -1,3 +1,3 @@
1
1
  module DynamoRecord
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -80,4 +80,11 @@ RSpec.describe DynamoRecord::Persistence, :vcr do
80
80
  expect(person.name).to eq('New name')
81
81
  end
82
82
 
83
+ it 'destroys record' do
84
+ person = Person.find('f9b351b0-d06d-4fff-b8d4-8af162e2b8ba')
85
+ person.destroy
86
+ person = Person.find('f9b351b0-d06d-4fff-b8d4-8af162e2b8ba')
87
+ expect(person).to be_nil
88
+ end
89
+
83
90
  end
@@ -0,0 +1,150 @@
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","Key":{"id":{"S":"f9b351b0-d06d-4fff-b8d4-8af162e2b8ba"}}}'
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.19 ruby/2.1.2 x86_64-darwin14.0
16
+ X-Amz-Target:
17
+ - DynamoDB_20120810.GetItem
18
+ X-Amz-Date:
19
+ - 20150116T135102Z
20
+ Host:
21
+ - dynamodb.us-east-1.amazonaws.com
22
+ X-Amz-Content-Sha256:
23
+ - 11a49d1d6421d3540cf7a7c96423eb631d8b8de996d5069f178a631eea8d8e01
24
+ Authorization:
25
+ - AWS4-HMAC-SHA256 Credential=key/20150116/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=594884042c1dd7c46b5175963fe80f13770a4426946f3cfa8d4e6d1ef9c86c31
28
+ Content-Length:
29
+ - '80'
30
+ Accept:
31
+ - "*/*"
32
+ response:
33
+ status:
34
+ code: 200
35
+ message: OK
36
+ headers:
37
+ X-Amzn-Requestid:
38
+ - TJP2MAAV789JHBGT3EK4MC4NQRVV4KQNSO5AEMVJF66Q9ASUAAJG
39
+ X-Amz-Crc32:
40
+ - '3221367258'
41
+ Content-Type:
42
+ - application/x-amz-json-1.0
43
+ Content-Length:
44
+ - '84'
45
+ Date:
46
+ - Fri, 16 Jan 2015 13:51:03 GMT
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"Item":{"name":{"S":"Person 1"},"id":{"S":"f9b351b0-d06d-4fff-b8d4-8af162e2b8ba"}}}'
50
+ http_version:
51
+ recorded_at: Fri, 16 Jan 2015 13:51:04 GMT
52
+ - request:
53
+ method: post
54
+ uri: https://dynamodb.us-east-1.amazonaws.com/
55
+ body:
56
+ encoding: UTF-8
57
+ string: '{"TableName":"people","Key":{"id":{"S":"f9b351b0-d06d-4fff-b8d4-8af162e2b8ba"}}}'
58
+ headers:
59
+ Content-Type:
60
+ - application/x-amz-json-1.0
61
+ Accept-Encoding:
62
+ - ''
63
+ User-Agent:
64
+ - aws-sdk-ruby2/2.0.19 ruby/2.1.2 x86_64-darwin14.0
65
+ X-Amz-Target:
66
+ - DynamoDB_20120810.DeleteItem
67
+ X-Amz-Date:
68
+ - 20150116T135104Z
69
+ Host:
70
+ - dynamodb.us-east-1.amazonaws.com
71
+ X-Amz-Content-Sha256:
72
+ - 11a49d1d6421d3540cf7a7c96423eb631d8b8de996d5069f178a631eea8d8e01
73
+ Authorization:
74
+ - AWS4-HMAC-SHA256 Credential=key/20150116/us-east-1/dynamodb/aws4_request,
75
+ SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target,
76
+ Signature=958b6d99fa3add9c2239c44cf05b7e11de63af677e571e390b3b46acfd6527de
77
+ Content-Length:
78
+ - '80'
79
+ Accept:
80
+ - "*/*"
81
+ response:
82
+ status:
83
+ code: 200
84
+ message: OK
85
+ headers:
86
+ X-Amzn-Requestid:
87
+ - 2C19L4ABMBIGKMNSLQRD2IK583VV4KQNSO5AEMVJF66Q9ASUAAJG
88
+ X-Amz-Crc32:
89
+ - '2745614147'
90
+ Content-Type:
91
+ - application/x-amz-json-1.0
92
+ Content-Length:
93
+ - '2'
94
+ Date:
95
+ - Fri, 16 Jan 2015 13:51:04 GMT
96
+ body:
97
+ encoding: UTF-8
98
+ string: "{}"
99
+ http_version:
100
+ recorded_at: Fri, 16 Jan 2015 13:51:05 GMT
101
+ - request:
102
+ method: post
103
+ uri: https://dynamodb.us-east-1.amazonaws.com/
104
+ body:
105
+ encoding: UTF-8
106
+ string: '{"TableName":"people","Key":{"id":{"S":"f9b351b0-d06d-4fff-b8d4-8af162e2b8ba"}}}'
107
+ headers:
108
+ Content-Type:
109
+ - application/x-amz-json-1.0
110
+ Accept-Encoding:
111
+ - ''
112
+ User-Agent:
113
+ - aws-sdk-ruby2/2.0.19 ruby/2.1.2 x86_64-darwin14.0
114
+ X-Amz-Target:
115
+ - DynamoDB_20120810.GetItem
116
+ X-Amz-Date:
117
+ - 20150116T135105Z
118
+ Host:
119
+ - dynamodb.us-east-1.amazonaws.com
120
+ X-Amz-Content-Sha256:
121
+ - 11a49d1d6421d3540cf7a7c96423eb631d8b8de996d5069f178a631eea8d8e01
122
+ Authorization:
123
+ - AWS4-HMAC-SHA256 Credential=key/20150116/us-east-1/dynamodb/aws4_request,
124
+ SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target,
125
+ Signature=6cdf950bda59fa02691f3099a8035a676ee82cb979861271b12a96badf550f5c
126
+ Content-Length:
127
+ - '80'
128
+ Accept:
129
+ - "*/*"
130
+ response:
131
+ status:
132
+ code: 200
133
+ message: OK
134
+ headers:
135
+ X-Amzn-Requestid:
136
+ - IUSDC4UFAN1QUAH8PUCH4VASFVVV4KQNSO5AEMVJF66Q9ASUAAJG
137
+ X-Amz-Crc32:
138
+ - '2745614147'
139
+ Content-Type:
140
+ - application/x-amz-json-1.0
141
+ Content-Length:
142
+ - '2'
143
+ Date:
144
+ - Fri, 16 Jan 2015 13:51:05 GMT
145
+ body:
146
+ encoding: UTF-8
147
+ string: "{}"
148
+ http_version:
149
+ recorded_at: Fri, 16 Jan 2015 13:51:05 GMT
150
+ 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.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nguyen Vu Nguyen
@@ -146,6 +146,7 @@ files:
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
148
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/creates_record.yml
149
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/destroys_record.yml
149
150
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/does_not_overwrite_existing_record.yml
150
151
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/saves_record.yml
151
152
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/updates_record.yml
@@ -200,6 +201,7 @@ test_files:
200
201
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/with_index/creates_table.yml
201
202
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/without_index/creates_table.yml
202
203
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/creates_record.yml
204
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/destroys_record.yml
203
205
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/does_not_overwrite_existing_record.yml
204
206
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/saves_record.yml
205
207
  - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/updates_record.yml