aws-dynamodb-query 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49954ac8326461b54228f352d1cba8b7c0cfb1a8
4
- data.tar.gz: 36e6ee4da40f72a2939760fe4c2b947dd48c72ed
3
+ metadata.gz: 320df6a9f652c179cb56e64d3d6c2c1f84d138e6
4
+ data.tar.gz: b885187f99eb69ccaa2a0b0381244a0619454736
5
5
  SHA512:
6
- metadata.gz: ad863bed7f6bce2af9cc6e9be00c12bb01a0131a64bbe90299e3b8bf0edc6a844e0e0c7ae8c0b53609583b36ec5ba704d223932fbf7b0eda6ef34ee1346330dd
7
- data.tar.gz: 94d9d3b40b71d0d3ef4be628f3dc83f0970da9202a2a31fa82345b96790eebd55a51124e0ccf34c926c46dbb8cd2f65b75cab4da3b9b08af1da519dd2dff0c5d
6
+ metadata.gz: da44079865a681524a64301974128c3526c58fbe8170e83452697c14e8cea42145c954d5d30753b5c5f213eda53e0adc578fcb760c400b863ffbc93c4da2c80f
7
+ data.tar.gz: 1988c2b3bf5b13637a350c18243b96b435317f91787fd73784118aaa878637b16ebf7199f073f6d85a6b5655cdfc81a33a2261ee792b6cb68c887efd93772be9
data/.idea/workspace.xml CHANGED
@@ -1,5 +1,8 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
+ <component name="AnalysisUIOptions">
4
+ <option name="SCOPE_TYPE" value="3" />
5
+ </component>
3
6
  <component name="ChangeListManager">
4
7
  <list default="true" id="70ffc16e-1950-4181-b8c2-8ff3ff5a72ac" name="Default" comment="Removed log statement">
5
8
  <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/aws-dynamodb-query.iml" />
@@ -34,8 +37,8 @@
34
37
  <file leaf-file-name="query.rb" pinned="false" current-in-tab="false">
35
38
  <entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query.rb">
36
39
  <provider selected="true" editor-type-id="text-editor">
37
- <state relative-caret-position="30">
38
- <caret line="2" column="14" lean-forward="true" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" />
40
+ <state relative-caret-position="394">
41
+ <caret line="92" column="44" lean-forward="true" selection-start-line="92" selection-start-column="44" selection-end-line="92" selection-end-column="44" />
39
42
  <folding />
40
43
  </state>
41
44
  </provider>
@@ -133,6 +136,9 @@
133
136
  <find>add_development_dependency</find>
134
137
  <find>yaj</find>
135
138
  <find>Yajl</find>
139
+ <find>unset_attributes</find>
140
+ <find>stored_attributes</find>
141
+ <find>Agent</find>
136
142
  </findStrings>
137
143
  </component>
138
144
  <component name="Git.Settings">
@@ -145,8 +151,8 @@
145
151
  <option value="$PROJECT_DIR$/test/aws/dynamodb/query_test.rb" />
146
152
  <option value="$PROJECT_DIR$/README.md" />
147
153
  <option value="$PROJECT_DIR$/aws-dynamodb-query.gemspec" />
148
- <option value="$PROJECT_DIR$/lib/aws/dynamodb/query.rb" />
149
154
  <option value="$PROJECT_DIR$/Gemfile" />
155
+ <option value="$PROJECT_DIR$/lib/aws/dynamodb/query.rb" />
150
156
  <option value="$PROJECT_DIR$/lib/aws/dynamodb/query/version.rb" />
151
157
  </list>
152
158
  </option>
@@ -163,6 +169,73 @@
163
169
  <option name="width" value="1550" />
164
170
  <option name="height" value="1344" />
165
171
  </component>
172
+ <component name="ProjectInspectionProfilesVisibleTreeState">
173
+ <entry key="Project Default">
174
+ <profile-state>
175
+ <expanded-state>
176
+ <State>
177
+ <id />
178
+ </State>
179
+ <State>
180
+ <id>CSS</id>
181
+ </State>
182
+ <State>
183
+ <id>Code quality toolsCSS</id>
184
+ </State>
185
+ <State>
186
+ <id>Code quality toolsJavaScript</id>
187
+ </State>
188
+ <State>
189
+ <id>Cucumber</id>
190
+ </State>
191
+ <State>
192
+ <id>DOM issuesJavaScript</id>
193
+ </State>
194
+ <State>
195
+ <id>Gems</id>
196
+ </State>
197
+ <State>
198
+ <id>General</id>
199
+ </State>
200
+ <State>
201
+ <id>GeneralJavaScript</id>
202
+ </State>
203
+ <State>
204
+ <id>Invalid elementsCSS</id>
205
+ </State>
206
+ <State>
207
+ <id>JavaScript</id>
208
+ </State>
209
+ <State>
210
+ <id>Naming conventionsRuby</id>
211
+ </State>
212
+ <State>
213
+ <id>Potentially confusing code constructsJavaScript</id>
214
+ </State>
215
+ <State>
216
+ <id>Probable bugsJavaScript</id>
217
+ </State>
218
+ <State>
219
+ <id>Rails</id>
220
+ </State>
221
+ <State>
222
+ <id>RubocopRuby</id>
223
+ </State>
224
+ <State>
225
+ <id>Ruby</id>
226
+ </State>
227
+ <State>
228
+ <id>TypeScript</id>
229
+ </State>
230
+ </expanded-state>
231
+ <selected-state>
232
+ <State>
233
+ <id>RubocopRuby</id>
234
+ </State>
235
+ </selected-state>
236
+ </profile-state>
237
+ </entry>
238
+ </component>
166
239
  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
167
240
  <component name="ProjectView">
168
241
  <navigator proportions="" version="1">
@@ -182,8 +255,9 @@
182
255
  </component>
183
256
  <component name="PropertiesComponent">
184
257
  <property name="WebServerToolWindowFactoryState" value="false" />
185
- <property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
258
+ <property name="settings.editor.selected.configurable" value="Errors" />
186
259
  <property name="HbShouldOpenHtmlAsHb" value="" />
260
+ <property name="run.code.analysis.last.selected.profile" value="pProject Default" />
187
261
  </component>
188
262
  <component name="RecentsManager">
189
263
  <key name="CopyFile.RECENT_KEYS">
@@ -224,7 +298,7 @@
224
298
  <workItem from="1509616590154" duration="38000" />
225
299
  <workItem from="1509621829777" duration="713000" />
226
300
  <workItem from="1509625297566" duration="1234000" />
227
- <workItem from="1509627738661" duration="359000" />
301
+ <workItem from="1509627738661" duration="1665000" />
228
302
  </task>
229
303
  <task id="LOCAL-00001" summary="First working release 0.1.1">
230
304
  <created>1509537033535</created>
@@ -251,7 +325,7 @@
251
325
  <servers />
252
326
  </component>
253
327
  <component name="TimeTrackingManager">
254
- <option name="totallyTimeSpent" value="18675000" />
328
+ <option name="totallyTimeSpent" value="19981000" />
255
329
  </component>
256
330
  <component name="ToolWindowManager">
257
331
  <frame x="289" y="23" width="1550" height="1344" extended-state="0" />
@@ -260,21 +334,22 @@
260
334
  <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.18358113" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
261
335
  <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
262
336
  <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3599374" sideWeight="0.5159151" order="7" side_tool="true" content_ui="tabs" />
337
+ <window_info id="Inspection Results" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32942098" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
263
338
  <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
264
339
  <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
265
340
  <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3599374" sideWeight="0.48408487" order="7" side_tool="false" content_ui="tabs" />
341
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25931233" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
266
342
  <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
267
343
  <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
268
344
  <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
345
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
269
346
  <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
270
347
  <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
271
348
  <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
272
349
  <window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" x="100" y="100" width="1476" height="1240" />
273
350
  <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
274
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25931233" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
275
351
  <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
276
352
  <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
277
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
278
353
  </layout>
279
354
  </component>
280
355
  <component name="TypeScriptGeneratedFilesManager">
@@ -686,18 +761,18 @@
686
761
  </state>
687
762
  </provider>
688
763
  </entry>
689
- <entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query.rb">
764
+ <entry file="file://$PROJECT_DIR$/Gemfile">
690
765
  <provider selected="true" editor-type-id="text-editor">
691
- <state relative-caret-position="30">
692
- <caret line="2" column="14" lean-forward="true" selection-start-line="2" selection-start-column="14" selection-end-line="2" selection-end-column="14" />
766
+ <state relative-caret-position="45">
767
+ <caret line="3" column="7" lean-forward="true" selection-start-line="3" selection-start-column="7" selection-end-line="3" selection-end-column="7" />
693
768
  <folding />
694
769
  </state>
695
770
  </provider>
696
771
  </entry>
697
- <entry file="file://$PROJECT_DIR$/Gemfile">
772
+ <entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query.rb">
698
773
  <provider selected="true" editor-type-id="text-editor">
699
- <state relative-caret-position="45">
700
- <caret line="3" column="7" lean-forward="true" selection-start-line="3" selection-start-column="7" selection-end-line="3" selection-end-column="7" />
774
+ <state relative-caret-position="394">
775
+ <caret line="92" column="44" lean-forward="true" selection-start-line="92" selection-start-column="44" selection-end-line="92" selection-end-column="44" />
701
776
  <folding />
702
777
  </state>
703
778
  </provider>
@@ -12,6 +12,8 @@ module Aws
12
12
  # @see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
13
13
  #
14
14
  # @param [String] table_name The name of the table containing the requested items.
15
+ # @param [Class] model_class model record class used to find stored attributes
16
+ # @param [Boolean] nullify_model_attributes false by default, when true assigns null to model attributes that are not returned with DB resultset
15
17
  # @param [String] index_name The name of an index to query
16
18
  # @param [String] select The attributes to be returned in the result: ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, COUNT, SPECIFIC_ATTRIBUTES
17
19
  # @param [String] key_condition_expression The condition that specifies the key value(s) for items to be retrieved by the Query action
@@ -27,7 +29,22 @@ module Aws
27
29
  # @param [String] aws_dynamodb_endpoint AWS dynamodb endpoint is obtained by default from ENV['aws_dynamodb_endpoint'], use this parameter to override with your own
28
30
  #
29
31
  # @return [Array] array of Ruby Hash objects where each object contains all the values returned from dynamodb in dasherized format
30
- def self.call(table_name, index_name: nil, select: nil, key_condition_expression: nil, expression_attribute_names: nil, expression_attribute_values: nil, scan_index_forward: true, return_consumed_capacity: nil, pagination: false, last_evaluated_key: nil, aws_region: ENV['AWS_REGION'], aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], aws_dynamodb_endpoint: ENV['aws_dynamodb_endpoint'])
32
+ def self.call(table_name,
33
+ model_class: nil,
34
+ nullify_model_attributes: false,
35
+ index_name: nil,
36
+ select: nil,
37
+ key_condition_expression: nil,
38
+ expression_attribute_names: nil,
39
+ expression_attribute_values: nil,
40
+ scan_index_forward: true,
41
+ return_consumed_capacity: nil,
42
+ pagination: false,
43
+ last_evaluated_key: nil,
44
+ aws_region: ENV['AWS_REGION'],
45
+ aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
46
+ aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
47
+ aws_dynamodb_endpoint: ENV['aws_dynamodb_endpoint'])
31
48
  result = []
32
49
  # DyanmoDB Query results are divided into "pages" of data that are 1 MB in size (or less).
33
50
  # Agents data exceeds 1MB so we need multiple pages.
@@ -93,9 +110,11 @@ module Aws
93
110
  end
94
111
 
95
112
  # nullify remaining model attributes to be included in returned result
96
- unset_attributes = Agent.attribute_keys - stored_attributes
97
- unset_attributes.each do |attr|
98
- record[attr.to_s.dasherize] = nil
113
+ if nullify_model_attributes and model_class.respond_to? :attribute_keys
114
+ unset_attributes = model_class.attribute_keys - stored_attributes
115
+ unset_attributes.each do |attr|
116
+ record[attr.to_s.dasherize] = nil
117
+ end
99
118
  end
100
119
 
101
120
  result << record
@@ -1,7 +1,7 @@
1
1
  module Aws
2
2
  module Dynamodb
3
3
  module Query
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.8'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-dynamodb-query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - khaled83
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-02 00:00:00.000000000 Z
11
+ date: 2017-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler