dynamodb-api 0.3.1 → 0.3.2

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
  SHA256:
3
- metadata.gz: 103a1c31346382c94e09bf2a72b6f19a4beaa332f4ec67f977fcf82096a13af7
4
- data.tar.gz: c814beb0514fd79802b3a8dd72e126ede9c1757ced0a6f04d0792ede7d1b1c0a
3
+ metadata.gz: e26469278271c2105d8178a710e44188444669bc5b0e5836d8841563af38f5e5
4
+ data.tar.gz: b93ba92f5c00e7c7062cea8b8b9c014a80fcd22a7f8ad687d47b0d04737676c1
5
5
  SHA512:
6
- metadata.gz: '05700607855a33c9628b615bd57320fe93bba3ad22963bf1657e7282ecac039400e3f79f53f896a56f0d2aae3a8760c44aca66fa04f5715dc99bf0b0bb1ac706'
7
- data.tar.gz: fd9c9124466bb97054cfa2671cb89375ce81e66a109dee79bfb9a06694ea3aa28505ad511d5775b1f0507dc9fd221944740610cdf8c9db744f7bee39dd557eea
6
+ metadata.gz: 15b00f5440b621d9f515c207ce2beef65ab094c94e2504dfdf32392a23476cba273734908da29a2202e55d9abdb16059c3a7152dc117c13e2550b629408bb5eb
7
+ data.tar.gz: 5a9fef74495cf50628c0c4e4ed69016246272fec57b243c99d610bb109db4ac4b650a9d77b95631c55159fbaba8abd864387f65776f4442cd2df2cc8cedebd4c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dynamodb-api (0.3.1)
4
+ dynamodb-api (0.3.2)
5
5
  activesupport (>= 4)
6
6
  aws-sdk (~> 2)
7
7
 
@@ -23,19 +23,10 @@ module Dynamodb
23
23
  index_name: @relation.index_clause.name,
24
24
  select: @relation.select_clause.name,
25
25
  scan_index_forward: @relation.order_clause.direct,
26
- key_conditions: build_where_clause
26
+ key_conditions: @relation.where_clause.key_conditions
27
27
  }.merge(build_filter_clause)
28
28
  end
29
29
 
30
- def build_where_clause
31
- {
32
- @relation.where_clause.key => {
33
- attribute_value_list: [@relation.where_clause.value],
34
- comparison_operator: @relation.where_clause.operator
35
- }
36
- }
37
- end
38
-
39
30
  def build_filter_clause
40
31
  {
41
32
  filter_expression: @relation.filter_clause.expression,
@@ -25,8 +25,8 @@ module Dynamodb
25
25
  self
26
26
  end
27
27
 
28
- def where(key, value, operator)
29
- self.where_clause = Relation::WhereClause.new(key, value, operator)
28
+ def where(key_conditions)
29
+ self.where_clause = Relation::WhereClause.new(key_conditions)
30
30
  self
31
31
  end
32
32
 
@@ -4,14 +4,25 @@ module Dynamodb
4
4
  module Api
5
5
  class Relation
6
6
  class WhereClause # :nodoc:
7
- attr_reader :key
8
- attr_reader :value
9
- attr_reader :operator
7
+ attr_reader :key_conditions
10
8
 
11
- def initialize(key, value, operator)
12
- @key = key
13
- @value = value
14
- @operator = operator
9
+ KEY = 0
10
+ VALUE = 1
11
+ OPERATOR = 2
12
+
13
+ def initialize(key_conditions)
14
+ @key_conditions = build(key_conditions)
15
+ end
16
+
17
+ private
18
+
19
+ def build(key_conditions)
20
+ key_conditions.each_with_object({}) do |c, h|
21
+ h[c[KEY]] = {
22
+ attribute_value_list: c[VALUE],
23
+ comparison_operator: c[OPERATOR]
24
+ }
25
+ end
15
26
  end
16
27
  end
17
28
  end
@@ -1,5 +1,5 @@
1
1
  module Dynamodb
2
2
  module Api
3
- VERSION = '0.3.1'.freeze
3
+ VERSION = '0.3.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamodb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - WalkerSumida
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-22 00:00:00.000000000 Z
11
+ date: 2018-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk