keen 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/keen_send CHANGED
@@ -42,4 +42,6 @@ required.each do |key|
42
42
  raise OptionParser::MissingArgument.new("you must send `#{key}` when running this command") if options[key].nil?
43
43
  end
44
44
 
45
- Keen::Client.process_queue(options)
45
+ storage_handler = Keen::Client.create_new_storage_handler(options[:storage_mode])
46
+ worker = Keen::Async::Worker.new(storage_handler)
47
+ puts worker.process_queue
data/lib/keen/client.rb CHANGED
@@ -30,15 +30,7 @@ module Keen
30
30
  def handler
31
31
 
32
32
  unless @storage_handler
33
- mode = @storage_mode
34
-
35
- case mode
36
- when :redis
37
- @storage_handler = Keen::Async::Storage::RedisHandler.new
38
- else
39
- raise "Unknown storage_mode sent to client: `#{mode}`"
40
- end
41
-
33
+ @storage_handler = self.class.create_new_storage_handler(@storage_mode)
42
34
  end
43
35
 
44
36
  @storage_handler
@@ -75,5 +67,14 @@ module Keen
75
67
  # TODO
76
68
  end
77
69
 
70
+ def self.create_new_storage_handler(storage_mode)
71
+ case storage_mode.to_sym
72
+ when :redis
73
+ Keen::Async::Storage::RedisHandler.new
74
+ else
75
+ raise "Unknown storage_mode sent to client: `#{storage_mode}`"
76
+ end
77
+ end
78
+
78
79
  end
79
80
  end
data/lib/keen/utils.rb ADDED
@@ -0,0 +1,12 @@
1
+
2
+ module Keen
3
+
4
+ module Utils
5
+
6
+ def self.symbolize_keys(hash)
7
+ hash.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
8
+ end
9
+
10
+ end
11
+ end
12
+
data/lib/keen/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Keen
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kyle Wild
@@ -196,6 +196,7 @@ files:
196
196
  - lib/keen/async/storage/redis_handler.rb
197
197
  - lib/keen/async/worker.rb
198
198
  - lib/keen/client.rb
199
+ - lib/keen/utils.rb
199
200
  - lib/keen/version.rb
200
201
  - test/keen_spec.rb
201
202
  has_rdoc: true