spacebunny 1.2.1 → 1.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 959545411cb9300660ebea4e3a98d763a53c60bb
4
- data.tar.gz: d7c76db70d9bf229c930a8eab87223a2f94170d0
3
+ metadata.gz: 892d8bf97ea06186b2d57513dbbd19af079af1a5
4
+ data.tar.gz: 5588c10bc31b8506431961d45d9667754bb71edf
5
5
  SHA512:
6
- metadata.gz: f15e9f4c2e7fc3312631e42b8d6a1f498447bb785c8cfdcb6c7d5f3dbc8308851c348a8375f9f6779ef3927365575757d0037760170206ef89ba8422401d0e5a
7
- data.tar.gz: 5259d658d1b70bf4e0dea4fe4103ddb5bf3cbda9e76bdd1b4eb60de3af48fca4c70cf49f885ee1e9cb9d6ef3dd8c12a97f787f06345a62bf12eff1a8ac9db43b
6
+ metadata.gz: 36bd68143b81a475e91044c1e86fa29c986bbb8ad0059c971fe9f45584127f6cd160fb9a85b91cc27c537b9a6202316c28bc7f4c3f1e48116d846eff3dedbadb
7
+ data.tar.gz: f71344d65f2e367a80b5992ebc60e3c10847137e746c1abf3cededdbd521f1cb28c39cbd0653dad77f1fa7a2ef206bdb8d21089732f9eb0ceb7f3b0560eec50b
@@ -26,18 +26,15 @@ module Spacebunny
26
26
  # Re-create client every time connect is called
27
27
  @client = Bunny.new(connection_params)
28
28
  @client.start
29
- end
30
-
31
- def channel_from_name(name)
32
- # In @built_channels in fact we have exchanges
33
- with_channel_check name do
34
- @built_exchanges[name]
35
- end
29
+ logger.info 'Connected to SpaceBunny'
36
30
  end
37
31
 
38
32
  def disconnect
39
33
  super
34
+ @built_exchanges = {}
35
+ @built_channels = {}
40
36
  client.stop if client
37
+ logger.info 'Disconnected from SpaceBunny'
41
38
  end
42
39
 
43
40
  def input_channel
@@ -24,13 +24,13 @@ module Spacebunny
24
24
  @key = key || options[:key]
25
25
  @api_endpoint = options[:api_endpoint] || {}
26
26
 
27
- extract_custom_connection_configs_from options
28
- set_channels options[:channels]
29
-
30
27
  @raise_on_error = options[:raise_on_error]
31
28
  @log_to = options[:log_to] || STDOUT
32
- @log_level = options[:log_level] || ::Logger::WARN
29
+ @log_level = options[:log_level] || ::Logger::ERROR
33
30
  @logger = options[:logger] || build_logger
31
+
32
+ extract_custom_connection_configs_from options
33
+ set_channels options[:channels]
34
34
  end
35
35
 
36
36
  def api_endpoint=(options)
@@ -199,6 +199,7 @@ module Spacebunny
199
199
  @custom_connection_configs[:device_id] = @custom_connection_configs.delete :device_id
200
200
  @custom_connection_configs[:device_name] = @custom_connection_configs.delete :device_name
201
201
  @custom_connection_configs[:secret] = @custom_connection_configs.delete :secret
202
+ @custom_connection_configs[:logger] = @custom_connection_configs.delete(:logger) || @logger
202
203
  end
203
204
 
204
205
  # @private
@@ -238,7 +239,7 @@ module Spacebunny
238
239
  when :error, ::Logger::ERROR, 'error' then ::Logger::ERROR
239
240
  when :fatal, ::Logger::FATAL, 'fatal' then ::Logger::FATAL
240
241
  else
241
- Logger::WARN
242
+ Logger::ERROR
242
243
  end
243
244
  end
244
245
  end
@@ -7,11 +7,10 @@ module Spacebunny
7
7
  DEFAULT_EXCHANGE_OPTIONS = { passive: true }
8
8
  ACK_TYPES = [:manual, :auto]
9
9
 
10
- attr_reader :built_live_streams, :client
10
+ attr_reader :client
11
11
 
12
12
  def initialize(*args)
13
13
  super(:amqp, *args)
14
- @built_live_streams = {}
15
14
  end
16
15
 
17
16
  def connect
@@ -26,18 +25,13 @@ module Spacebunny
26
25
  # Re-create client every time connect is called
27
26
  @client = Bunny.new(connection_params)
28
27
  @client.start
29
- end
30
-
31
- def channel_from_name(name)
32
- # In @built_channels in fact we have exchanges
33
- with_channel_check name do
34
- @built_exchanges[name]
35
- end
28
+ logger.info 'Connected to SpaceBunny'
36
29
  end
37
30
 
38
31
  def disconnect
39
32
  super
40
- client.stop
33
+ client.stop if client
34
+ logger.info 'Disconnected from SpaceBunny'
41
35
  end
42
36
 
43
37
  # Subscribe for messages coming from Live Stream with name 'name'
@@ -24,13 +24,13 @@ module Spacebunny
24
24
  @secret = options[:secret] || raise(SecretRequired)
25
25
  @api_endpoint = options[:api_endpoint] || {}
26
26
 
27
- extract_custom_connection_configs_from options
28
- set_live_streams options[:live_streams]
29
-
30
27
  @raise_on_error = options[:raise_on_error]
31
28
  @log_to = options[:log_to] || STDOUT
32
- @log_level = options[:log_level] || ::Logger::WARN
29
+ @log_level = options[:log_level] || ::Logger::ERROR
33
30
  @logger = options[:logger] || build_logger
31
+
32
+ extract_custom_connection_configs_from options
33
+ set_live_streams options[:live_streams]
34
34
  end
35
35
 
36
36
  def api_endpoint=(options)
@@ -157,6 +157,7 @@ module Spacebunny
157
157
  @custom_connection_configs[:vhost] = @custom_connection_configs.delete :vhost
158
158
  @custom_connection_configs[:client] = @custom_connection_configs.delete :client
159
159
  @custom_connection_configs[:secret] = @custom_connection_configs.delete :secret
160
+ @custom_connection_configs[:logger] = @custom_connection_configs.delete(:logger) || @logger
160
161
  end
161
162
 
162
163
  # @private
@@ -202,7 +203,7 @@ module Spacebunny
202
203
  when :error, ::Logger::ERROR, 'error' then ::Logger::ERROR
203
204
  when :fatal, ::Logger::FATAL, 'fatal' then ::Logger::FATAL
204
205
  else
205
- Logger::WARN
206
+ Logger::ERROR
206
207
  end
207
208
  end
208
209
  end
@@ -1,3 +1,3 @@
1
1
  module Spacebunny
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.2'
3
3
  end
data/spacebunny.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
  spec.required_ruby_version = '>= 1.9.3'
21
21
  spec.add_runtime_dependency 'http', '~> 2.0.3', '>= 1.0.4'
22
- spec.add_runtime_dependency 'bunny', '~> 2.6.0', '>= 2.3.0'
22
+ spec.add_runtime_dependency 'bunny', '~> 2.6.4', '>= 2.3.0'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.10'
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spacebunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Verlato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-18 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -36,7 +36,7 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 2.6.0
39
+ version: 2.6.4
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: 2.3.0
@@ -46,7 +46,7 @@ dependencies:
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 2.6.0
49
+ version: 2.6.4
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 2.3.0