trophonius 1.2.6 → 1.2.6.1
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 +37 -0
- 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: 41574e377e8690e833092a9dedd6e7929ae57bdc10d34aa61b76ff89369f8051
|
4
|
+
data.tar.gz: '0096a1ae118fc10514f68005ad6408710ebc37269e7f2a1ba6fab7395e0f48da'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ef4fb3e20cb91540f88e391ffd83acc7f54165b2974d7a9ad62a18ebf35ca867829f9d6d09e7e1bcccbabdf1690f6bb0bfb8e083b4c387f598b6e4b31865a38
|
7
|
+
data.tar.gz: e3f3eab5629b894e7e7a7aebc6dbe1252ed56d2c9a902d0a929f9a513bdc9edad66def8a20dcca697002f107f3016fa6c5151f0d48b838e74e836d2647e2d4f2
|
@@ -77,6 +77,43 @@ module Trophonius
|
|
77
77
|
return parsed['response']['token']
|
78
78
|
end
|
79
79
|
|
80
|
+
##
|
81
|
+
# Disconnects from the FileMaker server
|
82
|
+
#
|
83
|
+
def self.disconnect
|
84
|
+
url =
|
85
|
+
URI(
|
86
|
+
"http#{Trophonius.config.ssl == true ? 's' : ''}://#{Trophonius.config.host}/fmi/data/v1/databases/#{Trophonius.config.database}/sessions/#{
|
87
|
+
Trophonius.config.redis_connection ? Trophonius::RedisManager.get_key(key: 'token') : @token
|
88
|
+
}"
|
89
|
+
)
|
90
|
+
puts url
|
91
|
+
ssl_verifyhost = Trophonius.config.local_network ? 0 : 2
|
92
|
+
ssl_verifypeer = !Trophonius.config.local_network
|
93
|
+
|
94
|
+
request =
|
95
|
+
Typhoeus::Request.new(
|
96
|
+
url,
|
97
|
+
method: :delete,
|
98
|
+
params: {},
|
99
|
+
ssl_verifyhost: ssl_verifyhost,
|
100
|
+
ssl_verifypeer: ssl_verifypeer,
|
101
|
+
headers: { 'Content-Type' => 'application/json' }
|
102
|
+
)
|
103
|
+
temp = request.run
|
104
|
+
|
105
|
+
begin
|
106
|
+
parsed = JSON.parse(temp.response_body)
|
107
|
+
rescue Exception => e
|
108
|
+
Error.throw_error('1631')
|
109
|
+
end
|
110
|
+
Error.throw_error(parsed['messages'][0]['code']) if parsed['messages'][0]['code'] != '0'
|
111
|
+
Trophonius::RedisManager.disconnect! if Trophonius.config.redis_connection
|
112
|
+
@token = nil
|
113
|
+
@last_connection = nil
|
114
|
+
return true
|
115
|
+
end
|
116
|
+
|
80
117
|
##
|
81
118
|
# Returns the last received token
|
82
119
|
# @return [String] the last valid *token* used to connect with the FileMaker data api
|