dynamini 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -4
- data/README.md +1 -0
- data/dynamini.gemspec +1 -1
- data/lib/dynamini/querying.rb +11 -5
- data/spec/dynamini/querying_spec.rb +15 -0
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4382124a6df49ad96e9271692d690888d21dc4c2
|
4
|
+
data.tar.gz: ef8d08e37c56c3fb2b2abb8dd5fd01240f76b1ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b49f7fca7cf684853c1f66f01089d32ee492afd7e23331e48fe90208aaff86401e818b9bca9438c2f2ace5f66340d4be4bb4a13605fd040e9d05afe40ceabfa7
|
7
|
+
data.tar.gz: d40044dda4fad2fa99d8b012b61b5971764cd5fc154b0439c38871ab910d75d8f9d6e8cedb343377842cd047ecdfe8cdc662f97c9f94a00f59c91bd3b021426d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/dynamini.gemspec
CHANGED
data/lib/dynamini/querying.rb
CHANGED
@@ -9,6 +9,12 @@ module Dynamini
|
|
9
9
|
new(response.item.symbolize_keys, false)
|
10
10
|
end
|
11
11
|
|
12
|
+
def find_or_nil(hash_value, range_value = nil)
|
13
|
+
find(hash_value, range_value)
|
14
|
+
rescue RuntimeError
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
12
18
|
def exists?(hash_value, range_value = nil)
|
13
19
|
fail 'Range key cannot be blank.' if range_key && range_value.nil?
|
14
20
|
|
@@ -47,11 +53,11 @@ module Dynamini
|
|
47
53
|
expression_attribute_names = build_expression_attribute_names(args)
|
48
54
|
query = set_extra_parameters(
|
49
55
|
{
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
56
|
+
table_name: table_name,
|
57
|
+
key_condition_expression: key_condition_expression,
|
58
|
+
expression_attribute_names: expression_attribute_names,
|
59
|
+
expression_attribute_values: expression_attribute_values
|
60
|
+
},
|
55
61
|
args)
|
56
62
|
client.query(query)
|
57
63
|
end
|
@@ -52,6 +52,21 @@ describe Dynamini::Querying do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
describe '.find_or_nil' do
|
56
|
+
it 'should return nil if it cannot find the item' do
|
57
|
+
found = Dynamini::Base.find_or_nil('abcd1234')
|
58
|
+
expect(found).to be_nil
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should return the record if it exists' do
|
62
|
+
model.save
|
63
|
+
found = Dynamini::Base.find_or_nil('abcd1234')
|
64
|
+
expect(found.price).to eq(9.99)
|
65
|
+
expect(found.name).to eq('Widget')
|
66
|
+
expect(found.hash_key).to eq('009')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
55
70
|
describe '.query' do
|
56
71
|
before do
|
57
72
|
4.times do |i|
|
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.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Ward
|
@@ -15,110 +15,110 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2016-08-
|
18
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activemodel
|
22
22
|
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3'
|
27
|
-
- -
|
27
|
+
- - <
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '5.0'
|
30
30
|
type: :runtime
|
31
31
|
prerelease: false
|
32
32
|
version_requirements: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - '>='
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '3'
|
37
|
-
- -
|
37
|
+
- - <
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '5.0'
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: aws-sdk
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '2'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '2'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: rspec
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - ~>
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ~>
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '3'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
name: pry
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ~>
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
type: :development
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ~>
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: fuubar
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ~>
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '2'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ~>
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '2'
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: guard-rspec
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: guard-shell
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - '>='
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
type: :development
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- -
|
121
|
+
- - '>='
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
description: |-
|
@@ -130,9 +130,9 @@ executables: []
|
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
133
|
+
- .gitignore
|
134
|
+
- .rspec
|
135
|
+
- .travis.yml
|
136
136
|
- Gemfile
|
137
137
|
- Gemfile.lock
|
138
138
|
- Guardfile
|
@@ -172,17 +172,17 @@ require_paths:
|
|
172
172
|
- lib
|
173
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
174
|
requirements:
|
175
|
-
- -
|
175
|
+
- - '>='
|
176
176
|
- !ruby/object:Gem::Version
|
177
177
|
version: '0'
|
178
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
179
|
requirements:
|
180
|
-
- -
|
180
|
+
- - '>='
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.2.2
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: DynamoDB interface
|