limbo 0.0.4 → 0.0.5
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.
- data/lib/limbo.rb +21 -2
- data/lib/limbo/client.rb +1 -1
- data/lib/limbo/version.rb +1 -1
- data/spec/limbo_spec.rb +9 -0
- metadata +4 -3
data/lib/limbo.rb
CHANGED
@@ -5,10 +5,11 @@ require "limbo/client"
|
|
5
5
|
module Limbo
|
6
6
|
|
7
7
|
class << self
|
8
|
-
attr_accessor :uri, :key
|
8
|
+
attr_accessor :uri, :key, :environment, :service, :service_name
|
9
9
|
|
10
10
|
def configure
|
11
11
|
yield self
|
12
|
+
check_required_keys
|
12
13
|
end
|
13
14
|
|
14
15
|
def rails_post(hash)
|
@@ -17,7 +18,25 @@ module Limbo
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def post(hash)
|
20
|
-
Client.post(hash)
|
21
|
+
Client.post(default_hash.merge(hash))
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def default_hash
|
27
|
+
hash = { environment: environment}
|
28
|
+
hash[:service] = service if service
|
29
|
+
hash[:service_name] = service_name if service_name
|
30
|
+
hash
|
31
|
+
end
|
32
|
+
|
33
|
+
def check_required_keys
|
34
|
+
if uri.nil? or key.nil? or environment.nil?
|
35
|
+
message = [
|
36
|
+
"Required keys (uri, key, and environment) must",
|
37
|
+
"be defined in the Limbo configure block"].join(" ")
|
38
|
+
fail ArgumentError, message
|
39
|
+
end
|
21
40
|
end
|
22
41
|
end
|
23
42
|
end
|
data/lib/limbo/client.rb
CHANGED
data/lib/limbo/version.rb
CHANGED
data/spec/limbo_spec.rb
CHANGED
@@ -3,6 +3,8 @@ describe Limbo do
|
|
3
3
|
Limbo.configure do |config|
|
4
4
|
config.key = "test-key"
|
5
5
|
config.uri = "http://limbo-listener-staging.herokuapp.com"
|
6
|
+
config.environment = "test"
|
7
|
+
config.service = "worker"
|
6
8
|
end
|
7
9
|
end
|
8
10
|
|
@@ -14,6 +16,13 @@ describe Limbo do
|
|
14
16
|
client.should be_valid_data
|
15
17
|
client.should be_posted
|
16
18
|
end
|
19
|
+
|
20
|
+
it "adds default parameters" do
|
21
|
+
expected = {:environment=>"test", :service=> "worker", :l=>"k"}
|
22
|
+
Limbo::Client.should_receive(:post).with(expected)
|
23
|
+
|
24
|
+
Limbo.post({l: "k"})
|
25
|
+
end
|
17
26
|
end
|
18
27
|
|
19
28
|
describe ".rails_post" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limbo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.8.
|
129
|
+
rubygems_version: 1.8.24
|
130
130
|
signing_key:
|
131
131
|
specification_version: 3
|
132
132
|
summary: Limbo client post exception to the Limbo exception service.
|
@@ -143,3 +143,4 @@ test_files:
|
|
143
143
|
- spec/limbo/rails/request_spec.rb
|
144
144
|
- spec/limbo_spec.rb
|
145
145
|
- spec/spec_helper.rb
|
146
|
+
has_rdoc:
|