eotb 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source :rubygems
2
2
  gem "jeweler", ">= 1.4.0"
3
3
  gem "json", ">= 1.4.3"
4
- gem "rspec", ">= 1.3.0"
4
+ gem "rspec", ">= 1.3.0"
5
+ gem "hoptoad_notifier", ">= 2.3.2"
data/Gemfile.lock CHANGED
@@ -1,15 +1,32 @@
1
1
  ---
2
- hash: 3dbced1d1a21525620b773ff6f5ea1c928f6e9b4
3
- sources:
4
- - Rubygems:
5
- uri: http://gemcutter.org
2
+ dependencies:
3
+ rspec:
4
+ group:
5
+ - :default
6
+ version: ">= 1.3.0"
7
+ json:
8
+ group:
9
+ - :default
10
+ version: ">= 1.4.3"
11
+ jeweler:
12
+ group:
13
+ - :default
14
+ version: ">= 1.4.0"
15
+ hoptoad_notifier:
16
+ group:
17
+ - :default
18
+ version: ">= 0"
6
19
  specs:
7
- - json_pure:
8
- version: 1.4.3
20
+ - activesupport:
21
+ version: 2.3.8
9
22
  - gemcutter:
10
- version: 0.5.0
23
+ version: 0.6.1
11
24
  - git:
12
25
  version: 1.2.5
26
+ - hoptoad_notifier:
27
+ version: 2.3.2
28
+ - json_pure:
29
+ version: 1.4.3
13
30
  - rubyforge:
14
31
  version: 2.0.4
15
32
  - jeweler:
@@ -18,16 +35,7 @@ specs:
18
35
  version: 1.4.3
19
36
  - rspec:
20
37
  version: 1.3.0
21
- dependencies:
22
- jeweler:
23
- version: ">= 1.4.0"
24
- group:
25
- - :default
26
- json:
27
- version: ">= 1.4.3"
28
- group:
29
- - :default
30
- rspec:
31
- version: ">= 1.3.0"
32
- group:
33
- - :default
38
+ hash: 489f72bcf927655f3b5fdc56b1fa93742e792bf5
39
+ sources:
40
+ - Rubygems:
41
+ uri: http://gemcutter.org
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ begin
13
13
  gem.add_development_dependency "rspec", ">= 1.3.0"
14
14
  gem.add_development_dependency "jeweler", ">= 1.4.0"
15
15
  gem.add_dependency "json", ">= 1.4.3"
16
+ gem.add_dependency "hoptoad_notifier", ">= 2.3.2"
16
17
  end
17
18
 
18
19
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.4
1
+ 0.4.5
data/eotb.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{eotb}
8
- s.version = "0.4.4"
8
+ s.version = "0.4.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ragnarson"]
12
- s.date = %q{2010-07-20}
12
+ s.date = %q{2010-07-21}
13
13
  s.description = %q{Rails plugin which allow you easily track and observe your apps}
14
14
  s.email = %q{bartlomiej.kozal@ragnarson.com}
15
15
  s.extra_rdoc_files = [
@@ -48,15 +48,18 @@ Gem::Specification.new do |s|
48
48
  s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
49
49
  s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
50
50
  s.add_runtime_dependency(%q<json>, [">= 1.4.3"])
51
+ s.add_runtime_dependency(%q<hoptoad_notifier>, [">= 2.3.2"])
51
52
  else
52
53
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
53
54
  s.add_dependency(%q<jeweler>, [">= 1.4.0"])
54
55
  s.add_dependency(%q<json>, [">= 1.4.3"])
56
+ s.add_dependency(%q<hoptoad_notifier>, [">= 2.3.2"])
55
57
  end
56
58
  else
57
59
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
58
60
  s.add_dependency(%q<jeweler>, [">= 1.4.0"])
59
61
  s.add_dependency(%q<json>, [">= 1.4.3"])
62
+ s.add_dependency(%q<hoptoad_notifier>, [">= 2.3.2"])
60
63
  end
61
64
  end
62
65
 
data/lib/eotb.rb CHANGED
@@ -1,10 +1,14 @@
1
1
  require 'rubygems'
2
2
  require 'net/http'
3
+ require 'timeout'
3
4
  require 'uri'
4
5
  require 'json'
6
+ require 'hoptoad_notifier'
7
+
8
+ HoptoadNotifier.configure { |config| config.api_key='f625b37e34b6084e4a2eae85e6de954f' }
5
9
 
6
10
  class Eotb
7
-
11
+
8
12
  METHODS = [:to_actor, :to_subject, :to_json, :to_hash, :inspect]
9
13
 
10
14
  def self.configure(api_key, host = '127.0.0.1', port = '3000')
@@ -17,7 +21,14 @@ class Eotb
17
21
  action = { "event[action]" => action.to_s }
18
22
  event = @@api_key.merge(hash_format(actor, :actor)).merge(action).merge(hash_format(subject, :subject))
19
23
  @@post.set_form_data(event)
20
- Net::HTTP.new(@@uri.host, @@uri.port).start.request(@@post)
24
+ begin
25
+ Timeout::timeout(2) {
26
+ Net::HTTP.new(@@uri.host, @@uri.port).start.request(@@post)
27
+ }
28
+ rescue => e
29
+ puts "TIMEOUT"
30
+ HoptoadNotifier.notify(e)
31
+ end
21
32
  end
22
33
 
23
34
  def self.value_format(value)
@@ -40,15 +51,14 @@ class Eotb
40
51
 
41
52
  def self.hash_format(hash, type)
42
53
  if hash.is_a?(Hash)
43
- a = hash_flatten(hash).map do |k, v|
54
+ h = hash_flatten(hash).map do |k, v|
44
55
  key = k.map{ |e| "[#{e}]" }.join
45
56
  "\"event[#{type}]#{key}\" => #{value_format(v)}"
46
- end
47
- a.join(', ')
57
+ end.join(', ')
48
58
  else
49
- a = "\"event[#{type}]\" => #{value_format(hash)}"
59
+ h = "\"event[#{type}]\" => #{value_format(hash)}"
50
60
  end
51
- eval('{' + a.to_s + '}')
61
+ eval "{#{h.to_s}}"
52
62
  end
53
63
 
54
- end
64
+ end
data/spec/eotb_spec.rb CHANGED
@@ -47,4 +47,4 @@ describe Eotb do
47
47
  Eotb.register_event([2,3,4], :action, {:username => ["John", "Josh"]}).code.should == @response
48
48
  end
49
49
 
50
- end
50
+ end
data/spec/spec_helper.rb CHANGED
@@ -3,7 +3,6 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'eotb'
4
4
  require 'spec'
5
5
  require 'spec/autorun'
6
-
7
6
  Spec::Runner.configure do |config|
8
7
 
9
- end
8
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eotb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.4
9
+ - 5
10
+ version: 0.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ragnarson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-20 00:00:00 +02:00
18
+ date: 2010-07-21 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -66,6 +66,22 @@ dependencies:
66
66
  version: 1.4.3
67
67
  type: :runtime
68
68
  version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: hoptoad_notifier
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 7
78
+ segments:
79
+ - 2
80
+ - 3
81
+ - 2
82
+ version: 2.3.2
83
+ type: :runtime
84
+ version_requirements: *id004
69
85
  description: Rails plugin which allow you easily track and observe your apps
70
86
  email: bartlomiej.kozal@ragnarson.com
71
87
  executables: []