active_spy 1.4.2 → 1.4.3

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: b772783c7223609dd9f30011750e648df6cacaa4
4
- data.tar.gz: 1a48f5c50c9e6dd0e5893d4ca0d3f12f4e903797
3
+ metadata.gz: 54f7b646c087efbd2da9eddef6892657e11e48b7
4
+ data.tar.gz: 2fd4c4a5b553747e6bd385fcb477b005fcc1753e
5
5
  SHA512:
6
- metadata.gz: 10005804eb6e8a930ef896ab6ba1f2aa9d0a960c1a0ffe9c5a72db2a209fbfb2ad635b75dcd06842f80badba0b49c75a6a11930364403d4530a2feebd11c0183
7
- data.tar.gz: 16fe6441aef9ba8b33bfa8e400e099bfee05ce3e27a1ae0a334081c187371ace67a4618fcf2a861e46ec875daab532ec7365ec15312818e59aa17d3d28cc919b
6
+ metadata.gz: efab2439161262cca3a25be24a3d7b748dd990fc073594e66151505b2d75117b5d8c8e1177a6088434a623973de85db2f3d96b42d393406ae434026ecb121192
7
+ data.tar.gz: 287de2bf28b7b19fd3f86174c76b0ea1fe86fd5aa4174e5c93887736a74745da9a714540fbe49269340ce90fe95db2377e59e9e78a9feb548f744d902d0fe0b2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.2
1
+ 1.4.3
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.4.2 ruby lib
5
+ # stub: active_spy 1.4.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "active_spy"
9
- s.version = "1.4.2"
9
+ s.version = "1.4.3"
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 = "2015-05-29"
14
+ s.date = "2015-06-01"
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 = [
@@ -16,4 +16,5 @@ ActiveSpy.configure do |config|
16
16
 
17
17
  config.event_host env_settings['event_host']
18
18
  config.event_port env_settings['event_port'].to_s
19
+ config.event_verify_ssl env_settings['event_verify_ssl']
19
20
  end
data/lib/active_spy.rb CHANGED
@@ -39,10 +39,10 @@ module ActiveSpy
39
39
  return if self.service_registered?
40
40
  service = { service: ActiveSpy::Configuration.settings }.to_json
41
41
 
42
- params = { content_type: :json }
42
+ params = { content_type: :json, method: :post, url: @base_url, payload: service }
43
43
  params[:verify_ssl] = verify_ssl if verify_ssl
44
44
 
45
- RestClient.post(@base_url, service, params)
45
+ RestClient::Request.execute(params)
46
46
  end
47
47
 
48
48
  # @!method self.service_registered?
@@ -56,7 +56,7 @@ module ActiveSpy
56
56
 
57
57
  begin
58
58
  if verify_ssl
59
- RestClient.get url, verify_ssl: verify_ssl
59
+ RestClient::Request.execute(method: :get, url: url, verify_ssl: verify_ssl)
60
60
  else
61
61
  RestClient.get url
62
62
  end
@@ -85,11 +85,13 @@ module ActiveSpy
85
85
  host = ActiveSpy::Configuration.event_host
86
86
  port = ActiveSpy::Configuration.event_port
87
87
  verify_ssl = ActiveSpy::Configuration.event_verify_ssl
88
+ url = "#{host}:#{port}/events"
88
89
 
89
- params = { content_type: :json }
90
+ params = { content_type: :json, method: :post, url: url, payload: @event_json }
90
91
  params[:verify_ssl] = verify_ssl if verify_ssl
92
+
91
93
  begin
92
- response = RestClient.post "#{host}:#{port}/events", @event_json, params
94
+ response = RestClient::Request.execute(params)
93
95
  rescue => e
94
96
  ::Rails.logger.info(e.response)
95
97
  end
@@ -57,7 +57,7 @@ module ActiveSpy
57
57
  #
58
58
  def get_old_hooks
59
59
  request = if @verify_ssl
60
- RestClient.get(@base_service_url, verify_ssl: @verify_ssl)
60
+ RestClient::Request.execute(method: :get, url: @base_service_url, verify_ssl: @verify_ssl)
61
61
  else
62
62
  RestClient.get(@base_service_url)
63
63
  end
@@ -106,10 +106,11 @@ module ActiveSpy
106
106
  #
107
107
  def delete_hooks(hooks_to_delete)
108
108
  hooks_to_delete.each do |hook|
109
+ url = "#{@base_service_url}/hooks/#{hook['id']}"
109
110
  if @verify_ssl
110
- RestClient.delete "#{@base_service_url}/hooks/#{hook['id']}", verify_ssl: @verify_ssl
111
+ RestClient::Request.execute(method: :delete, url: url, verify_ssl: @verify_ssl)
111
112
  else
112
- RestClient.delete "#{@base_service_url}/hooks/#{hook['id']}"
113
+ RestClient.delete url
113
114
  end
114
115
  end
115
116
  end
@@ -117,8 +118,7 @@ module ActiveSpy
117
118
  # # Properly creates the +hooks_to_add+ in the event runner.
118
119
  #
119
120
  def add_hooks(hooks_to_add)
120
- params = { content_type: :json }
121
- params[:verify_ssl] = @verify_ssl if @verify_ssl
121
+ url = "#{@base_service_url}/hooks"
122
122
 
123
123
  hooks_to_add.each do |hook|
124
124
  hook = {
@@ -127,7 +127,13 @@ module ActiveSpy
127
127
  'post_path' => ActiveSpy::Engine.routes.url_helpers.notifications_path(hook['post_class'].downcase),
128
128
  }
129
129
  }
130
- RestClient.post "#{@base_service_url}/hooks", hook.to_json, params
130
+
131
+ if @verify_ssl
132
+ RestClient::Request.execute(content_type: :json, method: :post,
133
+ url: url, payload: hook.to_json, verify_ssl: @verify_ssl)
134
+ else
135
+ RestClient.post url, hook.to_json, content_type: :json
136
+ end
131
137
  end
132
138
  end
133
139
  end
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.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas Camata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport