session-validator-client 3.1.1 → 3.2.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: 7a5fbffce84601019f81c281d10264ca718ea083ac84a12aa9ea079f6af56d1c
4
- data.tar.gz: d73b28d840deed00914f2d5316e222967d0c17b791a52c1fccc44ce54964c8cb
3
+ metadata.gz: 6fe7547f62b5b901875ee3b87acd526b11a0876fc1c8c789fac98f8227753934
4
+ data.tar.gz: e1b64ac5c8d1d2c0cc1f4fca1625315b3eb8f9e8e161d6e3155906fac684a631
5
5
  SHA512:
6
- metadata.gz: 962e8d27ef646e4a5201a657937fa468639e1b75dacf5a36a2226a5abb6891799ef2eabd8209daa0a552369bbd470bf95822c0a3f0f9fecd0e8d6c5009ce7b14
7
- data.tar.gz: 85de14cee3adf4f7b07b122023159116d43d91c2e59897273ef47f1ecd6eec3f58d9d33dd31ef4ccc921ed5e9ebee8da9f9c574f7014cc790b8700438b68ff34
6
+ metadata.gz: e5c809d54e76012b9a59680f1c2f4742ff217004041dd682079b167277f82c19f6cef8e26f8b6ae9e23faaae9873d24ebe916cf4714755c6123189daaf079a1b
7
+ data.tar.gz: 24399d914c8bf047854cc3f4223566ec7b0855d322ca44233550e602d5f2b2a52a71a4cbfbb6080ac00263e08063c8212ba7c852380e30058012b23f785b5236
data/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2018 Emarsys
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -13,32 +13,33 @@ class SessionValidator::Client
13
13
  date_header_name: "X-Ems-Date"
14
14
  }.freeze
15
15
  SERVICE_REQUEST_TIMEOUT = 2.freeze
16
+ NETWORK_ERRORS = Faraday::Request::Retry::DEFAULT_EXCEPTIONS + [Faraday::Error::ConnectionFailed] - ['Timeout::Error']
16
17
 
17
18
  def valid?(msid)
18
19
  response_status = client.get("/sessions/#{msid}", nil, headers).status
19
20
  (200..299).include?(response_status) || (500..599).include?(response_status)
20
- rescue Faraday::TimeoutError
21
+ rescue *NETWORK_ERRORS
21
22
  true
22
23
  end
23
24
 
24
25
  def filter_invalid(msids)
25
- response = client.post("/sessions/filter", JSON.generate({msids:msids}), headers)
26
+ response = client.post("/sessions/filter", JSON.generate({msids: msids}), headers)
26
27
  if response.status == 200
27
28
  JSON.parse(response.body)
28
29
  else
29
30
  []
30
31
  end
31
- rescue Faraday::TimeoutError
32
+ rescue *NETWORK_ERRORS
32
33
  []
33
34
  end
34
35
 
35
-
36
36
  private
37
37
 
38
38
  def client
39
39
  Faraday.new(url) do |faraday|
40
40
  faraday.options[:open_timeout] = SERVICE_REQUEST_TIMEOUT
41
41
  faraday.options[:timeout] = SERVICE_REQUEST_TIMEOUT
42
+ faraday.request :retry, interval: 0.05, interval_randomness: 0.5, backoff_factor: 2, methods: [:get, :post], exceptions: NETWORK_ERRORS
42
43
  faraday.use FaradayMiddleware::Escher::RequestSigner, escher_config
43
44
  faraday.adapter Faraday.default_adapter
44
45
  end
@@ -66,6 +67,6 @@ class SessionValidator::Client
66
67
  end
67
68
 
68
69
  def headers
69
- { "content-type" => "application/json" }
70
+ {"content-type" => "application/json"}
70
71
  end
71
72
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "session-validator-client"
3
- s.version = "3.1.1"
3
+ s.version = "3.2.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: 3.1.1
4
+ version: 3.2.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: 2018-04-24 00:00:00.000000000 Z
11
+ date: 2018-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: escher-keypool
@@ -119,6 +119,7 @@ files:
119
119
  - ".rspec"
120
120
  - ".travis.yml"
121
121
  - Gemfile
122
+ - LICENSE.txt
122
123
  - README.md
123
124
  - bin/console
124
125
  - lib/session_validator.rb
@@ -146,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
147
  version: '0'
147
148
  requirements: []
148
149
  rubyforge_project:
149
- rubygems_version: 2.7.6
150
+ rubygems_version: 2.7.7
150
151
  signing_key:
151
152
  specification_version: 4
152
153
  summary: Ruby client for Emarsys session validator service