trophonius 1.2.6 → 1.2.6.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trophonius_connection.rb +37 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e0bf0bec18d8269bd620635ddc8a7c5d2f36536c1952918dfe50da452190048
4
- data.tar.gz: e288914c11ef7049cd0213d500cca929e9f301acf6965e8a52349492e355346b
3
+ metadata.gz: 41574e377e8690e833092a9dedd6e7929ae57bdc10d34aa61b76ff89369f8051
4
+ data.tar.gz: '0096a1ae118fc10514f68005ad6408710ebc37269e7f2a1ba6fab7395e0f48da'
5
5
  SHA512:
6
- metadata.gz: 77a682c6df981386dbf754341f9d0fd003753b64b36912b187954889e0858d4f43e821cfcc6b8c75b7ca40eccd5e5a9d3ec7072a15fe0821bf72a1305047a52a
7
- data.tar.gz: 4540141348a566a973630f7ff395434bc724d0238e1f4eeed84c1006b25da78702e6add235d800055ae962d24af5c949f42b2e5cbd6c5544842b0eee1f6eed47
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
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.6
4
+ version: 1.2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kempen Automatisering