adept_dynamoid 0.5.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Dynamoid.gemspec +193 -0
  4. data/Gemfile +23 -0
  5. data/Gemfile.lock +86 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.markdown +265 -0
  8. data/Rakefile +62 -0
  9. data/VERSION +1 -0
  10. data/doc/.nojekyll +0 -0
  11. data/doc/Dynamoid.html +312 -0
  12. data/doc/Dynamoid/Adapter.html +1385 -0
  13. data/doc/Dynamoid/Adapter/AwsSdk.html +1585 -0
  14. data/doc/Dynamoid/Adapter/Local.html +1574 -0
  15. data/doc/Dynamoid/Associations.html +131 -0
  16. data/doc/Dynamoid/Associations/Association.html +794 -0
  17. data/doc/Dynamoid/Associations/BelongsTo.html +158 -0
  18. data/doc/Dynamoid/Associations/ClassMethods.html +723 -0
  19. data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +164 -0
  20. data/doc/Dynamoid/Associations/HasMany.html +164 -0
  21. data/doc/Dynamoid/Associations/HasOne.html +158 -0
  22. data/doc/Dynamoid/Associations/ManyAssociation.html +1640 -0
  23. data/doc/Dynamoid/Associations/SingleAssociation.html +598 -0
  24. data/doc/Dynamoid/Components.html +204 -0
  25. data/doc/Dynamoid/Config.html +395 -0
  26. data/doc/Dynamoid/Config/Options.html +609 -0
  27. data/doc/Dynamoid/Criteria.html +131 -0
  28. data/doc/Dynamoid/Criteria/Chain.html +1063 -0
  29. data/doc/Dynamoid/Criteria/ClassMethods.html +98 -0
  30. data/doc/Dynamoid/Document.html +666 -0
  31. data/doc/Dynamoid/Document/ClassMethods.html +937 -0
  32. data/doc/Dynamoid/Errors.html +118 -0
  33. data/doc/Dynamoid/Errors/DocumentNotValid.html +210 -0
  34. data/doc/Dynamoid/Errors/Error.html +130 -0
  35. data/doc/Dynamoid/Errors/InvalidField.html +133 -0
  36. data/doc/Dynamoid/Errors/MissingRangeKey.html +133 -0
  37. data/doc/Dynamoid/Fields.html +669 -0
  38. data/doc/Dynamoid/Fields/ClassMethods.html +309 -0
  39. data/doc/Dynamoid/Finders.html +128 -0
  40. data/doc/Dynamoid/Finders/ClassMethods.html +516 -0
  41. data/doc/Dynamoid/Indexes.html +308 -0
  42. data/doc/Dynamoid/Indexes/ClassMethods.html +353 -0
  43. data/doc/Dynamoid/Indexes/Index.html +1104 -0
  44. data/doc/Dynamoid/Persistence.html +651 -0
  45. data/doc/Dynamoid/Persistence/ClassMethods.html +670 -0
  46. data/doc/Dynamoid/Validations.html +399 -0
  47. data/doc/_index.html +461 -0
  48. data/doc/class_list.html +47 -0
  49. data/doc/css/common.css +1 -0
  50. data/doc/css/full_list.css +55 -0
  51. data/doc/css/style.css +322 -0
  52. data/doc/file.LICENSE.html +66 -0
  53. data/doc/file.README.html +312 -0
  54. data/doc/file_list.html +52 -0
  55. data/doc/frames.html +13 -0
  56. data/doc/index.html +312 -0
  57. data/doc/js/app.js +205 -0
  58. data/doc/js/full_list.js +173 -0
  59. data/doc/js/jquery.js +16 -0
  60. data/doc/method_list.html +1238 -0
  61. data/doc/top-level-namespace.html +105 -0
  62. data/lib/dynamoid.rb +47 -0
  63. data/lib/dynamoid/adapter.rb +177 -0
  64. data/lib/dynamoid/adapter/aws_sdk.rb +223 -0
  65. data/lib/dynamoid/associations.rb +106 -0
  66. data/lib/dynamoid/associations/association.rb +105 -0
  67. data/lib/dynamoid/associations/belongs_to.rb +44 -0
  68. data/lib/dynamoid/associations/has_and_belongs_to_many.rb +40 -0
  69. data/lib/dynamoid/associations/has_many.rb +39 -0
  70. data/lib/dynamoid/associations/has_one.rb +39 -0
  71. data/lib/dynamoid/associations/many_association.rb +191 -0
  72. data/lib/dynamoid/associations/single_association.rb +69 -0
  73. data/lib/dynamoid/components.rb +36 -0
  74. data/lib/dynamoid/config.rb +57 -0
  75. data/lib/dynamoid/config/options.rb +78 -0
  76. data/lib/dynamoid/criteria.rb +29 -0
  77. data/lib/dynamoid/criteria/chain.rb +243 -0
  78. data/lib/dynamoid/dirty.rb +41 -0
  79. data/lib/dynamoid/document.rb +184 -0
  80. data/lib/dynamoid/errors.rb +28 -0
  81. data/lib/dynamoid/fields.rb +130 -0
  82. data/lib/dynamoid/finders.rb +131 -0
  83. data/lib/dynamoid/identity_map.rb +96 -0
  84. data/lib/dynamoid/indexes.rb +69 -0
  85. data/lib/dynamoid/indexes/index.rb +103 -0
  86. data/lib/dynamoid/middleware/identity_map.rb +16 -0
  87. data/lib/dynamoid/persistence.rb +247 -0
  88. data/lib/dynamoid/validations.rb +36 -0
  89. data/spec/app/models/address.rb +10 -0
  90. data/spec/app/models/camel_case.rb +24 -0
  91. data/spec/app/models/magazine.rb +11 -0
  92. data/spec/app/models/message.rb +9 -0
  93. data/spec/app/models/sponsor.rb +8 -0
  94. data/spec/app/models/subscription.rb +12 -0
  95. data/spec/app/models/tweet.rb +12 -0
  96. data/spec/app/models/user.rb +26 -0
  97. data/spec/dynamoid/adapter/aws_sdk_spec.rb +186 -0
  98. data/spec/dynamoid/adapter_spec.rb +117 -0
  99. data/spec/dynamoid/associations/association_spec.rb +194 -0
  100. data/spec/dynamoid/associations/belongs_to_spec.rb +71 -0
  101. data/spec/dynamoid/associations/has_and_belongs_to_many_spec.rb +47 -0
  102. data/spec/dynamoid/associations/has_many_spec.rb +42 -0
  103. data/spec/dynamoid/associations/has_one_spec.rb +45 -0
  104. data/spec/dynamoid/associations_spec.rb +16 -0
  105. data/spec/dynamoid/config_spec.rb +27 -0
  106. data/spec/dynamoid/criteria/chain_spec.rb +140 -0
  107. data/spec/dynamoid/criteria_spec.rb +72 -0
  108. data/spec/dynamoid/dirty_spec.rb +49 -0
  109. data/spec/dynamoid/document_spec.rb +118 -0
  110. data/spec/dynamoid/fields_spec.rb +127 -0
  111. data/spec/dynamoid/finders_spec.rb +135 -0
  112. data/spec/dynamoid/identity_map_spec.rb +45 -0
  113. data/spec/dynamoid/indexes/index_spec.rb +104 -0
  114. data/spec/dynamoid/indexes_spec.rb +25 -0
  115. data/spec/dynamoid/persistence_spec.rb +176 -0
  116. data/spec/dynamoid/validations_spec.rb +36 -0
  117. data/spec/dynamoid_spec.rb +9 -0
  118. data/spec/spec_helper.rb +50 -0
  119. metadata +376 -0
@@ -0,0 +1,1585 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Dynamoid::Adapter::AwsSdk
8
+
9
+ &mdash; Documentation by YARD 0.7.5
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '../..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../../_index.html">Index (A)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Adapter.html" title="Dynamoid::Adapter (module)">Adapter</a></span></span>
38
+ &raquo;
39
+ <span class="title">AwsSdk</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: Dynamoid::Adapter::AwsSdk
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+ <dt class="r1">Extended by:</dt>
70
+ <dd class="r1"><span class='object_link'><a href="" title="Dynamoid::Adapter::AwsSdk (module)">AwsSdk</a></span></dd>
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dt class="r2">Included in:</dt>
78
+ <dd class="r2"><span class='object_link'><a href="" title="Dynamoid::Adapter::AwsSdk (module)">AwsSdk</a></span></dd>
79
+
80
+
81
+
82
+ <dt class="r1 last">Defined in:</dt>
83
+ <dd class="r1 last">lib/dynamoid/adapter/aws_sdk.rb</dd>
84
+
85
+ </dl>
86
+ <div class="clear"></div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+ <p>The AwsSdk adapter provides support for the AWS-SDK for Ruby gem.
91
+ More information is available at that Gem's Github page:
92
+ <a href="https://github.com/amazonwebservices/aws-sdk-for-ruby">https://github.com/amazonwebservices/aws-sdk-for-ruby</a></p>
93
+
94
+
95
+ </div>
96
+ </div>
97
+ <div class="tags">
98
+
99
+
100
+ </div>
101
+ <h2>Constant Summary</h2>
102
+
103
+ <dl class="constants">
104
+
105
+ <dt id="connection-classvariable" class="">@@connection =
106
+
107
+ </dt>
108
+ <dd><pre class="code"><span class='kw'>nil</span></pre></dd>
109
+
110
+ </dl>
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ <h2>
121
+ Instance Method Summary
122
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
123
+ </h2>
124
+
125
+ <ul class="summary">
126
+
127
+ <li class="public ">
128
+ <span class="summary_signature">
129
+
130
+ <a href="#batch_get_item-instance_method" title="#batch_get_item (instance method)">- (Hash) <strong>batch_get_item</strong>(options) </a>
131
+
132
+
133
+
134
+ </span>
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+ <span class="summary_desc"><div class='inline'><p>Get many items at once from DynamoDB.</p>
144
+ </div></span>
145
+
146
+ </li>
147
+
148
+
149
+ <li class="public ">
150
+ <span class="summary_signature">
151
+
152
+ <a href="#connect%21-instance_method" title="#connect! (instance method)">- (AWS::DynamoDB::Connection) <strong>connect!</strong> </a>
153
+
154
+
155
+
156
+ </span>
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+ <span class="summary_desc"><div class='inline'><p>Establish the connection to DynamoDB.</p>
166
+ </div></span>
167
+
168
+ </li>
169
+
170
+
171
+ <li class="public ">
172
+ <span class="summary_signature">
173
+
174
+ <a href="#connection-instance_method" title="#connection (instance method)">- (AWS::DynamoDB::Connection) <strong>connection</strong> </a>
175
+
176
+
177
+
178
+ </span>
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+ <span class="summary_desc"><div class='inline'><p>Return the established connection.</p>
188
+ </div></span>
189
+
190
+ </li>
191
+
192
+
193
+ <li class="public ">
194
+ <span class="summary_signature">
195
+
196
+ <a href="#create_table-instance_method" title="#create_table (instance method)">- (Object) <strong>create_table</strong>(table_name, key = :id, options = {}) </a>
197
+
198
+
199
+
200
+ </span>
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ <span class="summary_desc"><div class='inline'><p>Create a table on DynamoDB.</p>
210
+ </div></span>
211
+
212
+ </li>
213
+
214
+
215
+ <li class="public ">
216
+ <span class="summary_signature">
217
+
218
+ <a href="#delete_item-instance_method" title="#delete_item (instance method)">- (Object) <strong>delete_item</strong>(table_name, key, options = {}) </a>
219
+
220
+
221
+
222
+ </span>
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+ <span class="summary_desc"><div class='inline'><p>Removes an item from DynamoDB.</p>
232
+ </div></span>
233
+
234
+ </li>
235
+
236
+
237
+ <li class="public ">
238
+ <span class="summary_signature">
239
+
240
+ <a href="#delete_table-instance_method" title="#delete_table (instance method)">- (Object) <strong>delete_table</strong>(table_name) </a>
241
+
242
+
243
+
244
+ </span>
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+ <span class="summary_desc"><div class='inline'><p>Deletes an entire table from DynamoDB.</p>
254
+ </div></span>
255
+
256
+ </li>
257
+
258
+
259
+ <li class="public ">
260
+ <span class="summary_signature">
261
+
262
+ <a href="#get_item-instance_method" title="#get_item (instance method)">- (Object) <strong>get_item</strong>(table_name, key, options = {}) </a>
263
+
264
+
265
+
266
+ </span>
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+ <span class="summary_desc"><div class='inline'></div></span>
276
+
277
+ </li>
278
+
279
+
280
+ <li class="public ">
281
+ <span class="summary_signature">
282
+
283
+ <a href="#get_table-instance_method" title="#get_table (instance method)">- (Object) <strong>get_table</strong>(table_name) </a>
284
+
285
+
286
+
287
+ </span>
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+ <span class="summary_desc"><div class='inline'></div></span>
297
+
298
+ </li>
299
+
300
+
301
+ <li class="public ">
302
+ <span class="summary_signature">
303
+
304
+ <a href="#list_tables-instance_method" title="#list_tables (instance method)">- (Object) <strong>list_tables</strong> </a>
305
+
306
+
307
+
308
+ </span>
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+ <span class="summary_desc"><div class='inline'><p>List all tables on DynamoDB.</p>
318
+ </div></span>
319
+
320
+ </li>
321
+
322
+
323
+ <li class="public ">
324
+ <span class="summary_signature">
325
+
326
+ <a href="#put_item-instance_method" title="#put_item (instance method)">- (Object) <strong>put_item</strong>(table_name, object) </a>
327
+
328
+
329
+
330
+ </span>
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+ <span class="summary_desc"><div class='inline'><p>Persists an item on DynamoDB.</p>
340
+ </div></span>
341
+
342
+ </li>
343
+
344
+
345
+ <li class="public ">
346
+ <span class="summary_signature">
347
+
348
+ <a href="#query-instance_method" title="#query (instance method)">- (Array) <strong>query</strong>(table_name, opts = {}) </a>
349
+
350
+
351
+
352
+ </span>
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+ <span class="summary_desc"><div class='inline'><p>Query the DynamoDB table.</p>
362
+ </div></span>
363
+
364
+ </li>
365
+
366
+
367
+ <li class="public ">
368
+ <span class="summary_signature">
369
+
370
+ <a href="#scan-instance_method" title="#scan (instance method)">- (Array) <strong>scan</strong>(table_name, scan_hash, select_opts) </a>
371
+
372
+
373
+
374
+ </span>
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+ <span class="summary_desc"><div class='inline'><p>Scan the DynamoDB table.</p>
384
+ </div></span>
385
+
386
+ </li>
387
+
388
+
389
+ <li class="public ">
390
+ <span class="summary_signature">
391
+
392
+ <a href="#table_cache-instance_method" title="#table_cache (instance method)">- (Object) <strong>table_cache</strong> </a>
393
+
394
+
395
+
396
+ </span>
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+ <span class="summary_desc"><div class='inline'></div></span>
406
+
407
+ </li>
408
+
409
+
410
+ </ul>
411
+
412
+
413
+
414
+
415
+ <div id="instance_method_details" class="method_details_list">
416
+ <h2>Instance Method Details</h2>
417
+
418
+
419
+ <div class="method_details first">
420
+ <p class="signature first" id="batch_get_item-instance_method">
421
+
422
+ - (<tt>Hash</tt>) <strong>batch_get_item</strong>(options)
423
+
424
+
425
+
426
+ </p><div class="docstring">
427
+ <div class="discussion">
428
+ <p>Get many items at once from DynamoDB. More efficient than getting each item individually.</p>
429
+
430
+
431
+ </div>
432
+ </div>
433
+ <div class="tags">
434
+
435
+ <div class="examples">
436
+ <h3>Examples:</h3>
437
+
438
+ <h4><div class='inline'><p>Retrieve IDs 1 and 2 from the table testtable</p>
439
+ </div></h4>
440
+ <pre class="example code"><span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='op'>::</span><span class='const'>AwsSdk</span><span class='period'>.</span><span class='id identifier rubyid_batch_get_item'>batch_get_item</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>table1</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>2</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span></pre>
441
+
442
+ </div>
443
+ <h3>Parameters:</h3>
444
+ <ul class="param">
445
+
446
+ <li>
447
+
448
+ <span class='name'>options</span>
449
+
450
+
451
+ <span class='type'>(<tt>Hash</tt>)</span>
452
+
453
+
454
+
455
+ &mdash;
456
+ <div class='inline'><p>the hash of tables and IDs to retrieve</p>
457
+ </div>
458
+
459
+ </li>
460
+
461
+ </ul>
462
+
463
+ <h3>Returns:</h3>
464
+ <ul class="return">
465
+
466
+ <li>
467
+
468
+
469
+ <span class='type'>(<tt>Hash</tt>)</span>
470
+
471
+
472
+
473
+ &mdash;
474
+ <div class='inline'><p>a hash where keys are the table names and the values are the retrieved items</p>
475
+ </div>
476
+
477
+ </li>
478
+
479
+ </ul>
480
+ <h3>Since:</h3>
481
+ <ul class="since">
482
+
483
+ <li>
484
+
485
+
486
+
487
+
488
+
489
+ <div class='inline'><p>0.2.0</p>
490
+ </div>
491
+
492
+ </li>
493
+
494
+ </ul>
495
+
496
+ </div><table class="source_code">
497
+ <tr>
498
+ <td>
499
+ <pre class="lines">
500
+
501
+
502
+ 43
503
+ 44
504
+ 45
505
+ 46
506
+ 47
507
+ 48
508
+ 49
509
+ 50
510
+ 51
511
+ 52
512
+ 53
513
+ 54
514
+ 55
515
+ 56</pre>
516
+ </td>
517
+ <td>
518
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 43</span>
519
+
520
+ <span class='kw'>def</span> <span class='id identifier rubyid_batch_get_item'>batch_get_item</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
521
+ <span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_h'>h</span><span class='comma'>,</span> <span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
522
+ <span class='kw'>return</span> <span class='id identifier rubyid_hash'>hash</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span><span class='rbrace'>}</span>
523
+ <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='comma'>,</span> <span class='id identifier rubyid_ids'>ids</span><span class='op'>|</span>
524
+ <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_ids'>ids</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_in_groups_of'>in_groups_of</span><span class='lparen'>(</span><span class='int'>100</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_group'>group</span><span class='op'>|</span>
525
+ <span class='id identifier rubyid_batch'>batch</span> <span class='op'>=</span> <span class='const'>AWS</span><span class='op'>::</span><span class='const'>DynamoDB</span><span class='op'>::</span><span class='const'>BatchGet</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:config</span> <span class='op'>=&gt;</span> <span class='cvar'>@@connection</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
526
+ <span class='id identifier rubyid_batch'>batch</span><span class='period'>.</span><span class='id identifier rubyid_table'>table</span><span class='lparen'>(</span><span class='id identifier rubyid_t'>t</span><span class='comma'>,</span> <span class='symbol'>:all</span><span class='comma'>,</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_group'>group</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_group'>group</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_group'>group</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
527
+ <span class='id identifier rubyid_batch'>batch</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_attributes'>attributes</span><span class='op'>|</span>
528
+ <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
529
+ <span class='kw'>end</span>
530
+ <span class='kw'>end</span>
531
+ <span class='kw'>end</span>
532
+ <span class='id identifier rubyid_hash'>hash</span>
533
+ <span class='kw'>end</span></pre>
534
+ </td>
535
+ </tr>
536
+ </table>
537
+ </div>
538
+
539
+ <div class="method_details ">
540
+ <p class="signature " id="connect!-instance_method">
541
+
542
+ - (<tt>AWS::DynamoDB::Connection</tt>) <strong>connect!</strong>
543
+
544
+
545
+
546
+ </p><div class="docstring">
547
+ <div class="discussion">
548
+ <p>Establish the connection to DynamoDB.</p>
549
+
550
+
551
+ </div>
552
+ </div>
553
+ <div class="tags">
554
+
555
+ <h3>Returns:</h3>
556
+ <ul class="return">
557
+
558
+ <li>
559
+
560
+
561
+ <span class='type'>(<tt>AWS::DynamoDB::Connection</tt>)</span>
562
+
563
+
564
+
565
+ &mdash;
566
+ <div class='inline'><p>the raw DynamoDB connection</p>
567
+ </div>
568
+
569
+ </li>
570
+
571
+ </ul>
572
+ <h3>Since:</h3>
573
+ <ul class="since">
574
+
575
+ <li>
576
+
577
+
578
+
579
+
580
+
581
+ <div class='inline'><p>0.2.0</p>
582
+ </div>
583
+
584
+ </li>
585
+
586
+ </ul>
587
+
588
+ </div><table class="source_code">
589
+ <tr>
590
+ <td>
591
+ <pre class="lines">
592
+
593
+
594
+ 20
595
+ 21
596
+ 22</pre>
597
+ </td>
598
+ <td>
599
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 20</span>
600
+
601
+ <span class='kw'>def</span> <span class='id identifier rubyid_connect!'>connect!</span>
602
+ <span class='cvar'>@@connection</span> <span class='op'>=</span> <span class='const'>AWS</span><span class='op'>::</span><span class='const'>DynamoDB</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:access_key_id</span> <span class='op'>=&gt;</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_access_key'>access_key</span><span class='comma'>,</span> <span class='symbol'>:secret_access_key</span> <span class='op'>=&gt;</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_secret_key'>secret_key</span><span class='comma'>,</span> <span class='symbol'>:dynamo_db_endpoint</span> <span class='op'>=&gt;</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_endpoint'>endpoint</span><span class='rparen'>)</span>
603
+ <span class='kw'>end</span></pre>
604
+ </td>
605
+ </tr>
606
+ </table>
607
+ </div>
608
+
609
+ <div class="method_details ">
610
+ <p class="signature " id="connection-instance_method">
611
+
612
+ - (<tt>AWS::DynamoDB::Connection</tt>) <strong>connection</strong>
613
+
614
+
615
+
616
+ </p><div class="docstring">
617
+ <div class="discussion">
618
+ <p>Return the established connection.</p>
619
+
620
+
621
+ </div>
622
+ </div>
623
+ <div class="tags">
624
+
625
+ <h3>Returns:</h3>
626
+ <ul class="return">
627
+
628
+ <li>
629
+
630
+
631
+ <span class='type'>(<tt>AWS::DynamoDB::Connection</tt>)</span>
632
+
633
+
634
+
635
+ &mdash;
636
+ <div class='inline'><p>the raw DynamoDB connection</p>
637
+ </div>
638
+
639
+ </li>
640
+
641
+ </ul>
642
+ <h3>Since:</h3>
643
+ <ul class="since">
644
+
645
+ <li>
646
+
647
+
648
+
649
+
650
+
651
+ <div class='inline'><p>0.2.0</p>
652
+ </div>
653
+
654
+ </li>
655
+
656
+ </ul>
657
+
658
+ </div><table class="source_code">
659
+ <tr>
660
+ <td>
661
+ <pre class="lines">
662
+
663
+
664
+ 29
665
+ 30
666
+ 31</pre>
667
+ </td>
668
+ <td>
669
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 29</span>
670
+
671
+ <span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span>
672
+ <span class='cvar'>@@connection</span>
673
+ <span class='kw'>end</span></pre>
674
+ </td>
675
+ </tr>
676
+ </table>
677
+ </div>
678
+
679
+ <div class="method_details ">
680
+ <p class="signature " id="create_table-instance_method">
681
+
682
+ - (<tt>Object</tt>) <strong>create_table</strong>(table_name, key = :id, options = {})
683
+
684
+
685
+
686
+ </p><div class="docstring">
687
+ <div class="discussion">
688
+ <p>Create a table on DynamoDB. This usually takes a long time to complete.</p>
689
+
690
+
691
+ </div>
692
+ </div>
693
+ <div class="tags">
694
+ <h3>Parameters:</h3>
695
+ <ul class="param">
696
+
697
+ <li>
698
+
699
+ <span class='name'>table_name</span>
700
+
701
+
702
+ <span class='type'>(<tt>String</tt>)</span>
703
+
704
+
705
+
706
+ &mdash;
707
+ <div class='inline'><p>the name of the table to create</p>
708
+ </div>
709
+
710
+ </li>
711
+
712
+ <li>
713
+
714
+ <span class='name'>key</span>
715
+
716
+
717
+ <span class='type'>(<tt>Symbol</tt>)</span>
718
+
719
+
720
+ <em class="default">(defaults to: <tt>:id</tt>)</em>
721
+
722
+
723
+ &mdash;
724
+ <div class='inline'><p>the table's primary key (defaults to :id)</p>
725
+ </div>
726
+
727
+ </li>
728
+
729
+ <li>
730
+
731
+ <span class='name'>options</span>
732
+
733
+
734
+ <span class='type'>(<tt>Hash</tt>)</span>
735
+
736
+
737
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
738
+
739
+
740
+ &mdash;
741
+ <div class='inline'><p>provide a range_key here if you want one for the table</p>
742
+ </div>
743
+
744
+ </li>
745
+
746
+ </ul>
747
+
748
+ <h3>Since:</h3>
749
+ <ul class="since">
750
+
751
+ <li>
752
+
753
+
754
+
755
+
756
+
757
+ <div class='inline'><p>0.2.0</p>
758
+ </div>
759
+
760
+ </li>
761
+
762
+ </ul>
763
+
764
+ </div><table class="source_code">
765
+ <tr>
766
+ <td>
767
+ <pre class="lines">
768
+
769
+
770
+ 65
771
+ 66
772
+ 67
773
+ 68
774
+ 69
775
+ 70
776
+ 71
777
+ 72</pre>
778
+ </td>
779
+ <td>
780
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 65</span>
781
+
782
+ <span class='kw'>def</span> <span class='id identifier rubyid_create_table'>create_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
783
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:hash_key</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='op'>=&gt;</span> <span class='symbol'>:string</span><span class='rbrace'>}</span>
784
+ <span class='id identifier rubyid_read_capacity'>read_capacity</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:read_capacity</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_read_capacity'>read_capacity</span>
785
+ <span class='id identifier rubyid_write_capacity'>write_capacity</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:write_capacity</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_write_capacity'>write_capacity</span>
786
+ <span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='cvar'>@@connection</span><span class='period'>.</span><span class='id identifier rubyid_tables'>tables</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_read_capacity'>read_capacity</span><span class='comma'>,</span> <span class='id identifier rubyid_write_capacity'>write_capacity</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
787
+ <span class='id identifier rubyid_sleep'>sleep</span> <span class='float'>0.5</span> <span class='kw'>while</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span> <span class='op'>==</span> <span class='symbol'>:creating</span>
788
+ <span class='kw'>return</span> <span class='id identifier rubyid_table'>table</span>
789
+ <span class='kw'>end</span></pre>
790
+ </td>
791
+ </tr>
792
+ </table>
793
+ </div>
794
+
795
+ <div class="method_details ">
796
+ <p class="signature " id="delete_item-instance_method">
797
+
798
+ - (<tt>Object</tt>) <strong>delete_item</strong>(table_name, key, options = {})
799
+
800
+
801
+
802
+ </p><div class="docstring">
803
+ <div class="discussion">
804
+ <p>Removes an item from DynamoDB.</p>
805
+
806
+
807
+ </div>
808
+ </div>
809
+ <div class="tags">
810
+ <h3>Parameters:</h3>
811
+ <ul class="param">
812
+
813
+ <li>
814
+
815
+ <span class='name'>table_name</span>
816
+
817
+
818
+ <span class='type'>(<tt>String</tt>)</span>
819
+
820
+
821
+
822
+ &mdash;
823
+ <div class='inline'><p>the name of the table</p>
824
+ </div>
825
+
826
+ </li>
827
+
828
+ <li>
829
+
830
+ <span class='name'>key</span>
831
+
832
+
833
+ <span class='type'>(<tt>String</tt>)</span>
834
+
835
+
836
+
837
+ &mdash;
838
+ <div class='inline'><p>the hash key of the item to delete</p>
839
+ </div>
840
+
841
+ </li>
842
+
843
+ <li>
844
+
845
+ <span class='name'>range_key</span>
846
+
847
+
848
+ <span class='type'>(<tt>Number</tt>)</span>
849
+
850
+
851
+
852
+ &mdash;
853
+ <div class='inline'><p>the range key of the item to delete, required if the table has a composite key</p>
854
+ </div>
855
+
856
+ </li>
857
+
858
+ </ul>
859
+
860
+ <h3>Since:</h3>
861
+ <ul class="since">
862
+
863
+ <li>
864
+
865
+
866
+
867
+
868
+
869
+ <div class='inline'><p>0.2.0</p>
870
+ </div>
871
+
872
+ </li>
873
+
874
+ </ul>
875
+
876
+ </div><table class="source_code">
877
+ <tr>
878
+ <td>
879
+ <pre class="lines">
880
+
881
+
882
+ 81
883
+ 82
884
+ 83
885
+ 84
886
+ 85
887
+ 86
888
+ 87
889
+ 88
890
+ 89
891
+ 90
892
+ 91</pre>
893
+ </td>
894
+ <td>
895
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 81</span>
896
+
897
+ <span class='kw'>def</span> <span class='id identifier rubyid_delete_item'>delete_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
898
+ <span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:range_key</span><span class='rparen'>)</span>
899
+ <span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_get_table'>get_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
900
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_composite_key?'>composite_key?</span>
901
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span>
902
+ <span class='kw'>else</span>
903
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
904
+ <span class='kw'>end</span>
905
+ <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='kw'>unless</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
906
+ <span class='kw'>true</span>
907
+ <span class='kw'>end</span></pre>
908
+ </td>
909
+ </tr>
910
+ </table>
911
+ </div>
912
+
913
+ <div class="method_details ">
914
+ <p class="signature " id="delete_table-instance_method">
915
+
916
+ - (<tt>Object</tt>) <strong>delete_table</strong>(table_name)
917
+
918
+
919
+
920
+ </p><div class="docstring">
921
+ <div class="discussion">
922
+ <p>Deletes an entire table from DynamoDB. Only 10 tables can be in the deleting state at once,
923
+ so if you have more this method may raise an exception.</p>
924
+
925
+
926
+ </div>
927
+ </div>
928
+ <div class="tags">
929
+ <h3>Parameters:</h3>
930
+ <ul class="param">
931
+
932
+ <li>
933
+
934
+ <span class='name'>table_name</span>
935
+
936
+
937
+ <span class='type'>(<tt>String</tt>)</span>
938
+
939
+
940
+
941
+ &mdash;
942
+ <div class='inline'><p>the name of the table to destroy</p>
943
+ </div>
944
+
945
+ </li>
946
+
947
+ </ul>
948
+
949
+ <h3>Since:</h3>
950
+ <ul class="since">
951
+
952
+ <li>
953
+
954
+
955
+
956
+
957
+
958
+ <div class='inline'><p>0.2.0</p>
959
+ </div>
960
+
961
+ </li>
962
+
963
+ </ul>
964
+
965
+ </div><table class="source_code">
966
+ <tr>
967
+ <td>
968
+ <pre class="lines">
969
+
970
+
971
+ 99
972
+ 100
973
+ 101</pre>
974
+ </td>
975
+ <td>
976
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 99</span>
977
+
978
+ <span class='kw'>def</span> <span class='id identifier rubyid_delete_table'>delete_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
979
+ <span class='cvar'>@@connection</span><span class='period'>.</span><span class='id identifier rubyid_tables'>tables</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
980
+ <span class='kw'>end</span></pre>
981
+ </td>
982
+ </tr>
983
+ </table>
984
+ </div>
985
+
986
+ <div class="method_details ">
987
+ <p class="signature " id="get_item-instance_method">
988
+
989
+ - (<tt>Object</tt>) <strong>get_item</strong>(table_name, key, options = {})
990
+
991
+
992
+
993
+ </p><table class="source_code">
994
+ <tr>
995
+ <td>
996
+ <pre class="lines">
997
+
998
+
999
+ 117
1000
+ 118
1001
+ 119
1002
+ 120
1003
+ 121
1004
+ 122
1005
+ 123
1006
+ 124
1007
+ 125
1008
+ 126
1009
+ 127
1010
+ 128
1011
+ 129
1012
+ 130
1013
+ 131</pre>
1014
+ </td>
1015
+ <td>
1016
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 117</span>
1017
+
1018
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_item'>get_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
1019
+ <span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:range_key</span><span class='rparen'>)</span>
1020
+ <span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_get_table'>get_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
1021
+
1022
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_composite_key?'>composite_key?</span>
1023
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span>
1024
+ <span class='kw'>else</span>
1025
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
1026
+ <span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
1027
+ <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1028
+ <span class='kw'>nil</span>
1029
+ <span class='kw'>else</span>
1030
+ <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
1031
+ <span class='kw'>end</span>
1032
+ <span class='kw'>end</span></pre>
1033
+ </td>
1034
+ </tr>
1035
+ </table>
1036
+ </div>
1037
+
1038
+ <div class="method_details ">
1039
+ <p class="signature " id="get_table-instance_method">
1040
+
1041
+ - (<tt>Object</tt>) <strong>get_table</strong>(table_name)
1042
+
1043
+
1044
+
1045
+ </p><div class="docstring">
1046
+ <div class="discussion">
1047
+
1048
+ <div class="note todo">
1049
+ <strong>TODO:</strong>
1050
+ <div class='inline'><p>Add an UpdateTable method.</p>
1051
+ </div>
1052
+ </div>
1053
+
1054
+
1055
+
1056
+ </div>
1057
+ </div>
1058
+ <div class="tags">
1059
+
1060
+
1061
+ </div><table class="source_code">
1062
+ <tr>
1063
+ <td>
1064
+ <pre class="lines">
1065
+
1066
+
1067
+ 202
1068
+ 203
1069
+ 204
1070
+ 205
1071
+ 206
1072
+ 207
1073
+ 208
1074
+ 209</pre>
1075
+ </td>
1076
+ <td>
1077
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 202</span>
1078
+
1079
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_table'>get_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
1080
+ <span class='kw'>unless</span> <span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_table_cache'>table_cache</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span>
1081
+ <span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='cvar'>@@connection</span><span class='period'>.</span><span class='id identifier rubyid_tables'>tables</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span>
1082
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_load_schema'>load_schema</span>
1083
+ <span class='id identifier rubyid_table_cache'>table_cache</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_table'>table</span>
1084
+ <span class='kw'>end</span>
1085
+ <span class='id identifier rubyid_table'>table</span>
1086
+ <span class='kw'>end</span></pre>
1087
+ </td>
1088
+ </tr>
1089
+ </table>
1090
+ </div>
1091
+
1092
+ <div class="method_details ">
1093
+ <p class="signature " id="list_tables-instance_method">
1094
+
1095
+ - (<tt>Object</tt>) <strong>list_tables</strong>
1096
+
1097
+
1098
+
1099
+ </p><div class="docstring">
1100
+ <div class="discussion">
1101
+ <p>List all tables on DynamoDB.</p>
1102
+
1103
+
1104
+ </div>
1105
+ </div>
1106
+ <div class="tags">
1107
+
1108
+ <h3>Since:</h3>
1109
+ <ul class="since">
1110
+
1111
+ <li>
1112
+
1113
+
1114
+
1115
+
1116
+
1117
+ <div class='inline'><p>0.2.0</p>
1118
+ </div>
1119
+
1120
+ </li>
1121
+
1122
+ </ul>
1123
+
1124
+ </div><table class="source_code">
1125
+ <tr>
1126
+ <td>
1127
+ <pre class="lines">
1128
+
1129
+
1130
+ 136
1131
+ 137
1132
+ 138</pre>
1133
+ </td>
1134
+ <td>
1135
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 136</span>
1136
+
1137
+ <span class='kw'>def</span> <span class='id identifier rubyid_list_tables'>list_tables</span>
1138
+ <span class='cvar'>@@connection</span><span class='period'>.</span><span class='id identifier rubyid_tables'>tables</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:name</span><span class='rparen'>)</span>
1139
+ <span class='kw'>end</span></pre>
1140
+ </td>
1141
+ </tr>
1142
+ </table>
1143
+ </div>
1144
+
1145
+ <div class="method_details ">
1146
+ <p class="signature " id="put_item-instance_method">
1147
+
1148
+ - (<tt>Object</tt>) <strong>put_item</strong>(table_name, object)
1149
+
1150
+
1151
+
1152
+ </p><div class="docstring">
1153
+ <div class="discussion">
1154
+ <p>Persists an item on DynamoDB.</p>
1155
+
1156
+
1157
+ </div>
1158
+ </div>
1159
+ <div class="tags">
1160
+ <h3>Parameters:</h3>
1161
+ <ul class="param">
1162
+
1163
+ <li>
1164
+
1165
+ <span class='name'>table_name</span>
1166
+
1167
+
1168
+ <span class='type'>(<tt>String</tt>)</span>
1169
+
1170
+
1171
+
1172
+ &mdash;
1173
+ <div class='inline'><p>the name of the table</p>
1174
+ </div>
1175
+
1176
+ </li>
1177
+
1178
+ <li>
1179
+
1180
+ <span class='name'>object</span>
1181
+
1182
+
1183
+ <span class='type'>(<tt>Object</tt>)</span>
1184
+
1185
+
1186
+
1187
+ &mdash;
1188
+ <div class='inline'><p>a hash or Dynamoid object to persist</p>
1189
+ </div>
1190
+
1191
+ </li>
1192
+
1193
+ </ul>
1194
+
1195
+ <h3>Since:</h3>
1196
+ <ul class="since">
1197
+
1198
+ <li>
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+ <div class='inline'><p>0.2.0</p>
1205
+ </div>
1206
+
1207
+ </li>
1208
+
1209
+ </ul>
1210
+
1211
+ </div><table class="source_code">
1212
+ <tr>
1213
+ <td>
1214
+ <pre class="lines">
1215
+
1216
+
1217
+ 146
1218
+ 147
1219
+ 148
1220
+ 149</pre>
1221
+ </td>
1222
+ <td>
1223
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 146</span>
1224
+
1225
+ <span class='kw'>def</span> <span class='id identifier rubyid_put_item'>put_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
1226
+ <span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_get_table'>get_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
1227
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:empty?</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='rparen'>)</span>
1228
+ <span class='kw'>end</span></pre>
1229
+ </td>
1230
+ </tr>
1231
+ </table>
1232
+ </div>
1233
+
1234
+ <div class="method_details ">
1235
+ <p class="signature " id="query-instance_method">
1236
+
1237
+ - (<tt>Array</tt>) <strong>query</strong>(table_name, opts = {})
1238
+
1239
+
1240
+
1241
+ </p><div class="docstring">
1242
+ <div class="discussion">
1243
+ <p>Query the DynamoDB table. This employs DynamoDB's indexes so is generally faster than scanning, but is
1244
+ only really useful for range queries, since it can only find by one hash key at once. Only provide
1245
+ one range key to the hash.</p>
1246
+
1247
+
1248
+ </div>
1249
+ </div>
1250
+ <div class="tags">
1251
+ <h3>Parameters:</h3>
1252
+ <ul class="param">
1253
+
1254
+ <li>
1255
+
1256
+ <span class='name'>table_name</span>
1257
+
1258
+
1259
+ <span class='type'>(<tt>String</tt>)</span>
1260
+
1261
+
1262
+
1263
+ &mdash;
1264
+ <div class='inline'><p>the name of the table</p>
1265
+ </div>
1266
+
1267
+ </li>
1268
+
1269
+ <li>
1270
+
1271
+ <span class='name'>opts</span>
1272
+
1273
+
1274
+ <span class='type'>(<tt>Hash</tt>)</span>
1275
+
1276
+
1277
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
1278
+
1279
+
1280
+ &mdash;
1281
+ <div class='inline'><p>the options to query the table with</p>
1282
+ </div>
1283
+
1284
+ </li>
1285
+
1286
+ </ul>
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+
1293
+ <h3>Options Hash (<tt>opts</tt>):</h3>
1294
+ <ul class="option">
1295
+
1296
+ <li>
1297
+ <span class="name">:hash_value</span>
1298
+ <span class="type">(<tt>String</tt>)</span>
1299
+ <span class="default">
1300
+
1301
+ </span>
1302
+ &mdash; <div class='inline'><p>the value of the hash key to find</p>
1303
+ </div>
1304
+ </li>
1305
+
1306
+ <li>
1307
+ <span class="name">:range_value</span>
1308
+ <span class="type">(<tt>Range</tt>)</span>
1309
+ <span class="default">
1310
+
1311
+ </span>
1312
+ &mdash; <div class='inline'><p>find the range key within this range</p>
1313
+ </div>
1314
+ </li>
1315
+
1316
+ <li>
1317
+ <span class="name">:range_greater_than</span>
1318
+ <span class="type">(<tt>Number</tt>)</span>
1319
+ <span class="default">
1320
+
1321
+ </span>
1322
+ &mdash; <div class='inline'><p>find range keys greater than this</p>
1323
+ </div>
1324
+ </li>
1325
+
1326
+ <li>
1327
+ <span class="name">:range_less_than</span>
1328
+ <span class="type">(<tt>Number</tt>)</span>
1329
+ <span class="default">
1330
+
1331
+ </span>
1332
+ &mdash; <div class='inline'><p>find range keys less than this</p>
1333
+ </div>
1334
+ </li>
1335
+
1336
+ <li>
1337
+ <span class="name">:range_gte</span>
1338
+ <span class="type">(<tt>Number</tt>)</span>
1339
+ <span class="default">
1340
+
1341
+ </span>
1342
+ &mdash; <div class='inline'><p>find range keys greater than or equal to this</p>
1343
+ </div>
1344
+ </li>
1345
+
1346
+ <li>
1347
+ <span class="name">:range_lte</span>
1348
+ <span class="type">(<tt>Number</tt>)</span>
1349
+ <span class="default">
1350
+
1351
+ </span>
1352
+ &mdash; <div class='inline'><p>find range keys less than or equal to this</p>
1353
+ </div>
1354
+ </li>
1355
+
1356
+ </ul>
1357
+
1358
+
1359
+ <h3>Returns:</h3>
1360
+ <ul class="return">
1361
+
1362
+ <li>
1363
+
1364
+
1365
+ <span class='type'>(<tt>Array</tt>)</span>
1366
+
1367
+
1368
+
1369
+ &mdash;
1370
+ <div class='inline'><p>an array of all matching items</p>
1371
+ </div>
1372
+
1373
+ </li>
1374
+
1375
+ </ul>
1376
+ <h3>Since:</h3>
1377
+ <ul class="since">
1378
+
1379
+ <li>
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+ <div class='inline'><p>0.2.0</p>
1386
+ </div>
1387
+
1388
+ </li>
1389
+
1390
+ </ul>
1391
+
1392
+ </div><table class="source_code">
1393
+ <tr>
1394
+ <td>
1395
+ <pre class="lines">
1396
+
1397
+
1398
+ 167
1399
+ 168
1400
+ 169
1401
+ 170
1402
+ 171
1403
+ 172
1404
+ 173
1405
+ 174
1406
+ 175
1407
+ 176
1408
+ 177
1409
+ 178</pre>
1410
+ </td>
1411
+ <td>
1412
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 167</span>
1413
+
1414
+ <span class='kw'>def</span> <span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
1415
+ <span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_get_table'>get_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
1416
+
1417
+ <span class='id identifier rubyid_consistent_opts'>consistent_opts</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:consistent_read</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:consistent_read</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>false</span> <span class='rbrace'>}</span>
1418
+ <span class='kw'>if</span> <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_composite_key?'>composite_key?</span>
1419
+ <span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1420
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span> <span class='id identifier rubyid_results'>results</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span><span class='lparen'>(</span><span class='id identifier rubyid_consistent_opts'>consistent_opts</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span><span class='rbrace'>}</span>
1421
+ <span class='id identifier rubyid_results'>results</span>
1422
+ <span class='kw'>else</span>
1423
+ <span class='id identifier rubyid_get_item'>get_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:hash_value</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1424
+ <span class='kw'>end</span>
1425
+ <span class='kw'>end</span></pre>
1426
+ </td>
1427
+ </tr>
1428
+ </table>
1429
+ </div>
1430
+
1431
+ <div class="method_details ">
1432
+ <p class="signature " id="scan-instance_method">
1433
+
1434
+ - (<tt>Array</tt>) <strong>scan</strong>(table_name, scan_hash, select_opts)
1435
+
1436
+
1437
+
1438
+ </p><div class="docstring">
1439
+ <div class="discussion">
1440
+ <p>Scan the DynamoDB table. This is usually a very slow operation as it naively filters all data on
1441
+ the DynamoDB servers.</p>
1442
+
1443
+
1444
+ </div>
1445
+ </div>
1446
+ <div class="tags">
1447
+ <h3>Parameters:</h3>
1448
+ <ul class="param">
1449
+
1450
+ <li>
1451
+
1452
+ <span class='name'>table_name</span>
1453
+
1454
+
1455
+ <span class='type'>(<tt>String</tt>)</span>
1456
+
1457
+
1458
+
1459
+ &mdash;
1460
+ <div class='inline'><p>the name of the table</p>
1461
+ </div>
1462
+
1463
+ </li>
1464
+
1465
+ <li>
1466
+
1467
+ <span class='name'>scan_hash</span>
1468
+
1469
+
1470
+ <span class='type'>(<tt>Hash</tt>)</span>
1471
+
1472
+
1473
+
1474
+ &mdash;
1475
+ <div class='inline'><p>a hash of attributes: matching records will be returned by the scan</p>
1476
+ </div>
1477
+
1478
+ </li>
1479
+
1480
+ </ul>
1481
+
1482
+ <h3>Returns:</h3>
1483
+ <ul class="return">
1484
+
1485
+ <li>
1486
+
1487
+
1488
+ <span class='type'>(<tt>Array</tt>)</span>
1489
+
1490
+
1491
+
1492
+ &mdash;
1493
+ <div class='inline'><p>an array of all matching items</p>
1494
+ </div>
1495
+
1496
+ </li>
1497
+
1498
+ </ul>
1499
+ <h3>Since:</h3>
1500
+ <ul class="since">
1501
+
1502
+ <li>
1503
+
1504
+
1505
+
1506
+
1507
+
1508
+ <div class='inline'><p>0.2.0</p>
1509
+ </div>
1510
+
1511
+ </li>
1512
+
1513
+ </ul>
1514
+
1515
+ </div><table class="source_code">
1516
+ <tr>
1517
+ <td>
1518
+ <pre class="lines">
1519
+
1520
+
1521
+ 189
1522
+ 190
1523
+ 191
1524
+ 192
1525
+ 193
1526
+ 194
1527
+ 195
1528
+ 196</pre>
1529
+ </td>
1530
+ <td>
1531
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 189</span>
1532
+
1533
+ <span class='kw'>def</span> <span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_scan_hash'>scan_hash</span><span class='comma'>,</span> <span class='id identifier rubyid_select_opts'>select_opts</span><span class='rparen'>)</span>
1534
+ <span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_get_table'>get_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
1535
+ <span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
1536
+ <span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='id identifier rubyid_scan_hash'>scan_hash</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='id identifier rubyid_select_opts'>select_opts</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span>
1537
+ <span class='id identifier rubyid_results'>results</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys!'>symbolize_keys!</span>
1538
+ <span class='kw'>end</span>
1539
+ <span class='id identifier rubyid_results'>results</span>
1540
+ <span class='kw'>end</span></pre>
1541
+ </td>
1542
+ </tr>
1543
+ </table>
1544
+ </div>
1545
+
1546
+ <div class="method_details ">
1547
+ <p class="signature " id="table_cache-instance_method">
1548
+
1549
+ - (<tt>Object</tt>) <strong>table_cache</strong>
1550
+
1551
+
1552
+
1553
+ </p><table class="source_code">
1554
+ <tr>
1555
+ <td>
1556
+ <pre class="lines">
1557
+
1558
+
1559
+ 211
1560
+ 212
1561
+ 213</pre>
1562
+ </td>
1563
+ <td>
1564
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/aws_sdk.rb', line 211</span>
1565
+
1566
+ <span class='kw'>def</span> <span class='id identifier rubyid_table_cache'>table_cache</span>
1567
+ <span class='ivar'>@table_cache</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1568
+ <span class='kw'>end</span></pre>
1569
+ </td>
1570
+ </tr>
1571
+ </table>
1572
+ </div>
1573
+
1574
+ </div>
1575
+
1576
+ </div>
1577
+
1578
+ <div id="footer">
1579
+ Generated on Thu Apr 26 01:26:26 2012 by
1580
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1581
+ 0.7.5 (ruby-1.9.3).
1582
+ </div>
1583
+
1584
+ </body>
1585
+ </html>