dynamo_record 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +31 -0
  6. data/Rakefile +7 -0
  7. data/dynamo_record.gemspec +28 -0
  8. data/lib/dynamo_record/collection.rb +31 -0
  9. data/lib/dynamo_record/config.rb +15 -0
  10. data/lib/dynamo_record/document.rb +32 -0
  11. data/lib/dynamo_record/fields.rb +31 -0
  12. data/lib/dynamo_record/finders.rb +17 -0
  13. data/lib/dynamo_record/persistence.rb +85 -0
  14. data/lib/dynamo_record/query.rb +29 -0
  15. data/lib/dynamo_record/version.rb +3 -0
  16. data/lib/dynamo_record.rb +25 -0
  17. data/spec/app/models/address.rb +5 -0
  18. data/spec/app/models/person.rb +5 -0
  19. data/spec/dynamo_record/collection_spec.rb +21 -0
  20. data/spec/dynamo_record/config_spec.rb +25 -0
  21. data/spec/dynamo_record/document_spec.rb +19 -0
  22. data/spec/dynamo_record/fields_spec.rb +29 -0
  23. data/spec/dynamo_record/finders_spec.rb +20 -0
  24. data/spec/dynamo_record/persistence_spec.rb +89 -0
  25. data/spec/dynamo_record/query_spec.rb +58 -0
  26. data/spec/dynamo_record_spec.rb +5 -0
  27. data/spec/fixtures/vcr_cassettes/DynamoRecord_Document/initializes_from_database.yml +52 -0
  28. data/spec/fixtures/vcr_cassettes/DynamoRecord_Fields/_find/finds_record.yml +52 -0
  29. data/spec/fixtures/vcr_cassettes/DynamoRecord_Fields/_find/when_record_doesn_t_exists/returns_empty_object.yml +52 -0
  30. data/spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/with_index/creates_table.yml +52 -0
  31. data/spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/without_index/creates_table.yml +52 -0
  32. data/spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/does_not_overwrite_existing_record.yml +103 -0
  33. data/spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/updates_record.yml +150 -0
  34. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records.yml +54 -0
  35. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records_with_limie.yml +52 -0
  36. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records_with_limit.yml +52 -0
  37. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/paginates_records.yml +52 -0
  38. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/enumerates_all_pages.yml +199 -0
  39. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/navigates_to_next_page.yml +101 -0
  40. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/tells_if_there_is_a_next_page.yml +52 -0
  41. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/_query/queries_by_condition.yml +53 -0
  42. data/spec/fixtures/vcr_cassettes/DynamoRecord_Query/querying/_where/queries_by_condition.yml +53 -0
  43. data/spec/spec_helper.rb +18 -0
  44. metadata +211 -0
@@ -0,0 +1,53 @@
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","KeyConditions":{"name":{"AttributeValueList":[{"S":"Person
9
+ 2"}],"ComparisonOperator":"EQ"}},"IndexName":"name-index"}'
10
+ headers:
11
+ Content-Type:
12
+ - application/x-amz-json-1.0
13
+ Accept-Encoding:
14
+ - ''
15
+ User-Agent:
16
+ - aws-sdk-ruby2/2.0.17 ruby/2.1.2 x86_64-darwin14.0
17
+ X-Amz-Target:
18
+ - DynamoDB_20120810.Query
19
+ X-Amz-Date:
20
+ - 20141231T085539Z
21
+ Host:
22
+ - dynamodb.us-east-1.amazonaws.com
23
+ X-Amz-Content-Sha256:
24
+ - ff6d076e5a2413b9a7418bff017d084acec8dd4d4c60130cdec7a10d31bbb509
25
+ Authorization:
26
+ - AWS4-HMAC-SHA256 Credential=key/20141231/us-east-1/dynamodb/aws4_request,
27
+ SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target,
28
+ Signature=d5f28292bfc3a2fd70c69cbb4db87b15087f92b1b4b4f656036db8005c4a3854
29
+ Content-Length:
30
+ - '140'
31
+ Accept:
32
+ - "*/*"
33
+ response:
34
+ status:
35
+ code: 200
36
+ message: OK
37
+ headers:
38
+ X-Amzn-Requestid:
39
+ - KSCIU2Q8KNE6JDTJO67BT0FAVFVV4KQNSO5AEMVJF66Q9ASUAAJG
40
+ X-Amz-Crc32:
41
+ - '2069429624'
42
+ Content-Type:
43
+ - application/x-amz-json-1.0
44
+ Content-Length:
45
+ - '114'
46
+ Date:
47
+ - Wed, 31 Dec 2014 08:55:40 GMT
48
+ body:
49
+ encoding: UTF-8
50
+ string: '{"Count":1,"Items":[{"name":{"S":"Person 2"},"id":{"S":"611b5bc7-849f-4e0c-b969-5b53b6f2d0e2"}}],"ScannedCount":1}'
51
+ http_version:
52
+ recorded_at: Wed, 31 Dec 2014 08:55:41 GMT
53
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,18 @@
1
+ require 'dynamo_record'
2
+
3
+ MODELS = File.join(File.dirname(__FILE__), "app/models")
4
+ Dir[ File.join(MODELS, "*.rb") ].sort.each { |file| require file }
5
+
6
+ require 'vcr'
7
+
8
+ VCR.configure do |c|
9
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
10
+ c.hook_into :webmock
11
+ c.configure_rspec_metadata!
12
+ c.default_cassette_options = { match_requests_on: [:method,:uri,:body] }
13
+ end
14
+
15
+ DynamoRecord.configure do |config|
16
+ config.access_key_id = 'key'
17
+ config.secret_access_key = 'secret'
18
+ end
metadata ADDED
@@ -0,0 +1,211 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dynamo_record
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nguyen Vu Nguyen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.17.pre
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.17.pre
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.1.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.1.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.9.3
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.9.3
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.20.4
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.20.4
111
+ description:
112
+ email:
113
+ - nvunguyen@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - Gemfile
120
+ - LICENSE.txt
121
+ - README.md
122
+ - Rakefile
123
+ - dynamo_record.gemspec
124
+ - lib/dynamo_record.rb
125
+ - lib/dynamo_record/collection.rb
126
+ - lib/dynamo_record/config.rb
127
+ - lib/dynamo_record/document.rb
128
+ - lib/dynamo_record/fields.rb
129
+ - lib/dynamo_record/finders.rb
130
+ - lib/dynamo_record/persistence.rb
131
+ - lib/dynamo_record/query.rb
132
+ - lib/dynamo_record/version.rb
133
+ - spec/app/models/address.rb
134
+ - spec/app/models/person.rb
135
+ - spec/dynamo_record/collection_spec.rb
136
+ - spec/dynamo_record/config_spec.rb
137
+ - spec/dynamo_record/document_spec.rb
138
+ - spec/dynamo_record/fields_spec.rb
139
+ - spec/dynamo_record/finders_spec.rb
140
+ - spec/dynamo_record/persistence_spec.rb
141
+ - spec/dynamo_record/query_spec.rb
142
+ - spec/dynamo_record_spec.rb
143
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Document/initializes_from_database.yml
144
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Fields/_find/finds_record.yml
145
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Fields/_find/when_record_doesn_t_exists/returns_empty_object.yml
146
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/with_index/creates_table.yml
147
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/without_index/creates_table.yml
148
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/does_not_overwrite_existing_record.yml
149
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/updates_record.yml
150
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records.yml
151
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records_with_limie.yml
152
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records_with_limit.yml
153
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/paginates_records.yml
154
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/enumerates_all_pages.yml
155
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/navigates_to_next_page.yml
156
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/tells_if_there_is_a_next_page.yml
157
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_query/queries_by_condition.yml
158
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/querying/_where/queries_by_condition.yml
159
+ - spec/spec_helper.rb
160
+ homepage: ''
161
+ licenses:
162
+ - MIT
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.2.2
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: A simple DynamoDB ORM wrapper on top of aws-sdk v2
184
+ test_files:
185
+ - spec/app/models/address.rb
186
+ - spec/app/models/person.rb
187
+ - spec/dynamo_record/collection_spec.rb
188
+ - spec/dynamo_record/config_spec.rb
189
+ - spec/dynamo_record/document_spec.rb
190
+ - spec/dynamo_record/fields_spec.rb
191
+ - spec/dynamo_record/finders_spec.rb
192
+ - spec/dynamo_record/persistence_spec.rb
193
+ - spec/dynamo_record/query_spec.rb
194
+ - spec/dynamo_record_spec.rb
195
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Document/initializes_from_database.yml
196
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Fields/_find/finds_record.yml
197
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Fields/_find/when_record_doesn_t_exists/returns_empty_object.yml
198
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/with_index/creates_table.yml
199
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/_create_table/without_index/creates_table.yml
200
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/does_not_overwrite_existing_record.yml
201
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Persistence/updates_record.yml
202
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records.yml
203
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records_with_limie.yml
204
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/find_all_records_with_limit.yml
205
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/paginates_records.yml
206
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/enumerates_all_pages.yml
207
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/navigates_to_next_page.yml
208
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_all/pagination/tells_if_there_is_a_next_page.yml
209
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/_query/queries_by_condition.yml
210
+ - spec/fixtures/vcr_cassettes/DynamoRecord_Query/querying/_where/queries_by_condition.yml
211
+ - spec/spec_helper.rb