dynamodb_record 0.3.1 → 0.3.3

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dynamodb_record/associations.rb +33 -33
  3. data/lib/dynamodb_record/finders.rb +0 -1
  4. data/lib/dynamodb_record/query.rb +1 -0
  5. data/lib/dynamodb_record/version.rb +1 -1
  6. data/lib/dynamodb_record.rb +1 -0
  7. data/spec/dynamodb_record/config_spec.rb +28 -0
  8. data/spec/dynamodb_record/document_spec.rb +4 -4
  9. data/spec/dynamodb_record/finders_spec.rb +7 -7
  10. data/spec/dynamodb_record/persistence_spec.rb +12 -12
  11. data/spec/dynamodb_record/query_spec.rb +2 -2
  12. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_belongs_to/get_object.yml +18 -18
  13. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_has_many/add_list.yml +108 -57
  14. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_has_many/create_item.yml +28 -27
  15. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/_has_many/get_collection.yml +19 -18
  16. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_and_belongs_to_many.yml +31 -31
  17. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_and_belongs_to_many_create.yml +91 -39
  18. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Associations/has_many_through.yml +30 -27
  19. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Document/initializes_from_database.yml +11 -11
  20. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Fields/_find/finds_record.yml +12 -12
  21. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Fields/_find/when_record_doesn_t_exists/returns_empty_object.yml +9 -9
  22. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/_destroy/when_no_range_key/destroys_record.yml +30 -30
  23. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/_destroy/when_there_is_range_key/destroys_record.yml +9 -111
  24. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/does_not_overwrite_existing_record.yml +20 -20
  25. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/saves_record.yml +9 -9
  26. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Persistence/updates_record.yml +31 -31
  27. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Query/_all/find_all_records.yml +12 -12
  28. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Query/querying/_where/returns_records_by_limit.yml +12 -12
  29. data/spec/fixtures/vcr_cassettes/DynamodbRecord_Query/querying/_where/returns_records_where_user_balance_0.yml +12 -12
  30. data/spec/spec_helper.rb +7 -6
  31. metadata +3 -2
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: http://localhost:8000/
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"TableName":"users"}'
8
+ string: '{"TableName":"fleteo-v2-users"}'
9
9
  headers:
10
10
  Accept-Encoding:
11
11
  - ''
@@ -19,15 +19,15 @@ http_interactions:
19
19
  Host:
20
20
  - localhost:8000
21
21
  X-Amz-Date:
22
- - 20240502T233108Z
22
+ - 20240514T152305Z
23
23
  X-Amz-Content-Sha256:
24
- - 4beda0215c9ab83d1b5bba1ba2744d5a230ca7b206aad0ffee3f6bdabcff87c5
24
+ - 9dec864d69838ba5d22e6418808d299b1e52448b13f38b3347adcc4cd4891407
25
25
  Authorization:
26
- - AWS4-HMAC-SHA256 Credential=key/20240502/us-east-1/dynamodb/aws4_request,
26
+ - AWS4-HMAC-SHA256 Credential=key/20240514/us-east-1/dynamodb/aws4_request,
27
27
  SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
28
- Signature=3c16286960a3799524892b4f88f09834f964adeed8923815f8a6e82884e3ee47
28
+ Signature=749f5b5fb627b4138d9a86e0b77f36a5339897e9341909dc02b810373757672d
29
29
  Content-Length:
30
- - '21'
30
+ - '31'
31
31
  Accept:
32
32
  - "*/*"
33
33
  response:
@@ -36,19 +36,19 @@ http_interactions:
36
36
  message: OK
37
37
  headers:
38
38
  Date:
39
- - Thu, 02 May 2024 23:31:08 GMT
39
+ - Tue, 14 May 2024 15:23:05 GMT
40
40
  X-Amzn-Requestid:
41
- - 4379a646-85d4-4f6b-ba53-d7edfabd1ec2
41
+ - 5b5f67db-aa09-41cd-a1df-ad59eb8bd4ab
42
42
  Content-Type:
43
43
  - application/x-amz-json-1.0
44
44
  X-Amz-Crc32:
45
- - '2922398473'
45
+ - '2883154713'
46
46
  Content-Length:
47
- - '111'
47
+ - '222'
48
48
  Server:
49
49
  - Jetty(11.0.17)
50
50
  body:
51
51
  encoding: UTF-8
52
- string: '{"Items":[{"balance":{"N":"0"},"token":{"N":"0"},"id":{"S":"hguzman20@gmail.com"}}],"Count":1,"ScannedCount":1}'
53
- recorded_at: Thu, 02 May 2024 23:31:08 GMT
52
+ string: '{"Items":[{"id":{"S":"hguzman20@gmail.com"}},{"created_at":{"S":"2024-05-08T12:22:30-05:00"},"id":{"S":"hguzman30@gmail.com"},"balance":{"N":"0"},"updated_at":{"S":"2024-05-08T12:22:30-05:00"}}],"Count":2,"ScannedCount":2}'
53
+ recorded_at: Tue, 14 May 2024 15:23:05 GMT
54
54
  recorded_with: VCR 6.2.0
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: http://localhost:8000/
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"TableName":"users","Limit":1,"ExpressionAttributeNames":{"#balance":"balance"},"ExpressionAttributeValues":{":balance":{"N":"0"}},"FilterExpression":"#balance
8
+ string: '{"TableName":"fleteo-v2-users","Limit":1,"ExpressionAttributeNames":{"#balance":"balance"},"ExpressionAttributeValues":{":balance":{"N":"0"}},"FilterExpression":"#balance
9
9
  = :balance"}'
10
10
  headers:
11
11
  Accept-Encoding:
@@ -20,15 +20,15 @@ http_interactions:
20
20
  Host:
21
21
  - localhost:8000
22
22
  X-Amz-Date:
23
- - 20240502T230053Z
23
+ - 20240514T153259Z
24
24
  X-Amz-Content-Sha256:
25
- - 3251e11bdd19fdce2e7d146498b881bbbc65f57b12aa6ad4cb1443d5cda934f1
25
+ - 4a817ea4a9315bf50e176703f307eb0ecd51182faecce44db7fbc3456b7b810b
26
26
  Authorization:
27
- - AWS4-HMAC-SHA256 Credential=AKIAV3OBKSDM5UO5PK5A/20240502/us-east-1/dynamodb/aws4_request,
27
+ - AWS4-HMAC-SHA256 Credential=key/20240514/us-east-1/dynamodb/aws4_request,
28
28
  SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
29
- Signature=d4e6a9939d2f6d6a3de5d87294a73e1d5a18160524ef4a01c4c562777a21bc23
29
+ Signature=3b0bee5c42907ed6f8c46535d5979012b376c30597ae870b6a29a63713a9ddf5
30
30
  Content-Length:
31
- - '173'
31
+ - '183'
32
32
  Accept:
33
33
  - "*/*"
34
34
  response:
@@ -37,19 +37,19 @@ http_interactions:
37
37
  message: OK
38
38
  headers:
39
39
  Date:
40
- - Thu, 02 May 2024 23:00:53 GMT
40
+ - Tue, 14 May 2024 15:32:59 GMT
41
41
  X-Amzn-Requestid:
42
- - f4c8a18f-9421-41e1-82e0-084fda5e62d9
42
+ - 9df141bf-61b8-4255-bf5c-3f567a0adbe2
43
43
  Content-Type:
44
44
  - application/x-amz-json-1.0
45
45
  X-Amz-Crc32:
46
- - '2270305145'
46
+ - '599331903'
47
47
  Content-Length:
48
- - '165'
48
+ - '147'
49
49
  Server:
50
50
  - Jetty(11.0.17)
51
51
  body:
52
52
  encoding: UTF-8
53
- string: '{"Items":[{"balance":{"N":"0"},"token":{"N":"0"},"id":{"S":"hguzman20@gmail.com"}}],"Count":1,"ScannedCount":1,"LastEvaluatedKey":{"id":{"S":"hguzman20@gmail.com"}}}'
54
- recorded_at: Thu, 02 May 2024 23:00:53 GMT
53
+ string: '{"Items":[{"balance":{"N":"0"},"id":{"S":"hguzman20@gmail.com"}}],"Count":1,"ScannedCount":1,"LastEvaluatedKey":{"id":{"S":"hguzman20@gmail.com"}}}'
54
+ recorded_at: Tue, 14 May 2024 15:32:59 GMT
55
55
  recorded_with: VCR 6.2.0
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: http://localhost:8000/
6
6
  body:
7
7
  encoding: UTF-8
8
- string: '{"TableName":"users","Limit":1,"ExpressionAttributeNames":{"#balance":"balance"},"ExpressionAttributeValues":{":balance":{"N":"0"}},"FilterExpression":"#balance
8
+ string: '{"TableName":"fleteo-v2-users","Limit":1,"ExpressionAttributeNames":{"#balance":"balance"},"ExpressionAttributeValues":{":balance":{"N":"0"}},"FilterExpression":"#balance
9
9
  = :balance"}'
10
10
  headers:
11
11
  Accept-Encoding:
@@ -20,15 +20,15 @@ http_interactions:
20
20
  Host:
21
21
  - localhost:8000
22
22
  X-Amz-Date:
23
- - 20240502T225836Z
23
+ - 20240514T153259Z
24
24
  X-Amz-Content-Sha256:
25
- - 3251e11bdd19fdce2e7d146498b881bbbc65f57b12aa6ad4cb1443d5cda934f1
25
+ - 4a817ea4a9315bf50e176703f307eb0ecd51182faecce44db7fbc3456b7b810b
26
26
  Authorization:
27
- - AWS4-HMAC-SHA256 Credential=AKIAV3OBKSDM5UO5PK5A/20240502/us-east-1/dynamodb/aws4_request,
27
+ - AWS4-HMAC-SHA256 Credential=key/20240514/us-east-1/dynamodb/aws4_request,
28
28
  SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-target,
29
- Signature=43c96e9e8cc7e2db0b5aca42322fa559c7f2766689a3ea1b527256ea5a7dbee3
29
+ Signature=3b0bee5c42907ed6f8c46535d5979012b376c30597ae870b6a29a63713a9ddf5
30
30
  Content-Length:
31
- - '173'
31
+ - '183'
32
32
  Accept:
33
33
  - "*/*"
34
34
  response:
@@ -37,19 +37,19 @@ http_interactions:
37
37
  message: OK
38
38
  headers:
39
39
  Date:
40
- - Thu, 02 May 2024 22:58:36 GMT
40
+ - Tue, 14 May 2024 15:32:59 GMT
41
41
  X-Amzn-Requestid:
42
- - fc0e4805-bf6c-4190-9f20-eb06f8c72555
42
+ - 59b0840f-6a56-49bd-953f-d22946459e02
43
43
  Content-Type:
44
44
  - application/x-amz-json-1.0
45
45
  X-Amz-Crc32:
46
- - '2270305145'
46
+ - '599331903'
47
47
  Content-Length:
48
- - '165'
48
+ - '147'
49
49
  Server:
50
50
  - Jetty(11.0.17)
51
51
  body:
52
52
  encoding: UTF-8
53
- string: '{"Items":[{"balance":{"N":"0"},"token":{"N":"0"},"id":{"S":"hguzman20@gmail.com"}}],"Count":1,"ScannedCount":1,"LastEvaluatedKey":{"id":{"S":"hguzman20@gmail.com"}}}'
54
- recorded_at: Thu, 02 May 2024 22:58:36 GMT
53
+ string: '{"Items":[{"balance":{"N":"0"},"id":{"S":"hguzman20@gmail.com"}}],"Count":1,"ScannedCount":1,"LastEvaluatedKey":{"id":{"S":"hguzman20@gmail.com"}}}'
54
+ recorded_at: Tue, 14 May 2024 15:32:59 GMT
55
55
  recorded_with: VCR 6.2.0
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  require 'dynamodb_record'
4
4
 
5
+ DynamodbRecord.configure do |config|
6
+ config.namespace = 'fleteo-v2'
7
+ config.endpoint = 'http://localhost:8000'
8
+ config.access_key_id = ENV['DYNAMODB_KEY'] || 'key'
9
+ config.secret_access_key = ENV['DYNAMODB_SECRET'] || 'secret'
10
+ end
11
+
5
12
  MODELS = File.join(File.dirname(__FILE__), 'app/models')
6
13
  Dir[File.join(MODELS, '*.rb')].each { |file| require file }
7
14
  # Dir[File.join(MODELS, '*.rb')].sort.each { |file| require file }
@@ -16,9 +23,3 @@ VCR.configure do |c|
16
23
  # c.default_cassette_options = { match_requests_on: %i[method uri body] }
17
24
  end
18
25
 
19
- DynamodbRecord.configure do |config|
20
- config.namespace = nil
21
- config.endpoint = 'http://localhost:8000'
22
- config.access_key_id = ENV['DYNAMODB_KEY'] || 'key'
23
- config.secret_access_key = ENV['DYNAMODB_SECRET'] || 'secret'
24
- end
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.3.1
4
+ version: 0.3.3
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-13 00:00:00.000000000 Z
12
+ date: 2024-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -195,6 +195,7 @@ files:
195
195
  - spec/app/models/service.rb
196
196
  - spec/app/models/user.rb
197
197
  - spec/dynamodb_record/association_spec.rb
198
+ - spec/dynamodb_record/config_spec.rb
198
199
  - spec/dynamodb_record/document_spec.rb
199
200
  - spec/dynamodb_record/fields_spec.rb
200
201
  - spec/dynamodb_record/finders_spec.rb