trophonius 1.2.4.2 → 1.2.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trophonius_connection.rb +3 -4
- data/lib/trophonius_redis_manager.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04e90580a6f6b8261e1f174ece304d0525262cd7e22605193836c91b4cb5ec6b
|
4
|
+
data.tar.gz: 7ec63bfeb0127b6523b5df68d2633660a228f286bfdca8dd410afb252b530c11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0473fd285c85aa00443299b961a80324232dfe0303ea037e22fe221b34d930fa8947752a49571830ac41e097dcc45700ba3cb84e77440394c3d68016d312e826
|
7
|
+
data.tar.gz: b35054768da222d37ec7825e3d5c4a64bf21c9ff201f77174d6560bdfea2bb6c4a42c3c76d4298ac0bf1e161293593049a9e5dee429aea06ad505d2fc1a3f182
|
@@ -70,18 +70,17 @@ module Trophonius
|
|
70
70
|
|
71
71
|
begin
|
72
72
|
parsed = JSON.parse(temp.response_body)
|
73
|
-
Error.throw_error(response['messages'][0]['code']) if parsed['messages'][0]['code'] != '0'
|
74
|
-
return parsed['response']['token']
|
75
73
|
rescue Exception => e
|
76
74
|
Error.throw_error('1631')
|
77
75
|
end
|
76
|
+
Error.throw_error(parsed['messages'][0]['code']) if parsed['messages'][0]['code'] != '0'
|
77
|
+
return parsed['response']['token']
|
78
78
|
end
|
79
79
|
|
80
80
|
##
|
81
81
|
# Returns the last received token
|
82
82
|
# @return [String] the last valid *token* used to connect with the FileMaker data api
|
83
83
|
def self.token
|
84
|
-
token = Trophonius::RedisManager.get_key(key: 'token')
|
85
84
|
return Trophonius.config.redis_connection ? Trophonius::RedisManager.get_key(key: 'token') : @token
|
86
85
|
end
|
87
86
|
|
@@ -89,7 +88,7 @@ module Trophonius
|
|
89
88
|
# Returns the receive time of the last received token
|
90
89
|
# @return [Time] Returns the receive time of the last received token
|
91
90
|
def self.last_connection
|
92
|
-
last = Trophonius::RedisManager.get_key(key: 'last_connection')
|
91
|
+
last = Trophonius.config.redis_connection ? Trophonius::RedisManager.get_key(key: 'last_connection') : nil
|
93
92
|
last = last.nil? ? nil : Time.parse(last)
|
94
93
|
Trophonius.config.redis_connection ? last : @last_connection
|
95
94
|
end
|
@@ -2,10 +2,12 @@ module Trophonius
|
|
2
2
|
# the RedisManager module is used to create a (single) connection to a redis store.
|
3
3
|
module Trophonius::RedisManager
|
4
4
|
def self.connect
|
5
|
-
if
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
if Trophonius.config.redis_connection
|
6
|
+
if ENV['REDIS_URL'] && ENV['REDIS_URL'] != ''
|
7
|
+
@redis ||= Redis.new(url: ENV['REDIS_URL'])
|
8
|
+
else
|
9
|
+
@redis ||= Redis.new
|
10
|
+
end
|
9
11
|
end
|
10
12
|
return nil
|
11
13
|
end
|