active_spy 1.3.9 → 1.3.10

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: 958e1adca6d2520d73bdbb3f5fd9533f9ac207a0
4
- data.tar.gz: 5af7b7c09aaf6cdf2a741bcf6b07eb4953bf39a8
3
+ metadata.gz: a03fdab2f2cc146c75d01e0a6229eecc328406d8
4
+ data.tar.gz: de5eb5be6e6962ff7b1f237fbe5765f2e7f18a3e
5
5
  SHA512:
6
- metadata.gz: 638d8b4b04fb4988cdfd4746a1858ad58c2c2a1956a244d3f5f8c9eae167c46d935edf3b11ed206a87c93314595d3526d1b0767d6ca377fcc396228459472c71
7
- data.tar.gz: 47bc762bb0b25b0c1d295cc4d3f722a3f7ac2df3ae88a0c574d16efdb06e23563a14e8ed7d4a5ad3e32a8a21f293680223fecf13a31c4b089ddd470ef80b61b4
6
+ metadata.gz: 25e424aec7aa4443e8e4d9258653997e304429f08e176058de229cd6165cc2a2a399528ac3cef3e589bf9c8fabcd0e071fc0d82e3d2357c04ac2d015c1f1a686
7
+ data.tar.gz: 5b8ff9e4c66cb832619cf4ef7701d7fd06a907e841a63636eab2ebfe618a60db4810e808ef7d3614e856ec8ca86036b7e81b5f349adedb14357d504458a18848
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.9
1
+ 1.3.10
data/active_spy.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: active_spy 1.3.9 ruby lib
5
+ # stub: active_spy 1.3.10 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "active_spy"
9
- s.version = "1.3.9"
9
+ s.version = "1.3.10"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Douglas Camata"]
14
- s.date = "2014-10-20"
14
+ s.date = "2014-10-23"
15
15
  s.description = " Watch for a method call in any class and run before/after callbacks.\n You can even watch your Rails models for events (like create, update,\n destroy), send these events to a event-runner instance and it redirect these\n events to other apps that are subscrived for them. This gem also provides\n classes that you can use to process the received events too.\n"
16
16
  s.email = "d.camata@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -1,3 +1,6 @@
1
+ class UnsupportedORM < RuntimeError
2
+ end
3
+
1
4
  module ActiveSpy
2
5
  # Controller to handle notifications request coming from an event-runner
3
6
  # instance.
@@ -20,13 +23,23 @@ module ActiveSpy
20
23
  ::Rails.logger.warn("[EVENT][#{hook['post_class']}] Listener result: #{result}")
21
24
  if result.is_a? Array
22
25
  handle_array_result(hook, result, params)
23
- elsif result.is_a? ActiveRecord::Base
26
+ elsif is_a_model?(result)
24
27
  handle_model_result(hook, result, params)
25
28
  else
26
29
  render nothing: true
27
30
  end
28
31
  end
29
32
 
33
+ def is_a_model?(something)
34
+ if defined?(ActiveRecord)
35
+ something.is_a? ActiveRecord::Base
36
+ elsif defined?(Mongoid)
37
+ something.class.included_modules.include? Mongoid::Document
38
+ else
39
+ raise UnsupportedORM
40
+ end
41
+ end
42
+
30
43
  def get_result(hook, params)
31
44
  listener = "#{hook['post_class']}Listener".constantize
32
45
  result = listener.new.handle(params['event'])
@@ -81,6 +81,7 @@ module ActiveSpy
81
81
  # Sends the event request to the configured event-runner instance.
82
82
  #
83
83
  def send_event_request
84
+ response = nil
84
85
  host = ActiveSpy::Configuration.event_host
85
86
  port = ActiveSpy::Configuration.event_port
86
87
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_spy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas Camata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-20 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport