alephant-support 0.0.1 → 0.0.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: e2ef7f6a917c1b5604f67023e8d3864c8772891e
4
- data.tar.gz: a77caf72a44f616cb2869eec9e2061f5b6afb50f
3
+ metadata.gz: 6641b35a27e1c6cf574bb3739134d5129b8ff273
4
+ data.tar.gz: 58fb9727a6fddf3c18af75b11c00015a693d31ee
5
5
  SHA512:
6
- metadata.gz: 2415a4b4429ca2e44eb52ce3ecf8b5ba922292dcc0dec29aa28d56115ef5ee90040b4349002091c277737876e6c207e81323cf463e7fb033e55489cf4484ef07
7
- data.tar.gz: 41ed929472933a03da051b060380c0daa4754b5ade35c916eec966e2b363c9db1941aac6c41cd75f818ff81fcfeb123583361fceeeebc343c2a9e40e2377f89a
6
+ metadata.gz: 14330b8e100214eb3977823fce266616f3bdd10d596071c454cdb0f5b5fdd1d31100c9d42c94fc70643030fdd98bc2fc8ea30068d7632c171645f4ebe6693c4a
7
+ data.tar.gz: a6e5fd38945d1f7f1ff18f3f2a02e3a3f4e19711c907c5eae87b93a256448ddbe8ce946ff04da440f7500d3db13e2b67627cb71f7d98280f8dd3eeee45a9ce09
data/.gitignore CHANGED
@@ -1,2 +1,5 @@
1
1
  *.swp
2
+ .rspec
2
3
  tmp
4
+ pkg
5
+ *.gem
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - "jruby"
4
+ notifications:
5
+ email:
6
+ recipients:
7
+ - kenoir@gmail.com
8
+ on_failure: change
9
+ on_success: never
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Alephant::Support
2
2
 
3
- TODO: Write a gem description
3
+ Provides support classes to Alephant gems
4
+
5
+ [![Build Status](https://travis-ci.org/BBC-News/alephant-support.png?branch=master)](https://travis-ci.org/BBC-News/alephant-support)
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/alephant-support.png)](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
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Support
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  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.1
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-21 00:00:00.000000000 Z
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: