symgate 0.4.0 → 0.4.1

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: 23804f86b9de8e1bab9c0384217f0e5f5a3a853d01ddf26acb07d1377bb3c8ba
4
- data.tar.gz: 8cb335b86699f2bcf0c32cad06354a1e48aa12a3cfe80a745a369d3e366cc046
3
+ metadata.gz: efc49ad2189b8c02639f72b0332ddcebf27ca7485616a29e89e9e2656ab7f543
4
+ data.tar.gz: 1eef068e585c5fbc94ee1c7818003a4f94b2381a4d67f85ab3711b4332620449
5
5
  SHA512:
6
- metadata.gz: ad8da67d0ea94083948a155660f3904c31b19546c243bad8bf3debf64df813ced13f8951bf8c9e7b1310a73ac276ef3fde3f69b4830c78bd99a9931a08b94359
7
- data.tar.gz: 8c5da32f7c9105d5d5fa4922dd97c866702d460f43fe97b7446b288fb4d4d76b726fbe57fc3524a03f26dd4e8184dd65e2c6ae46127857a942235b688d8ffd33
6
+ metadata.gz: e8b6e1c64b6b74e7e46a6c6064686eeaa9084fd8bf12d5cca0bf11d4742495376bf01fd326e9c143a50f35f3dcf4f507d88443a9cae62acbceaf59139e0493cb
7
+ data.tar.gz: '058bbc6730fc610343a5242decf25a0e5f69c66df8be15247cf63597b161d68bcfeff3eebfcc79a45b4ecb597c8ab3e1b2cff99c3f69a7cfb1f8bc03c3b41fac'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.5
1
+ 3.0.2
data/.travis.yml CHANGED
@@ -3,12 +3,13 @@ rvm:
3
3
  - 2.1.10
4
4
  - 2.2.5
5
5
  - 2.3.1
6
+ - 3.0.2
6
7
 
7
8
  git:
8
9
  submodules: false
9
10
 
10
11
  before_install:
11
- - gem install bundler -v '< 2'
12
+ - gem install bundler
12
13
 
13
14
  script:
14
15
  - bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.4.1 (2021-09-06)
2
+
3
+ Allow a configurable number of retries for a 'Data required for operation' error
4
+
5
+ ## 0.4.0 (2019-12-13)
6
+
7
+ Add support for copy-on-write wordlists for symboliser builds that support this
8
+
9
+ ## 0.3.0 (2019-07-19)
10
+
11
+ Add support for read-only wordlists
12
+
1
13
  ## 0.2.4 (2018-10-25)
2
14
 
3
15
  Make attachments option in get_wordlist_entries truly optional and update integration tests to
data/README.md CHANGED
@@ -94,8 +94,9 @@ You can also initialise a client with the following options:
94
94
 
95
95
  | Option | |
96
96
  | ----------- | --- |
97
- | :endpoint | Specifies the symbolisation SOAP endpoint to use, if not the public symbolisation server. |
98
- | :savon_opts | Specifies options to pass to the underlying savon engine. e.g. `{ log_level: :debug }` |
97
+ | :endpoint | Specifies the symbolisation SOAP endpoint to use, if not the public symbolisation server. |
98
+ | :savon_opts | Specifies options to pass to the underlying savon engine. e.g. `{ log_level: :debug }` |
99
+ | :data_required_error_retries | Specifies the number of times to attempt a request when the response is 'Data required for operation'. |
99
100
 
100
101
  ### Errors
101
102
 
@@ -6,7 +6,8 @@ module Symgate
6
6
  # A generic client for the Symgate API.
7
7
  # See the WSDL for full documentation
8
8
  class Client
9
- attr_accessor :wsdl, :endpoint, :user, :password, :token, :account, :key, :savon_opts
9
+ attr_accessor :wsdl, :endpoint, :user, :password, :token, :account, :key, :savon_opts,
10
+ :data_required_error_retries
10
11
  attr_reader :savon_client
11
12
 
12
13
  # Constructs a new client with the provided options
@@ -14,6 +15,7 @@ module Symgate
14
15
  @wsdl = 'https://ws.widgitonline.com/schema/symboliser.wsdl'
15
16
  @endpoint = 'https://ws.widgitonline.com/'
16
17
  @savon_opts = {}
18
+ @data_required_error_retries = 3
17
19
  opts.each { |k, v| instance_variable_set("@#{k}", v) }
18
20
 
19
21
  validate_client_options
@@ -83,16 +85,30 @@ module Symgate
83
85
  # sends a request to the server and yields a soap block for defining the
84
86
  # message body
85
87
  def savon_request(method, opts = {})
86
- r = @savon_client.call(method) do |soap|
87
- yield soap if block_given?
88
- soap.message({}) if soap[:message].nil?
89
- soap[:message].merge!(savon_creds)
90
- end
88
+ attempts = 0
89
+
90
+ begin
91
+ attempts += 1
92
+
93
+ r = @savon_client.call(method) do |soap|
94
+ yield soap if block_given?
95
+ soap.message({}) if soap[:message].nil?
96
+ soap[:message].merge!(savon_creds)
97
+ end
91
98
 
92
- raise_error_on_string_response(r, "#{method}_response".to_sym) if opts[:returns_error_string]
93
- r
94
- rescue Savon::SOAPFault => e
95
- raise Symgate::Error.from_savon(e)
99
+ raise_error_on_string_response(r, "#{method}_response".to_sym) if opts[:returns_error_string]
100
+
101
+ r
102
+ rescue Savon::SOAPFault => e
103
+ # Allow a configurable number of retries for a 'Data required for operation' error. This is because the
104
+ # symboliser occasionally throw this error when it shouldn't and succeeds on retry. It's not ideal that we have
105
+ # to rely on the fault string, however.
106
+ if attempts < @data_required_error_retries && e.to_hash[:fault][:faultstring] == 'Data required for operation'
107
+ retry
108
+ end
109
+
110
+ raise Symgate::Error.from_savon(e)
111
+ end
96
112
  end
97
113
 
98
114
  def raise_error_on_string_response(response, response_type)
data/lib/symgate/error.rb CHANGED
@@ -5,7 +5,7 @@ module Symgate
5
5
  class Error < StandardError
6
6
  attr_reader :original_error, :detail
7
7
 
8
- # Initialises a symgate error from either a string or a savon error
8
+ # Initialises a symgate error from either a string or a Savon error
9
9
  def initialize(message)
10
10
  super(message)
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module Symgate
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.4.1'.freeze
3
3
  end
data/symgate-gem.gemspec CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Simon Detheridge', 'Tim Down', 'Stu Wright']
9
9
  spec.email = ['tim@widgit.com']
10
10
  spec.license = 'Apache-2.0'
11
+ spec.required_ruby_version = '>= 2.1'
11
12
 
12
13
  spec.summary = "Wrapper around Widgit's Symgate SOAP symboliser"
13
14
  spec.homepage = 'https://github.com/symbols-worldwide/symgate-gem'
@@ -18,10 +19,10 @@ Gem::Specification.new do |spec|
18
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
20
  spec.require_paths = ['lib']
20
21
 
21
- spec.add_development_dependency 'bundler', '~> 1.9'
22
+ spec.add_development_dependency 'bundler', '~> 2.2'
22
23
  spec.add_development_dependency 'codecov', '~> 0.1.16'
23
24
  spec.add_development_dependency 'mysql2', '~> 0.5.3'
24
- spec.add_development_dependency 'rack', '~> 1.6.11'
25
+ spec.add_development_dependency 'rack', '~> 2.2'
25
26
  spec.add_development_dependency 'rake', '~> 12.0'
26
27
  spec.add_development_dependency 'rspec', '~> 3.9.0'
27
28
  spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symgate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Detheridge
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-12-13 00:00:00.000000000 Z
13
+ date: 2021-09-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '1.9'
21
+ version: '2.2'
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '1.9'
28
+ version: '2.2'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: codecov
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -60,14 +60,14 @@ dependencies:
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: 1.6.11
63
+ version: '2.2'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: 1.6.11
70
+ version: '2.2'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rake
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -244,14 +244,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
244
  requirements:
245
245
  - - ">="
246
246
  - !ruby/object:Gem::Version
247
- version: '0'
247
+ version: '2.1'
248
248
  required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  requirements:
250
250
  - - ">="
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []
254
- rubygems_version: 3.0.3
254
+ rubygems_version: 3.2.22
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: Wrapper around Widgit's Symgate SOAP symboliser