maybe_client 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maybe_client.rb +18 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 322dec0c5f29b32e79aae0f32f3d53f22941b4c3
|
4
|
+
data.tar.gz: 0946620bb2466168f7bfc62a7c2663a17cf129c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f829e82ca56184a3635396de562bea00499e738aadae3157c2992804fd14ba3922084900010e01aee40a3e7f0cba65e25239a847556277d898b0da3bffcae7a9
|
7
|
+
data.tar.gz: 3b0a83ca555f38623bd96736529e67e924cd67979c3b21a2dd666faded3970acc5c7d23768933ade376e2a06f2e6fa21bd535c113ecb2e6e5a0d92e222eb2ab6
|
data/lib/maybe_client.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
class MaybeClient
|
2
2
|
DELAY = 60
|
3
3
|
|
4
|
-
def
|
4
|
+
def self.from_value(client)
|
5
|
+
new(client)
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(client: nil, client_class: nil, connect_params: nil)
|
9
|
+
raise ArgumentError.new('Either client or client_class has to be supplied') \
|
10
|
+
if !client && !client_class
|
11
|
+
|
12
|
+
@client = client
|
5
13
|
@connect_params = connect_params
|
6
14
|
@client_class = client_class
|
7
15
|
|
8
|
-
initialize_client
|
16
|
+
initialize_client unless @client
|
9
17
|
end
|
10
18
|
|
11
19
|
def respond_to? method
|
@@ -40,6 +48,14 @@ class MaybeClient
|
|
40
48
|
|
41
49
|
def handle_exception(e)
|
42
50
|
@fail_at = Time.now
|
51
|
+
return unless defined? Rails
|
52
|
+
|
53
|
+
# TODO: Ehem, could be done better, improve in the future
|
54
|
+
Rails.logger.error(
|
55
|
+
short_message: e.message,
|
56
|
+
env: Rails.env,
|
57
|
+
backtrace: e.backtrace.first(3)
|
58
|
+
)
|
43
59
|
end
|
44
60
|
|
45
61
|
def initialize_client
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maybe_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Renra Gloser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|