session-validator-client 5.0.0 → 5.1.0

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: a206e0adf952028b92ef9dfd135e28626d61402c2942add8b521f8d94e0c1eec
4
- data.tar.gz: 18fbc5416268a787dd2000ca95bf605b55eba2d01f898ab292d9897174925559
3
+ metadata.gz: d091acd762f22b286f6c92cde9e72642b8ff3919cbbc0df99e48a159c111d65a
4
+ data.tar.gz: af944e85aa7a0199f1ec0d115582046826f838124e04440e4106550512cde3c3
5
5
  SHA512:
6
- metadata.gz: ceda35bc867c38756d51e176e96600829b882d35b4c03d755525c80951a7f0542648176f54bc281bdd60d938e98964341bea4bba06b344752d49a724ecfc0be2
7
- data.tar.gz: 60e1aa9356e487bf487508901f4fd926606239f6de7b9288aa990099f6560ea04f26b97ad73b9f3790b12c847d25fe562aadb501e4de062c5ea4a7f0a89d7674
6
+ metadata.gz: 2bb739c2ae71f993ed3e7ed6a1309b8be0e25163afd858d09960071ba737e9ea380e2ab720ae7cd5993cc37307497f9311c8291761226dcc9ce46940300df310
7
+ data.tar.gz: 44cfd9d65bd547f96895971d5f796568a30a3e42115eb457a0a28b18e8ba717d573601bee8fa85428e85ad45c08b61d42758820bf771038b1149e17ec883c320
@@ -15,6 +15,10 @@ class SessionValidator::Client
15
15
  SERVICE_REQUEST_TIMEOUT = 2.freeze
16
16
  NETWORK_ERRORS = Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Faraday::ConnectionFailed] - ['Timeout::Error']
17
17
 
18
+ def initialize(use_escher: true)
19
+ @use_escher = use_escher
20
+ end
21
+
18
22
  def valid?(msid)
19
23
  response_status = client.get("/sessions/#{msid}", nil, headers).status
20
24
  (200..299).include?(response_status) || (500..599).include?(response_status)
@@ -23,7 +27,7 @@ class SessionValidator::Client
23
27
  end
24
28
 
25
29
  def filter_invalid(msids)
26
- response = client.post("/sessions/filter", JSON.generate({msids: msids}), headers)
30
+ response = client.post("/sessions/filter", JSON.generate({ msids: msids }), headers)
27
31
  if response.status == 200
28
32
  JSON.parse(response.body)
29
33
  else
@@ -40,7 +44,7 @@ class SessionValidator::Client
40
44
  faraday.options[:open_timeout] = SERVICE_REQUEST_TIMEOUT
41
45
  faraday.options[:timeout] = SERVICE_REQUEST_TIMEOUT
42
46
  faraday.request :retry, interval: 0.05, interval_randomness: 0.5, backoff_factor: 2, methods: [:get, :post], exceptions: NETWORK_ERRORS
43
- faraday.use Faraday::Middleware::Escher::RequestSigner, escher_config
47
+ faraday.use(Faraday::Middleware::Escher::RequestSigner, escher_config) if @use_escher
44
48
  faraday.adapter Faraday.default_adapter
45
49
  end
46
50
  end
@@ -67,6 +71,6 @@ class SessionValidator::Client
67
71
  end
68
72
 
69
73
  def headers
70
- {"content-type" => "application/json"}
74
+ { "content-type" => "application/json" }
71
75
  end
72
76
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "session-validator-client"
3
- s.version = "5.0.0"
3
+ s.version = "5.1.0"
4
4
  s.summary = "Ruby client for Emarsys session validator service"
5
5
  s.authors = ["Emarsys Technologies Ltd."]
6
6
  s.email = "security@emarsys.com"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: session-validator-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emarsys Technologies Ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-02 00:00:00.000000000 Z
11
+ date: 2024-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: escher-keypool