dynamodb_record 0.2.2 → 0.3.0
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/.rubocop.yml +55 -0
- data/dynamodb_record.gemspec +1 -1
- data/lib/dynamodb_record/associations.rb +77 -27
- data/lib/dynamodb_record/collection.rb +18 -27
- data/lib/dynamodb_record/config.rb +2 -0
- data/lib/dynamodb_record/fields.rb +11 -12
- data/lib/dynamodb_record/finders.rb +1 -0
- data/lib/dynamodb_record/has_and_belongs_to_many_collection.rb +58 -0
- data/lib/dynamodb_record/has_many_collection.rb +50 -0
- data/lib/dynamodb_record/has_many_through_collection.rb +44 -0
- data/lib/dynamodb_record/pager.rb +15 -0
- data/lib/dynamodb_record/persistence.rb +19 -19
- data/lib/dynamodb_record/query.rb +12 -9
- data/lib/dynamodb_record/query_pager.rb +28 -0
- data/lib/dynamodb_record/scan_pager.rb +28 -0
- data/lib/dynamodb_record/version.rb +1 -1
- data/lib/dynamodb_record.rb +6 -0
- data/spec/app/models/authorization.rb +0 -1
- data/spec/app/models/car.rb +9 -0
- data/spec/app/models/insurance.rb +9 -0
- data/spec/app/models/service.rb +8 -0
- data/spec/app/models/user.rb +2 -0
- data/spec/dynamodb_record/association_spec.rb +44 -0
- data/spec/dynamodb_record/document_spec.rb +2 -2
- data/spec/dynamodb_record/fields_spec.rb +21 -15
- data/spec/dynamodb_record/persistence_spec.rb +3 -2
- data/spec/dynamodb_record/query_spec.rb +5 -3
- data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_belongs_to/get_object.yml +105 -0
- data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_has_many/create_item.yml +156 -0
- data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_has_many/get_collection.yml +105 -0
- data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_and_belongs_to_many.yml +157 -0
- data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_and_belongs_to_many_create.yml +207 -0
- data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_many_through.yml +157 -0
- data/spec/spec_helper.rb +3 -2
- metadata +22 -24
@@ -0,0 +1,157 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:8000/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"TableName":"cars","Key":{"id":{"S":"UVX455"}}}'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- ''
|
12
|
+
Content-Type:
|
13
|
+
- application/x-amz-json-1.0
|
14
|
+
X-Amz-Target:
|
15
|
+
- DynamoDB_20120810.GetItem
|
16
|
+
User-Agent:
|
17
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
18
|
+
md/3.2.3 cfg/retry-mode#legacy
|
19
|
+
Host:
|
20
|
+
- localhost:8000
|
21
|
+
X-Amz-Date:
|
22
|
+
- 20240510T153124Z
|
23
|
+
X-Amz-Content-Sha256:
|
24
|
+
- 53644a2bbab903704867eb87df0fdfe6dd8cb8ac9e1dae5715033d0f636fd592
|
25
|
+
Authorization:
|
26
|
+
- AWS4-HMAC-SHA256 Credential=key/20240510/us-east-1/dynamodb/aws4_request,
|
27
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
28
|
+
Signature=aabf32c5d98f0cb8d883d2be1fcbedb04b65b0c6c2d38ff4172a1d31a6bfa438
|
29
|
+
Content-Length:
|
30
|
+
- '48'
|
31
|
+
Accept:
|
32
|
+
- "*/*"
|
33
|
+
response:
|
34
|
+
status:
|
35
|
+
code: 200
|
36
|
+
message: OK
|
37
|
+
headers:
|
38
|
+
Date:
|
39
|
+
- Fri, 10 May 2024 15:31:24 GMT
|
40
|
+
X-Amzn-Requestid:
|
41
|
+
- a1a0ed0c-b027-4df9-85a1-aeb1343d66f1
|
42
|
+
Content-Type:
|
43
|
+
- application/x-amz-json-1.0
|
44
|
+
X-Amz-Crc32:
|
45
|
+
- '590923779'
|
46
|
+
Content-Length:
|
47
|
+
- '149'
|
48
|
+
Server:
|
49
|
+
- Jetty(11.0.17)
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: '{"Item":{"marca":{"S":"Chvrolet"},"created_at":{"S":"2024-05-07T14:09:25-05:00"},"id":{"S":"UVX455"},"updated_at":{"S":"2024-05-07T14:09:25-05:00"}}}'
|
53
|
+
recorded_at: Fri, 10 May 2024 15:31:24 GMT
|
54
|
+
- request:
|
55
|
+
method: post
|
56
|
+
uri: http://localhost:8000/
|
57
|
+
body:
|
58
|
+
encoding: UTF-8
|
59
|
+
string: '{"TableName":"subscriptions","IndexName":"car_id_index","KeyConditionExpression":"#car_id
|
60
|
+
= :car_id","ExpressionAttributeNames":{"#car_id":"car_id"},"ExpressionAttributeValues":{":car_id":{"S":"UVX455"}},"Limit":1}'
|
61
|
+
headers:
|
62
|
+
Accept-Encoding:
|
63
|
+
- ''
|
64
|
+
Content-Type:
|
65
|
+
- application/x-amz-json-1.0
|
66
|
+
X-Amz-Target:
|
67
|
+
- DynamoDB_20120810.Query
|
68
|
+
User-Agent:
|
69
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
70
|
+
md/3.2.3 cfg/retry-mode#legacy
|
71
|
+
Host:
|
72
|
+
- localhost:8000
|
73
|
+
X-Amz-Date:
|
74
|
+
- 20240510T153124Z
|
75
|
+
X-Amz-Content-Sha256:
|
76
|
+
- a8ff850c4aeb9c9af304ba26c2cdbd7da707db1921602173d7d3d4d6c17fd101
|
77
|
+
Authorization:
|
78
|
+
- AWS4-HMAC-SHA256 Credential=key/20240510/us-east-1/dynamodb/aws4_request,
|
79
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
80
|
+
Signature=5b17cf94981747e27477a2e746af96998ae6648b22986d06995737020d9de8b6
|
81
|
+
Content-Length:
|
82
|
+
- '214'
|
83
|
+
Accept:
|
84
|
+
- "*/*"
|
85
|
+
response:
|
86
|
+
status:
|
87
|
+
code: 200
|
88
|
+
message: OK
|
89
|
+
headers:
|
90
|
+
Date:
|
91
|
+
- Fri, 10 May 2024 15:31:24 GMT
|
92
|
+
X-Amzn-Requestid:
|
93
|
+
- 6b579265-07a9-4be1-913c-533ed443fbb1
|
94
|
+
Content-Type:
|
95
|
+
- application/x-amz-json-1.0
|
96
|
+
X-Amz-Crc32:
|
97
|
+
- '3624557612'
|
98
|
+
Content-Length:
|
99
|
+
- '185'
|
100
|
+
Server:
|
101
|
+
- Jetty(11.0.17)
|
102
|
+
body:
|
103
|
+
encoding: UTF-8
|
104
|
+
string: '{"Items":[{"car_id":{"S":"UVX455"},"user_id":{"S":"hguzman10@gmail.com"},"id":{"S":"ASDFG"}}],"Count":1,"ScannedCount":1,"LastEvaluatedKey":{"car_id":{"S":"UVX455"},"id":{"S":"ASDFG"}}}'
|
105
|
+
recorded_at: Fri, 10 May 2024 15:31:24 GMT
|
106
|
+
- request:
|
107
|
+
method: post
|
108
|
+
uri: http://localhost:8000/
|
109
|
+
body:
|
110
|
+
encoding: UTF-8
|
111
|
+
string: '{"TableName":"users","Key":{"id":{"S":"hguzman10@gmail.com"}}}'
|
112
|
+
headers:
|
113
|
+
Accept-Encoding:
|
114
|
+
- ''
|
115
|
+
Content-Type:
|
116
|
+
- application/x-amz-json-1.0
|
117
|
+
X-Amz-Target:
|
118
|
+
- DynamoDB_20120810.GetItem
|
119
|
+
User-Agent:
|
120
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
121
|
+
md/3.2.3 cfg/retry-mode#legacy
|
122
|
+
Host:
|
123
|
+
- localhost:8000
|
124
|
+
X-Amz-Date:
|
125
|
+
- 20240510T153124Z
|
126
|
+
X-Amz-Content-Sha256:
|
127
|
+
- 7e2248df156bd85d1c08add1aaa7b84ed6041fe96165fb6879ddbb1424663802
|
128
|
+
Authorization:
|
129
|
+
- AWS4-HMAC-SHA256 Credential=key/20240510/us-east-1/dynamodb/aws4_request,
|
130
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
131
|
+
Signature=148c8308f7139ad29b0c868b5c835044c7247c54a39347e603514301bca0dc42
|
132
|
+
Content-Length:
|
133
|
+
- '62'
|
134
|
+
Accept:
|
135
|
+
- "*/*"
|
136
|
+
response:
|
137
|
+
status:
|
138
|
+
code: 200
|
139
|
+
message: OK
|
140
|
+
headers:
|
141
|
+
Date:
|
142
|
+
- Fri, 10 May 2024 15:31:24 GMT
|
143
|
+
X-Amzn-Requestid:
|
144
|
+
- f619c0fb-46a2-4016-a59f-749d48435612
|
145
|
+
Content-Type:
|
146
|
+
- application/x-amz-json-1.0
|
147
|
+
X-Amz-Crc32:
|
148
|
+
- '3262869781'
|
149
|
+
Content-Length:
|
150
|
+
- '157'
|
151
|
+
Server:
|
152
|
+
- Jetty(11.0.17)
|
153
|
+
body:
|
154
|
+
encoding: UTF-8
|
155
|
+
string: '{"Item":{"created_at":{"S":"2024-05-07T14:10:09-05:00"},"id":{"S":"hguzman10@gmail.com"},"balance":{"N":"0"},"updated_at":{"S":"2024-05-07T14:10:09-05:00"}}}'
|
156
|
+
recorded_at: Fri, 10 May 2024 15:31:24 GMT
|
157
|
+
recorded_with: VCR 6.2.0
|
data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_and_belongs_to_many_create.yml
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:8000/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"TableName":"cars","Key":{"id":{"S":"UVX455"}}}'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- ''
|
12
|
+
Content-Type:
|
13
|
+
- application/x-amz-json-1.0
|
14
|
+
X-Amz-Target:
|
15
|
+
- DynamoDB_20120810.GetItem
|
16
|
+
User-Agent:
|
17
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
18
|
+
md/3.2.3 cfg/retry-mode#legacy
|
19
|
+
Host:
|
20
|
+
- localhost:8000
|
21
|
+
X-Amz-Date:
|
22
|
+
- 20240511T165334Z
|
23
|
+
X-Amz-Content-Sha256:
|
24
|
+
- 53644a2bbab903704867eb87df0fdfe6dd8cb8ac9e1dae5715033d0f636fd592
|
25
|
+
Authorization:
|
26
|
+
- AWS4-HMAC-SHA256 Credential=key/20240511/us-east-1/dynamodb/aws4_request,
|
27
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
28
|
+
Signature=945141506a3d03f5dfa8197ade25fc065c72852f9f59020adef19232dbae1c48
|
29
|
+
Content-Length:
|
30
|
+
- '48'
|
31
|
+
Accept:
|
32
|
+
- "*/*"
|
33
|
+
response:
|
34
|
+
status:
|
35
|
+
code: 200
|
36
|
+
message: OK
|
37
|
+
headers:
|
38
|
+
Date:
|
39
|
+
- Sat, 11 May 2024 16:53:34 GMT
|
40
|
+
X-Amzn-Requestid:
|
41
|
+
- cde0b341-e90d-4e78-b952-839a7959422d
|
42
|
+
Content-Type:
|
43
|
+
- application/x-amz-json-1.0
|
44
|
+
X-Amz-Crc32:
|
45
|
+
- '590923779'
|
46
|
+
Content-Length:
|
47
|
+
- '149'
|
48
|
+
Server:
|
49
|
+
- Jetty(11.0.17)
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: '{"Item":{"marca":{"S":"Chvrolet"},"created_at":{"S":"2024-05-07T14:09:25-05:00"},"id":{"S":"UVX455"},"updated_at":{"S":"2024-05-07T14:09:25-05:00"}}}'
|
53
|
+
recorded_at: Sat, 11 May 2024 16:53:34 GMT
|
54
|
+
- request:
|
55
|
+
method: post
|
56
|
+
uri: http://localhost:8000/
|
57
|
+
body:
|
58
|
+
encoding: UTF-8
|
59
|
+
string: '{"TableName":"cars-users","KeyConditionExpression":"#car_id = :car_id","ExpressionAttributeNames":{"#car_id":"car_id"},"ExpressionAttributeValues":{":car_id":{"S":"UVX455"}}}'
|
60
|
+
headers:
|
61
|
+
Accept-Encoding:
|
62
|
+
- ''
|
63
|
+
Content-Type:
|
64
|
+
- application/x-amz-json-1.0
|
65
|
+
X-Amz-Target:
|
66
|
+
- DynamoDB_20120810.Query
|
67
|
+
User-Agent:
|
68
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
69
|
+
md/3.2.3 cfg/retry-mode#legacy
|
70
|
+
Host:
|
71
|
+
- localhost:8000
|
72
|
+
X-Amz-Date:
|
73
|
+
- 20240511T165334Z
|
74
|
+
X-Amz-Content-Sha256:
|
75
|
+
- c5afaee6670f0bb8de80a62d934db1175d05a20c9f56b1cd58397a6e6124f3e9
|
76
|
+
Authorization:
|
77
|
+
- AWS4-HMAC-SHA256 Credential=key/20240511/us-east-1/dynamodb/aws4_request,
|
78
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
79
|
+
Signature=2ab37eed9aeff2704d9233edb66f8744c8c64d1b2afe6ec6eef864f4ef5850b7
|
80
|
+
Content-Length:
|
81
|
+
- '174'
|
82
|
+
Accept:
|
83
|
+
- "*/*"
|
84
|
+
response:
|
85
|
+
status:
|
86
|
+
code: 200
|
87
|
+
message: OK
|
88
|
+
headers:
|
89
|
+
Date:
|
90
|
+
- Sat, 11 May 2024 16:53:34 GMT
|
91
|
+
X-Amzn-Requestid:
|
92
|
+
- 918896f7-6570-4d53-91b4-b316fb1d1e72
|
93
|
+
Content-Type:
|
94
|
+
- application/x-amz-json-1.0
|
95
|
+
X-Amz-Crc32:
|
96
|
+
- '583912891'
|
97
|
+
Content-Length:
|
98
|
+
- '39'
|
99
|
+
Server:
|
100
|
+
- Jetty(11.0.17)
|
101
|
+
body:
|
102
|
+
encoding: UTF-8
|
103
|
+
string: '{"Items":[],"Count":0,"ScannedCount":0}'
|
104
|
+
recorded_at: Sat, 11 May 2024 16:53:34 GMT
|
105
|
+
- request:
|
106
|
+
method: post
|
107
|
+
uri: http://localhost:8000/
|
108
|
+
body:
|
109
|
+
encoding: UTF-8
|
110
|
+
string: '{"TableName":"users","Item":{"balance":{"N":"0"},"id":{"S":"hguzman50@gmail.com"},"created_at":{"S":"2024-05-11T11:53:34-05:00"},"updated_at":{"S":"2024-05-11T11:53:34-05:00"}}}'
|
111
|
+
headers:
|
112
|
+
Accept-Encoding:
|
113
|
+
- ''
|
114
|
+
Content-Type:
|
115
|
+
- application/x-amz-json-1.0
|
116
|
+
X-Amz-Target:
|
117
|
+
- DynamoDB_20120810.PutItem
|
118
|
+
User-Agent:
|
119
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
120
|
+
md/3.2.3 cfg/retry-mode#legacy
|
121
|
+
Host:
|
122
|
+
- localhost:8000
|
123
|
+
X-Amz-Date:
|
124
|
+
- 20240511T165334Z
|
125
|
+
X-Amz-Content-Sha256:
|
126
|
+
- 42291efb1996f6031a9903c6046f07ce33adaeb5a12f83063cf032a351fddf02
|
127
|
+
Authorization:
|
128
|
+
- AWS4-HMAC-SHA256 Credential=key/20240511/us-east-1/dynamodb/aws4_request,
|
129
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
130
|
+
Signature=ce88618157742bd045cb950a6fc2db03eaf92146ee78ea0bf0248f00bc2b5f58
|
131
|
+
Content-Length:
|
132
|
+
- '177'
|
133
|
+
Accept:
|
134
|
+
- "*/*"
|
135
|
+
response:
|
136
|
+
status:
|
137
|
+
code: 200
|
138
|
+
message: OK
|
139
|
+
headers:
|
140
|
+
Date:
|
141
|
+
- Sat, 11 May 2024 16:53:34 GMT
|
142
|
+
X-Amzn-Requestid:
|
143
|
+
- fe894c17-9a00-4c07-9a62-5bed6428e87e
|
144
|
+
Content-Type:
|
145
|
+
- application/x-amz-json-1.0
|
146
|
+
X-Amz-Crc32:
|
147
|
+
- '2745614147'
|
148
|
+
Content-Length:
|
149
|
+
- '2'
|
150
|
+
Server:
|
151
|
+
- Jetty(11.0.17)
|
152
|
+
body:
|
153
|
+
encoding: UTF-8
|
154
|
+
string: "{}"
|
155
|
+
recorded_at: Sat, 11 May 2024 16:53:34 GMT
|
156
|
+
- request:
|
157
|
+
method: post
|
158
|
+
uri: http://localhost:8000/
|
159
|
+
body:
|
160
|
+
encoding: UTF-8
|
161
|
+
string: '{"TableName":"cars-users","Item":{"car_id":{"S":"UVX455"},"user_id":{"S":"hguzman50@gmail.com"}}}'
|
162
|
+
headers:
|
163
|
+
Accept-Encoding:
|
164
|
+
- ''
|
165
|
+
Content-Type:
|
166
|
+
- application/x-amz-json-1.0
|
167
|
+
X-Amz-Target:
|
168
|
+
- DynamoDB_20120810.PutItem
|
169
|
+
User-Agent:
|
170
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
171
|
+
md/3.2.3 cfg/retry-mode#legacy
|
172
|
+
Host:
|
173
|
+
- localhost:8000
|
174
|
+
X-Amz-Date:
|
175
|
+
- 20240511T165334Z
|
176
|
+
X-Amz-Content-Sha256:
|
177
|
+
- 574742e460f05d07e61a96fe7cac4b815543db8f5aa10409003bbfe4bda5ee76
|
178
|
+
Authorization:
|
179
|
+
- AWS4-HMAC-SHA256 Credential=key/20240511/us-east-1/dynamodb/aws4_request,
|
180
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
181
|
+
Signature=1b0e6aa6d5579f630e75b404b1fa404b10779a1f191d0309c269b5a7ec0aaef2
|
182
|
+
Content-Length:
|
183
|
+
- '97'
|
184
|
+
Accept:
|
185
|
+
- "*/*"
|
186
|
+
response:
|
187
|
+
status:
|
188
|
+
code: 200
|
189
|
+
message: OK
|
190
|
+
headers:
|
191
|
+
Date:
|
192
|
+
- Sat, 11 May 2024 16:53:34 GMT
|
193
|
+
X-Amzn-Requestid:
|
194
|
+
- c735d39e-5650-4e6c-b111-8cbcfb001c75
|
195
|
+
Content-Type:
|
196
|
+
- application/x-amz-json-1.0
|
197
|
+
X-Amz-Crc32:
|
198
|
+
- '2745614147'
|
199
|
+
Content-Length:
|
200
|
+
- '2'
|
201
|
+
Server:
|
202
|
+
- Jetty(11.0.17)
|
203
|
+
body:
|
204
|
+
encoding: UTF-8
|
205
|
+
string: "{}"
|
206
|
+
recorded_at: Sat, 11 May 2024 16:53:34 GMT
|
207
|
+
recorded_with: VCR 6.2.0
|
@@ -0,0 +1,157 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:8000/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"TableName":"services","Key":{"id":{"S":"c1"}}}'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- ''
|
12
|
+
Content-Type:
|
13
|
+
- application/x-amz-json-1.0
|
14
|
+
X-Amz-Target:
|
15
|
+
- DynamoDB_20120810.GetItem
|
16
|
+
User-Agent:
|
17
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
18
|
+
md/3.2.3 cfg/retry-mode#legacy
|
19
|
+
Host:
|
20
|
+
- localhost:8000
|
21
|
+
X-Amz-Date:
|
22
|
+
- 20240510T173320Z
|
23
|
+
X-Amz-Content-Sha256:
|
24
|
+
- af39639619dd25d0ec94d9c140275bdaf272544a94c5a0d5ad74a74187a01e3c
|
25
|
+
Authorization:
|
26
|
+
- AWS4-HMAC-SHA256 Credential=key/20240510/us-east-1/dynamodb/aws4_request,
|
27
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
28
|
+
Signature=5572b10254bb03c3be61dafb3183a69c28c04297e186bd97288b8d9f542cfdbf
|
29
|
+
Content-Length:
|
30
|
+
- '48'
|
31
|
+
Accept:
|
32
|
+
- "*/*"
|
33
|
+
response:
|
34
|
+
status:
|
35
|
+
code: 200
|
36
|
+
message: OK
|
37
|
+
headers:
|
38
|
+
Date:
|
39
|
+
- Fri, 10 May 2024 17:33:20 GMT
|
40
|
+
X-Amzn-Requestid:
|
41
|
+
- c8f747ca-078d-463b-a412-bd94560bfa3b
|
42
|
+
Content-Type:
|
43
|
+
- application/x-amz-json-1.0
|
44
|
+
X-Amz-Crc32:
|
45
|
+
- '2191590297'
|
46
|
+
Content-Length:
|
47
|
+
- '76'
|
48
|
+
Server:
|
49
|
+
- Jetty(11.0.17)
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: '{"Item":{"name":{"S":"servicio"},"service_price":{"N":"0"},"id":{"S":"c1"}}}'
|
53
|
+
recorded_at: Fri, 10 May 2024 17:33:20 GMT
|
54
|
+
- request:
|
55
|
+
method: post
|
56
|
+
uri: http://localhost:8000/
|
57
|
+
body:
|
58
|
+
encoding: UTF-8
|
59
|
+
string: '{"TableName":"authorizations","IndexName":"service_id_index","KeyConditionExpression":"#service_id
|
60
|
+
= :service_id","ExpressionAttributeNames":{"#service_id":"service_id"},"ExpressionAttributeValues":{":service_id":{"S":"c1"}}}'
|
61
|
+
headers:
|
62
|
+
Accept-Encoding:
|
63
|
+
- ''
|
64
|
+
Content-Type:
|
65
|
+
- application/x-amz-json-1.0
|
66
|
+
X-Amz-Target:
|
67
|
+
- DynamoDB_20120810.Query
|
68
|
+
User-Agent:
|
69
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
70
|
+
md/3.2.3 cfg/retry-mode#legacy
|
71
|
+
Host:
|
72
|
+
- localhost:8000
|
73
|
+
X-Amz-Date:
|
74
|
+
- 20240510T173320Z
|
75
|
+
X-Amz-Content-Sha256:
|
76
|
+
- 7e4307bcc54828fddac9ef4e82db7b6a7523b3e92ea7d81617aa541348ea7378
|
77
|
+
Authorization:
|
78
|
+
- AWS4-HMAC-SHA256 Credential=key/20240510/us-east-1/dynamodb/aws4_request,
|
79
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
80
|
+
Signature=0b40cd0504bb7d062a745bc1f227fdda78866e1c91ed4f8d61bff4a4cc97ff55
|
81
|
+
Content-Length:
|
82
|
+
- '225'
|
83
|
+
Accept:
|
84
|
+
- "*/*"
|
85
|
+
response:
|
86
|
+
status:
|
87
|
+
code: 200
|
88
|
+
message: OK
|
89
|
+
headers:
|
90
|
+
Date:
|
91
|
+
- Fri, 10 May 2024 17:33:20 GMT
|
92
|
+
X-Amzn-Requestid:
|
93
|
+
- f7553ff6-790d-4983-8373-845b0fc50629
|
94
|
+
Content-Type:
|
95
|
+
- application/x-amz-json-1.0
|
96
|
+
X-Amz-Crc32:
|
97
|
+
- '1832468787'
|
98
|
+
Content-Length:
|
99
|
+
- '121'
|
100
|
+
Server:
|
101
|
+
- Jetty(11.0.17)
|
102
|
+
body:
|
103
|
+
encoding: UTF-8
|
104
|
+
string: '{"Items":[{"user_id":{"S":"hguzman10@gmail.com"},"id":{"S":"12345"},"service_id":{"S":"c1"}}],"Count":1,"ScannedCount":1}'
|
105
|
+
recorded_at: Fri, 10 May 2024 17:33:20 GMT
|
106
|
+
- request:
|
107
|
+
method: post
|
108
|
+
uri: http://localhost:8000/
|
109
|
+
body:
|
110
|
+
encoding: UTF-8
|
111
|
+
string: '{"TableName":"users","Key":{"id":{"S":"hguzman10@gmail.com"}}}'
|
112
|
+
headers:
|
113
|
+
Accept-Encoding:
|
114
|
+
- ''
|
115
|
+
Content-Type:
|
116
|
+
- application/x-amz-json-1.0
|
117
|
+
X-Amz-Target:
|
118
|
+
- DynamoDB_20120810.GetItem
|
119
|
+
User-Agent:
|
120
|
+
- aws-sdk-ruby3/3.191.3 ua/2.0 api/dynamodb#1.105.0 os/macos#20 md/x86_64 lang/ruby#3.2.3
|
121
|
+
md/3.2.3 cfg/retry-mode#legacy
|
122
|
+
Host:
|
123
|
+
- localhost:8000
|
124
|
+
X-Amz-Date:
|
125
|
+
- 20240510T173320Z
|
126
|
+
X-Amz-Content-Sha256:
|
127
|
+
- 7e2248df156bd85d1c08add1aaa7b84ed6041fe96165fb6879ddbb1424663802
|
128
|
+
Authorization:
|
129
|
+
- AWS4-HMAC-SHA256 Credential=key/20240510/us-east-1/dynamodb/aws4_request,
|
130
|
+
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
|
131
|
+
Signature=de704d4771897483997468fb25e2bb103e181e26e0f5871248c86255d40e09a3
|
132
|
+
Content-Length:
|
133
|
+
- '62'
|
134
|
+
Accept:
|
135
|
+
- "*/*"
|
136
|
+
response:
|
137
|
+
status:
|
138
|
+
code: 200
|
139
|
+
message: OK
|
140
|
+
headers:
|
141
|
+
Date:
|
142
|
+
- Fri, 10 May 2024 17:33:20 GMT
|
143
|
+
X-Amzn-Requestid:
|
144
|
+
- dc8e435e-18ca-4bd4-afb0-0f309384fe77
|
145
|
+
Content-Type:
|
146
|
+
- application/x-amz-json-1.0
|
147
|
+
X-Amz-Crc32:
|
148
|
+
- '3262869781'
|
149
|
+
Content-Length:
|
150
|
+
- '157'
|
151
|
+
Server:
|
152
|
+
- Jetty(11.0.17)
|
153
|
+
body:
|
154
|
+
encoding: UTF-8
|
155
|
+
string: '{"Item":{"created_at":{"S":"2024-05-07T14:10:09-05:00"},"id":{"S":"hguzman10@gmail.com"},"balance":{"N":"0"},"updated_at":{"S":"2024-05-07T14:10:09-05:00"}}}'
|
156
|
+
recorded_at: Fri, 10 May 2024 17:33:20 GMT
|
157
|
+
recorded_with: VCR 6.2.0
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
require 'dynamodb_record'
|
4
4
|
|
5
5
|
MODELS = File.join(File.dirname(__FILE__), 'app/models')
|
6
|
-
Dir[File.join(MODELS, '*.rb')].
|
6
|
+
Dir[File.join(MODELS, '*.rb')].each { |file| require file }
|
7
|
+
# Dir[File.join(MODELS, '*.rb')].sort.each { |file| require file }
|
7
8
|
|
8
9
|
require 'vcr'
|
9
10
|
|
@@ -11,7 +12,7 @@ VCR.configure do |c|
|
|
11
12
|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
12
13
|
c.hook_into :webmock
|
13
14
|
c.configure_rspec_metadata!
|
14
|
-
c.default_cassette_options = {
|
15
|
+
c.default_cassette_options = {match_requests_on: %i[method uri]}
|
15
16
|
# c.default_cassette_options = { match_requests_on: %i[method uri body] }
|
16
17
|
end
|
17
18
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamodb_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Guzman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-05-
|
12
|
+
date: 2024-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -165,6 +165,7 @@ extra_rdoc_files: []
|
|
165
165
|
files:
|
166
166
|
- ".github/workflows/ci.yml"
|
167
167
|
- ".gitignore"
|
168
|
+
- ".rubocop.yml"
|
168
169
|
- ".ruby-version"
|
169
170
|
- CHANGELOG.md
|
170
171
|
- Gemfile
|
@@ -178,17 +179,33 @@ files:
|
|
178
179
|
- lib/dynamodb_record/document.rb
|
179
180
|
- lib/dynamodb_record/fields.rb
|
180
181
|
- lib/dynamodb_record/finders.rb
|
182
|
+
- lib/dynamodb_record/has_and_belongs_to_many_collection.rb
|
183
|
+
- lib/dynamodb_record/has_many_collection.rb
|
184
|
+
- lib/dynamodb_record/has_many_through_collection.rb
|
185
|
+
- lib/dynamodb_record/pager.rb
|
181
186
|
- lib/dynamodb_record/persistence.rb
|
182
187
|
- lib/dynamodb_record/query.rb
|
188
|
+
- lib/dynamodb_record/query_pager.rb
|
189
|
+
- lib/dynamodb_record/scan_pager.rb
|
183
190
|
- lib/dynamodb_record/version.rb
|
184
191
|
- spec/app/models/authorization.rb
|
192
|
+
- spec/app/models/car.rb
|
193
|
+
- spec/app/models/insurance.rb
|
185
194
|
- spec/app/models/person.rb
|
195
|
+
- spec/app/models/service.rb
|
186
196
|
- spec/app/models/user.rb
|
197
|
+
- spec/dynamodb_record/association_spec.rb
|
187
198
|
- spec/dynamodb_record/document_spec.rb
|
188
199
|
- spec/dynamodb_record/fields_spec.rb
|
189
200
|
- spec/dynamodb_record/finders_spec.rb
|
190
201
|
- spec/dynamodb_record/persistence_spec.rb
|
191
202
|
- spec/dynamodb_record/query_spec.rb
|
203
|
+
- spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_belongs_to/get_object.yml
|
204
|
+
- spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_has_many/create_item.yml
|
205
|
+
- spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_has_many/get_collection.yml
|
206
|
+
- spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_and_belongs_to_many.yml
|
207
|
+
- spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_and_belongs_to_many_create.yml
|
208
|
+
- spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_many_through.yml
|
192
209
|
- spec/fixtures/vcr_cassettes/DynamodbRecord_Document/initializes_from_database.yml
|
193
210
|
- spec/fixtures/vcr_cassettes/DynamodbRecord_Fields/_find/finds_record.yml
|
194
211
|
- spec/fixtures/vcr_cassettes/DynamodbRecord_Fields/_find/when_record_doesn_t_exists/returns_empty_object.yml
|
@@ -204,7 +221,8 @@ files:
|
|
204
221
|
homepage: https://github.com/CarsOk/dynamodb-record
|
205
222
|
licenses:
|
206
223
|
- MIT
|
207
|
-
metadata:
|
224
|
+
metadata:
|
225
|
+
rubygems_mfa_required: 'true'
|
208
226
|
post_install_message:
|
209
227
|
rdoc_options: []
|
210
228
|
require_paths:
|
@@ -224,24 +242,4 @@ rubygems_version: 3.4.19
|
|
224
242
|
signing_key:
|
225
243
|
specification_version: 4
|
226
244
|
summary: A simple DynamoDB ORM
|
227
|
-
test_files:
|
228
|
-
- spec/app/models/authorization.rb
|
229
|
-
- spec/app/models/person.rb
|
230
|
-
- spec/app/models/user.rb
|
231
|
-
- spec/dynamodb_record/document_spec.rb
|
232
|
-
- spec/dynamodb_record/fields_spec.rb
|
233
|
-
- spec/dynamodb_record/finders_spec.rb
|
234
|
-
- spec/dynamodb_record/persistence_spec.rb
|
235
|
-
- spec/dynamodb_record/query_spec.rb
|
236
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Document/initializes_from_database.yml
|
237
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Fields/_find/finds_record.yml
|
238
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Fields/_find/when_record_doesn_t_exists/returns_empty_object.yml
|
239
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/_destroy/when_no_range_key/destroys_record.yml
|
240
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/_destroy/when_there_is_range_key/destroys_record.yml
|
241
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/does_not_overwrite_existing_record.yml
|
242
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/saves_record.yml
|
243
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/updates_record.yml
|
244
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Query/_all/find_all_records.yml
|
245
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Query/querying/_where/returns_records_by_limit.yml
|
246
|
-
- spec/fixtures/vcr_cassettes/DynamodbRecord_Query/querying/_where/returns_records_where_user_balance_0.yml
|
247
|
-
- spec/spec_helper.rb
|
245
|
+
test_files: []
|