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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3938dd85580ae34b5085bbb05c1e20adc506522cde540f3edb8af4a1b902e5cb
4
- data.tar.gz: e9e0520cd32790cf07fb90c074e90ef087403481f67e950559b579b800bf7526
3
+ metadata.gz: 04e90580a6f6b8261e1f174ece304d0525262cd7e22605193836c91b4cb5ec6b
4
+ data.tar.gz: 7ec63bfeb0127b6523b5df68d2633660a228f286bfdca8dd410afb252b530c11
5
5
  SHA512:
6
- metadata.gz: 42bae32f929cc8d8ff095147c54c836db4a8b2429b4166297529cde2dbf14dff68802a725f214284587ea84aef4c391b5ba579fbe49539184fbe419d960725bd
7
- data.tar.gz: 3b04dcc00d655b555c65e4b96a1326a1da3c9f26ef711cff5fa95fda1d3e0c3aa5c69c3714d55dff0d65f78ffd9d2db88d11c71057c244693eac88373ed8634f
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 ENV['REDIS_URL'] && ENV['REDIS_URL'] != ''
6
- @redis ||= Redis.new(url: ENV['REDIS_URL'])
7
- else
8
- @redis ||= Redis.new
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trophonius
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4.2
4
+ version: 1.2.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kempen Automatisering