identikey 0.4.1 → 0.4.2

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: 9b821a01338fa8a604aa8ce9f0f21f25ca523acc537abab9a421f8fe19e8ceea
4
- data.tar.gz: 4ada3a01345c85b8e873148b8f35976a91a51507de332f362460e815980ef116
3
+ metadata.gz: 0ee502eb590570b3a09edb58b436ebf72e86cdd22f6891e7f75563978d471ab4
4
+ data.tar.gz: cdd45005c57900fb13fbea2d7b40761b0dfb78a7d70aca8458569c823e6b0075
5
5
  SHA512:
6
- metadata.gz: 90c06de5806ae578c3e9a30d78b9b55b17c90a36d46c8a40ec9a2270eff134a623cd731eab5b569e875024177869ce4f817cda2307876423ce888b19c3a79b5b
7
- data.tar.gz: 12394e15ec95e337bdfc8e539eb8ebfc48c93716606bc75945d6fe84493b3ea27a950d0bcdfa241bdacba258a5b41a79096736e1ffcbd9ec1084900660129bd0
6
+ metadata.gz: dc93b984114056589ceba043215c3845f95bf3604085c94b08e19e6f3131d53c083c10a3f3a2b806699d3e44b281b4317af3243cfe007adb947ae4f191c50957
7
+ data.tar.gz: 1bbe9da3e86ca3b108c73db040536b609090038fd36fe799680a9cb24690f1a1e9209d9829413c0f415551bcb26e82fd7527d144a678954e4c7525a28a80f7c0
data/README.md CHANGED
@@ -156,6 +156,34 @@ d.unassign!
156
156
  s.logoff
157
157
  ```
158
158
 
159
+ ## Logging to separate files
160
+
161
+ You can and are encouraged to configure different logging destinations
162
+ for the different API endpoints, as follows:
163
+
164
+ ```ruby
165
+ Identikey::Administration.configure do
166
+ logger Logger.new("log/#{Rails.env}.identikey.admin.log")
167
+ end
168
+
169
+ Identikey::Authentication.configure do
170
+ logger Logger.new("log/#{Rails.env}.identikey.admin.log")
171
+ end
172
+ ```
173
+
174
+ However be aware of a caveat, as Identikey uses Savon that uses HTTPI
175
+ and the latter has a global logger, that Savon sets (and overwrites)
176
+ upon calls to `logger`.
177
+
178
+ In the above scenario, you can use a different logfile for HTTPI:
179
+
180
+ ```ruby
181
+ HTTPI.logger = Logger.new("log/#{Rails.env}.identikey.httpi.log")
182
+ ```
183
+
184
+ However please be aware of side-effects with other components of
185
+ your application.
186
+
159
187
  ## Development
160
188
 
161
189
  After checking out the repo, run `bin/setup` to install dependencies. Then,
@@ -59,10 +59,10 @@ module Identikey
59
59
  stat == 'STAT_SUCCESS'
60
60
  end
61
61
 
62
- def alive?
62
+ def alive?(log: true)
63
63
  return false unless logged_on?
64
64
 
65
- stat, _ = @client.sessionalive session_id: @session_id
65
+ stat, _ = @client.ping session_id: @session_id, log: log
66
66
 
67
67
  stat == 'STAT_SUCCESS'
68
68
  end
@@ -57,6 +57,18 @@ module Identikey
57
57
  parse_response resp, :sessionalive_response
58
58
  end
59
59
 
60
+ # Like sessionalive, but allows to disable logging if the
61
+ # `log:` keyword is set to false.
62
+ #
63
+ def ping(session_id:, log:)
64
+ old_log = client.globals[:log]
65
+ client.globals[:log] = log
66
+
67
+ sessionalive(session_id: session_id)
68
+ ensure
69
+ client.globals[:log] = old_log
70
+ end
71
+
60
72
  def admin_session_query(session_id:)
61
73
  attributes = [ ]
62
74
 
@@ -1,3 +1,3 @@
1
1
  module Identikey
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: identikey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcello Barnaba