web_translate_it 2.8.2 → 2.8.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90f545288c55ba7994137a77fe9c33a1f5ad9a0a9ef0e7e1fb55adabef34db04
4
- data.tar.gz: 276e1a44adfb1dead4c72f7d3f66c520a2e75e64621b378756ca9e05f4924a91
3
+ metadata.gz: a1667be9e5fab89fe2ab18228ab94666225ebd108a6c234bed49c2df9fe5ae31
4
+ data.tar.gz: 6163b2dc6e981cde12a4a64d2e28f9220d9e2983818dc70d922d60c56993f1f0
5
5
  SHA512:
6
- metadata.gz: 2cfc4cd709ec351d3581c896b5657144b94859519bb14a6d61f4873f11db880d199af20dcb733c460a90fe33456a57878ffa040c221f0e44735b15c143b92630
7
- data.tar.gz: 2aea23da596406f7536d4b1c9e62005a1891fffd3ff89a5010a79efde5aee38adc84b3c0c38b203cc8d78aaa1c763c87c1f9779dc48a1b1417fe275fd8e2e6df
6
+ metadata.gz: 24a36fbb86cca9fb0abfb2f9c7936a3ef023975ab714080a561966d340b4e9b6f7d27850cf9dacd1bc23ede523d16a8133781f0901e3a325c2ca51f891b943b8
7
+ data.tar.gz: 191cc4fa792d0026d30a1366f85ecf7ad047dbdcba17e16ed83b4e6c68651883c420fc4870f20e189505b26c253cc94cc524233054cd8865b0435d66c041c97a
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 2.8.3 / 2023-04-19
2
+
3
+ * Fix `wti addlocale` and `wti rmlocale` commands. #253
4
+
1
5
  ## Version 2.8.2 / 2023-04-18
2
6
 
3
7
  * Fix crash caused by use of API from older Multipart versions. #246 (@rogerluan)
@@ -2,11 +2,9 @@ module WebTranslateIt
2
2
 
3
3
  class Connection
4
4
 
5
- attr_reader :api_key, :http_connection
6
-
7
- @api_key = nil
8
- @http_connection = nil
9
- @debug = false
5
+ @@api_key = nil
6
+ @@http_connection = nil
7
+ @@debug = false
10
8
 
11
9
  #
12
10
  # Initialize and yield a HTTPS Keep-Alive connection to WebTranslateIt.com
@@ -23,33 +21,41 @@ module WebTranslateIt
23
21
  # http_connection.request(request)
24
22
  # end
25
23
  #
26
- def initialize(api_key) # rubocop:todo Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
27
- @api_key = api_key
24
+ def initialize(api_key) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
25
+ @@api_key = api_key
28
26
  proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : Struct.new(:host, :port, :user, :password).new
29
27
  http = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password).new('webtranslateit.com', 443)
30
28
  http.use_ssl = true
31
29
  http.open_timeout = http.read_timeout = 60
32
- http.set_debug_output($stderr) if @debug
30
+ http.set_debug_output($stderr) if @@debug
33
31
  begin
34
32
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
35
- @http_connection = http.start
36
- yield @http_connection if block_given?
33
+ @@http_connection = http.start
34
+ yield @@http_connection if block_given?
37
35
  rescue OpenSSL::SSL::SSLError
38
- puts 'Unable to verify SSL certificate.' unless @silent
36
+ puts 'Unable to verify SSL certificate.'
39
37
  http = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password).new('webtranslateit.com', 443)
40
- http.set_debug_output($stderr) if @debug
38
+ http.set_debug_output($stderr) if @@debug
41
39
  http.use_ssl = true
42
40
  http.open_timeout = http.read_timeout = 60
43
41
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
44
- @http_connection = http.start
45
- yield @http_connection if block_given?
42
+ @@http_connection = http.start
43
+ yield @@http_connection if block_given?
46
44
  rescue StandardError
47
45
  puts $ERROR_INFO
48
46
  end
49
47
  end
50
48
 
51
49
  def self.turn_debug_on
52
- @debug = true
50
+ @@debug = true
51
+ end
52
+
53
+ def self.api_key
54
+ @@api_key
55
+ end
56
+
57
+ def self.http_connection
58
+ @@http_connection
53
59
  end
54
60
 
55
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.2
4
+ version: 2.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Briere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-18 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json