alephant-support 0.0.1 → 0.0.2
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/.gitignore +3 -0
- data/.travis.yml +9 -0
- data/README.md +5 -1
- data/lib/alephant/support/dynamodb/table.rb +41 -0
- data/lib/alephant/support/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6641b35a27e1c6cf574bb3739134d5129b8ff273
|
4
|
+
data.tar.gz: 58fb9727a6fddf3c18af75b11c00015a693d31ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14330b8e100214eb3977823fce266616f3bdd10d596071c454cdb0f5b5fdd1d31100c9d42c94fc70643030fdd98bc2fc8ea30068d7632c171645f4ebe6693c4a
|
7
|
+
data.tar.gz: a6e5fd38945d1f7f1ff18f3f2a02e3a3f4e19711c907c5eae87b93a256448ddbe8ce946ff04da440f7500d3db13e2b67627cb71f7d98280f8dd3eeee45a9ce09
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Alephant::Support
|
2
2
|
|
3
|
-
|
3
|
+
Provides support classes to Alephant gems
|
4
|
+
|
5
|
+
[](https://travis-ci.org/BBC-News/alephant-support)
|
6
|
+
|
7
|
+
[](http://badge.fury.io/rb/alephant-support)
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Alephant
|
2
|
+
module Support
|
3
|
+
module DynamoDB
|
4
|
+
class Table
|
5
|
+
TIMEOUT = 120
|
6
|
+
DEFAULT_CONFIG = {
|
7
|
+
:write_units => 5,
|
8
|
+
:read_units => 10,
|
9
|
+
}
|
10
|
+
|
11
|
+
def table
|
12
|
+
raise NotImplementedError
|
13
|
+
end
|
14
|
+
|
15
|
+
def truncate!
|
16
|
+
batch_delete table_data
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def batch_delete(rows)
|
22
|
+
rows.each_slice(25) { |arr| table.batch_delete(arr) }
|
23
|
+
end
|
24
|
+
|
25
|
+
def table_data
|
26
|
+
table.items.collect do |item|
|
27
|
+
construct_attributes_from item
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def construct_attributes_from(item)
|
32
|
+
no_range_key? ? item.hash_value : [item.hash_value, item.range_value.to_i]
|
33
|
+
end
|
34
|
+
|
35
|
+
def no_range_key?
|
36
|
+
@range_found ||= table.range_key.nil?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -158,6 +158,7 @@ extensions: []
|
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
160
|
- .gitignore
|
161
|
+
- .travis.yml
|
161
162
|
- Gemfile
|
162
163
|
- Gemfile.lock
|
163
164
|
- Guardfile
|
@@ -166,6 +167,7 @@ files:
|
|
166
167
|
- Rakefile
|
167
168
|
- alephant-support.gemspec
|
168
169
|
- lib/alephant/support.rb
|
170
|
+
- lib/alephant/support/dynamodb/table.rb
|
169
171
|
- lib/alephant/support/jsonpath_lookup.rb
|
170
172
|
- lib/alephant/support/parser.rb
|
171
173
|
- lib/alephant/support/version.rb
|
@@ -198,3 +200,4 @@ summary: Supporting classes for the alephant framework
|
|
198
200
|
test_files:
|
199
201
|
- spec/parser_spec.rb
|
200
202
|
- spec/spec_helper.rb
|
203
|
+
has_rdoc:
|