dynamini 2.10.1 → 2.10.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
  SHA1:
3
- metadata.gz: 7666f36d72a5a8cd120410d8d1f915d79ca61d50
4
- data.tar.gz: cb3c42f63ecb17bbfc877f534829ee8b915e3fb5
3
+ metadata.gz: 6de2fb3c93586ae5e29c842aa20c5c4b2ffbe15a
4
+ data.tar.gz: d010ecba7e323942905a366eb238982520eb7c83
5
5
  SHA512:
6
- metadata.gz: fdc3861dca2bb1a7c2253b188e70023bffbc90cfc12c8c35f5fadc8b7bf1a382ed4e9619051526e321f28e82fbed062f9d14b74d3f9eb7c6c02d73466289f751
7
- data.tar.gz: 090851dfcd7df23511dc98800d3946de5e6133520128953c81980fa545da3f256927ef88a39c491bdca7baebd5e236c4c4cecfdcf47639b415dda9940d93d89a
6
+ metadata.gz: 4b9452e98ada739ee207ccd048ff29d1cc7762687da1f125160fd19f0ac1e8d24eb7de15de6195f4a79c7e3c0fb61b74bda5a5a14e5fdc8f76aab820a5b57cf7
7
+ data.tar.gz: 6996d29cd05339962ef97335e98b1e8776b3ded5f2d131bcda222652bc95e027c36bb1f9f71eec744ccfaf253cb588007149705bf5739213d8603a529d0860cd
data/Gemfile.lock CHANGED
@@ -1,29 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dynamini (2.10.0)
4
+ dynamini (2.10.1)
5
5
  activemodel (>= 3, < 5.0)
6
6
  aws-sdk (~> 2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activemodel (4.2.5.1)
12
- activesupport (= 4.2.5.1)
11
+ activemodel (4.2.9)
12
+ activesupport (= 4.2.9)
13
13
  builder (~> 3.1)
14
- activesupport (4.2.5.1)
14
+ activesupport (4.2.9)
15
15
  i18n (~> 0.7)
16
- json (~> 1.7, >= 1.7.7)
17
16
  minitest (~> 5.1)
18
17
  thread_safe (~> 0.3, >= 0.3.4)
19
18
  tzinfo (~> 1.1)
20
- aws-sdk (2.2.22)
21
- aws-sdk-resources (= 2.2.22)
22
- aws-sdk-core (2.2.22)
19
+ aws-sdk (2.10.48)
20
+ aws-sdk-resources (= 2.10.48)
21
+ aws-sdk-core (2.10.48)
22
+ aws-sigv4 (~> 1.0)
23
23
  jmespath (~> 1.0)
24
- aws-sdk-resources (2.2.22)
25
- aws-sdk-core (= 2.2.22)
26
- builder (3.2.2)
24
+ aws-sdk-resources (2.10.48)
25
+ aws-sdk-core (= 2.10.48)
26
+ aws-sigv4 (1.0.2)
27
+ builder (3.2.3)
27
28
  coderay (1.1.0)
28
29
  diff-lcs (1.2.5)
29
30
  ffi (1.9.10)
@@ -48,15 +49,14 @@ GEM
48
49
  guard-shell (0.7.1)
49
50
  guard (>= 2.0.0)
50
51
  guard-compat (~> 1.0)
51
- i18n (0.7.0)
52
- jmespath (1.1.3)
53
- json (1.8.3)
52
+ i18n (0.8.6)
53
+ jmespath (1.3.1)
54
54
  listen (3.0.3)
55
55
  rb-fsevent (>= 0.9.3)
56
56
  rb-inotify (>= 0.9)
57
57
  lumberjack (1.0.9)
58
58
  method_source (0.8.2)
59
- minitest (5.8.4)
59
+ minitest (5.10.3)
60
60
  nenv (0.2.0)
61
61
  notiffany (0.0.8)
62
62
  nenv (~> 0.1)
@@ -85,8 +85,8 @@ GEM
85
85
  shellany (0.0.1)
86
86
  slop (3.6.0)
87
87
  thor (0.19.1)
88
- thread_safe (0.3.5)
89
- tzinfo (1.2.2)
88
+ thread_safe (0.3.6)
89
+ tzinfo (1.2.3)
90
90
  thread_safe (~> 0.1)
91
91
 
92
92
  PLATFORMS
@@ -99,3 +99,6 @@ DEPENDENCIES
99
99
  guard-shell
100
100
  pry (~> 0)
101
101
  rspec (~> 3)
102
+
103
+ BUNDLED WITH
104
+ 1.16.0.pre.2
data/dynamini.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'dynamini'
3
- s.version = '2.10.1'
3
+ s.version = '2.10.2'
4
4
  s.summary = 'DynamoDB interface'
5
5
  s.description = 'Lightweight DynamoDB interface gem designed as
6
6
  a drop-in replacement for ActiveRecord.
@@ -69,10 +69,20 @@ module Dynamini
69
69
  end
70
70
 
71
71
  def build_expression_attribute_values(args)
72
+ range_key = current_index_range_key(args)
73
+
74
+ if (handle = handles[range_key.to_sym])
75
+ start_val = args[:start] ? attribute_callback(TypeHandler::SETTER_PROCS, handle, args[:start], false) : nil
76
+ end_val = args[:end] ? attribute_callback(TypeHandler::SETTER_PROCS, handle, args[:end], false) : nil
77
+ else
78
+ start_val = args[:start]
79
+ end_val = args[:end]
80
+ end
81
+
72
82
  expression_values = {}
73
83
  expression_values[':h'] = args[:hash_key]
74
- expression_values[':s'] = args[:start] if args[:start]
75
- expression_values[':e'] = args[:end] if args[:end]
84
+ expression_values[':s'] = start_val if start_val
85
+ expression_values[':e'] = end_val if end_val
76
86
  expression_values
77
87
  end
78
88
 
@@ -18,8 +18,10 @@ describe Dynamini::Querying do
18
18
  set_hash_key :foo
19
19
  set_range_key :bar
20
20
  set_secondary_index :secondary_index, hash_key: :secondary_hash_key, range_key: :secondary_range_key
21
+ set_secondary_index :tertiary_index, hash_key: :tertiary_hash_key, range_key: :tertiary_range_key
21
22
  handle :bar, :integer
22
23
  handle :secondary_range_key, :integer
24
+ handle :tertiary_range_key, :time
23
25
  end
24
26
 
25
27
  describe '.find' do
@@ -270,6 +272,24 @@ describe Dynamini::Querying do
270
272
  expect(TestClassWithRange.query(hash_key: 'non-existent-key', index_name: :secondary_index)).to eq([])
271
273
  end
272
274
  end
275
+
276
+ context 'with a type handled range key' do
277
+ it 'converts the start and end parameter to the raw type' do
278
+ start_param = Time.new(2000, 1, 1)
279
+ end_param = Time.new(2001, 1, 1)
280
+
281
+ expect(TestClassWithRange.client).to receive(:query).with(hash_including(
282
+ expression_attribute_values: {':h' => '12345', ':s' => start_param.to_f, ':e' => end_param.to_f}
283
+ )).and_return(OpenStruct.new(items: []))
284
+
285
+ TestClassWithRange.query(
286
+ hash_key: '12345',
287
+ index_name: :tertiary_index,
288
+ start: start_param,
289
+ end: end_param
290
+ )
291
+ end
292
+ end
273
293
  end
274
294
 
275
295
  describe '.exists?' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamini
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.1
4
+ version: 2.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Ward
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2017-09-19 00:00:00.000000000 Z
18
+ date: 2017-10-02 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activemodel