translator-text 0.3.0 → 0.3.2

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: 8632db69acab569b667be95a710ddfb4063475a820160008248099d36d0b42fc
4
- data.tar.gz: d0bc41f634efd36ed604f439036188e70f3a1952d79952f650449a448c0cb535
3
+ metadata.gz: 54c058e4acf692c426853d07ee76ad66247935f317255c23d92bcb071b037a2e
4
+ data.tar.gz: 91a337fa2068cc29c7d547a544b2060f327787748a3711d186f9deba142cd7a2
5
5
  SHA512:
6
- metadata.gz: 2286a74057def86c7fae4ed2f6e8e9b4ebb15e3d23a38a6dbf74533ac6e079fc023764270cb8f3930e2803d8d17e4b9505a7396d3c02ac78c6a843f2241e759b
7
- data.tar.gz: 5edd026d712c585b93e170644424f73da279c1dad6314250a99a153a4fcca9d1ea2c7216c02bed6f068d7c6864400c4ad164035586d46ad47d79efd4682259e0
6
+ metadata.gz: 87723ed79f936925c4c802e4a9e7d95f60386ec641fd625f7f0d1846a77623c9494646362aa7db575aa66155ce9582f8b733b720c51277d2cfff9a741e1e58c7
7
+ data.tar.gz: 975b6e4ee1a8a7c005ff791cb44d7959aaa8db4defa7a6aceaa550ef28aae1b72643a1dde255b55f9039c8ae92a495941482032a467700ffa28747bc6ef8b64a
data/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.3.2] - 2025-05-12
8
+ ### Fixes
9
+ - Bump some gems
10
+ - Remove warning
11
+
12
+ ## [0.3.1] - 2024-03-05
13
+ ### Fixes
14
+ - Better support of errors
15
+
7
16
  ## [0.3.0] - 2023-11-15
8
17
  ### Changed
9
18
  - Add support of the COGNITIVE_SUBSCRIPTION_REGION
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source 'https://rubygems.org'
6
6
 
7
7
  group :test, :development do
8
8
  gem 'dotenv'
9
- gem 'rake', '~> 12'
9
+ gem 'rake', '~> 13'
10
10
  gem 'rspec', '~> 3'
11
11
  gem 'rubocop'
12
12
  gem 'rubocop-rspec'
data/Gemfile.lock CHANGED
@@ -1,115 +1,124 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- translator-text (0.3.0)
4
+ translator-text (0.3.2)
5
5
  dry-struct (~> 1)
6
6
  httparty (~> 0.21)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.8.5)
12
- public_suffix (>= 2.0.2, < 6.0)
13
- ast (2.4.2)
14
- concurrent-ruby (1.2.2)
15
- crack (0.4.5)
11
+ addressable (2.8.7)
12
+ public_suffix (>= 2.0.2, < 7.0)
13
+ ast (2.4.3)
14
+ bigdecimal (3.1.9)
15
+ concurrent-ruby (1.3.5)
16
+ crack (1.0.0)
17
+ bigdecimal
16
18
  rexml
17
- diff-lcs (1.5.0)
18
- docile (1.4.0)
19
- dotenv (2.8.1)
20
- dry-core (1.0.1)
19
+ csv (3.3.4)
20
+ diff-lcs (1.6.2)
21
+ docile (1.4.1)
22
+ dotenv (3.1.8)
23
+ dry-core (1.1.0)
21
24
  concurrent-ruby (~> 1.0)
25
+ logger
22
26
  zeitwerk (~> 2.6)
23
- dry-inflector (1.0.0)
24
- dry-logic (1.5.0)
27
+ dry-inflector (1.2.0)
28
+ dry-logic (1.6.0)
29
+ bigdecimal
25
30
  concurrent-ruby (~> 1.0)
26
- dry-core (~> 1.0, < 2)
31
+ dry-core (~> 1.1)
27
32
  zeitwerk (~> 2.6)
28
- dry-struct (1.6.0)
29
- dry-core (~> 1.0, < 2)
30
- dry-types (>= 1.7, < 2)
33
+ dry-struct (1.8.0)
34
+ dry-core (~> 1.1)
35
+ dry-types (~> 1.8, >= 1.8.2)
31
36
  ice_nine (~> 0.11)
32
37
  zeitwerk (~> 2.6)
33
- dry-types (1.7.1)
38
+ dry-types (1.8.2)
39
+ bigdecimal (~> 3.0)
34
40
  concurrent-ruby (~> 1.0)
35
41
  dry-core (~> 1.0)
36
42
  dry-inflector (~> 1.0)
37
43
  dry-logic (~> 1.4)
38
44
  zeitwerk (~> 2.6)
39
- hashdiff (1.0.1)
40
- httparty (0.21.0)
45
+ hashdiff (1.1.2)
46
+ httparty (0.23.1)
47
+ csv
41
48
  mini_mime (>= 1.0.0)
42
49
  multi_xml (>= 0.5.2)
43
50
  ice_nine (0.11.2)
44
- json (2.6.3)
45
- language_server-protocol (3.17.0.3)
51
+ json (2.12.0)
52
+ language_server-protocol (3.17.0.5)
53
+ lint_roller (1.1.0)
54
+ logger (1.7.0)
46
55
  mini_mime (1.1.5)
47
- multi_xml (0.6.0)
48
- parallel (1.23.0)
49
- parser (3.2.2.4)
56
+ multi_xml (0.7.1)
57
+ bigdecimal (~> 3.1)
58
+ parallel (1.27.0)
59
+ parser (3.3.8.0)
50
60
  ast (~> 2.4.1)
51
61
  racc
52
- public_suffix (5.0.3)
53
- racc (1.7.3)
62
+ prism (1.4.0)
63
+ public_suffix (6.0.2)
64
+ racc (1.8.1)
54
65
  rainbow (3.1.1)
55
- rake (12.3.3)
56
- regexp_parser (2.8.2)
57
- rexml (3.2.6)
58
- rspec (3.12.0)
59
- rspec-core (~> 3.12.0)
60
- rspec-expectations (~> 3.12.0)
61
- rspec-mocks (~> 3.12.0)
62
- rspec-core (3.12.2)
63
- rspec-support (~> 3.12.0)
64
- rspec-expectations (3.12.3)
66
+ rake (13.2.1)
67
+ regexp_parser (2.10.0)
68
+ rexml (3.4.1)
69
+ rspec (3.13.0)
70
+ rspec-core (~> 3.13.0)
71
+ rspec-expectations (~> 3.13.0)
72
+ rspec-mocks (~> 3.13.0)
73
+ rspec-core (3.13.3)
74
+ rspec-support (~> 3.13.0)
75
+ rspec-expectations (3.13.4)
65
76
  diff-lcs (>= 1.2.0, < 2.0)
66
- rspec-support (~> 3.12.0)
67
- rspec-mocks (3.12.6)
77
+ rspec-support (~> 3.13.0)
78
+ rspec-mocks (3.13.4)
68
79
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.12.0)
70
- rspec-support (3.12.1)
71
- rubocop (1.57.2)
80
+ rspec-support (~> 3.13.0)
81
+ rspec-support (3.13.3)
82
+ rubocop (1.75.5)
72
83
  json (~> 2.3)
73
- language_server-protocol (>= 3.17.0)
84
+ language_server-protocol (~> 3.17.0.2)
85
+ lint_roller (~> 1.1.0)
74
86
  parallel (~> 1.10)
75
- parser (>= 3.2.2.4)
87
+ parser (>= 3.3.0.2)
76
88
  rainbow (>= 2.2.2, < 4.0)
77
- regexp_parser (>= 1.8, < 3.0)
78
- rexml (>= 3.2.5, < 4.0)
79
- rubocop-ast (>= 1.28.1, < 2.0)
89
+ regexp_parser (>= 2.9.3, < 3.0)
90
+ rubocop-ast (>= 1.44.0, < 2.0)
80
91
  ruby-progressbar (~> 1.7)
81
- unicode-display_width (>= 2.4.0, < 3.0)
82
- rubocop-ast (1.30.0)
83
- parser (>= 3.2.1.0)
84
- rubocop-capybara (2.19.0)
85
- rubocop (~> 1.41)
86
- rubocop-factory_bot (2.24.0)
87
- rubocop (~> 1.33)
88
- rubocop-rspec (2.25.0)
89
- rubocop (~> 1.40)
90
- rubocop-capybara (~> 2.17)
91
- rubocop-factory_bot (~> 2.22)
92
+ unicode-display_width (>= 2.4.0, < 4.0)
93
+ rubocop-ast (1.44.1)
94
+ parser (>= 3.3.7.2)
95
+ prism (~> 1.4)
96
+ rubocop-rspec (3.6.0)
97
+ lint_roller (~> 1.1)
98
+ rubocop (~> 1.72, >= 1.72.1)
92
99
  ruby-progressbar (1.13.0)
93
100
  simplecov (0.22.0)
94
101
  docile (~> 1.1)
95
102
  simplecov-html (~> 0.11)
96
103
  simplecov_json_formatter (~> 0.1)
97
- simplecov-html (0.12.3)
104
+ simplecov-html (0.13.1)
98
105
  simplecov_json_formatter (0.1.4)
99
- unicode-display_width (2.5.0)
100
- webmock (3.19.1)
106
+ unicode-display_width (3.1.4)
107
+ unicode-emoji (~> 4.0, >= 4.0.4)
108
+ unicode-emoji (4.0.4)
109
+ webmock (3.25.1)
101
110
  addressable (>= 2.8.0)
102
111
  crack (>= 0.3.2)
103
112
  hashdiff (>= 0.4.0, < 2.0.0)
104
- yard (0.9.34)
105
- zeitwerk (2.6.12)
113
+ yard (0.9.37)
114
+ zeitwerk (2.6.18)
106
115
 
107
116
  PLATFORMS
108
117
  ruby
109
118
 
110
119
  DEPENDENCIES
111
120
  dotenv
112
- rake (~> 12)
121
+ rake (~> 13)
113
122
  rspec (~> 3)
114
123
  rubocop
115
124
  rubocop-rspec
@@ -119,4 +128,4 @@ DEPENDENCIES
119
128
  yard
120
129
 
121
130
  BUNDLED WITH
122
- 2.3.26
131
+ 2.3.27
@@ -93,22 +93,19 @@ module TranslatorText
93
93
  # If success, return the response body
94
94
  # If failure, raise an error
95
95
  def handle_response(response)
96
- case response.code
97
- when 200..299
98
- response
99
- else
100
- if response.request.format == :json
101
- raise ServiceError.new(
102
- code: response['error']['code'],
103
- message: response['error']['message']
104
- )
105
- else
106
- raise NetError.new(
107
- code: response.code,
108
- message: response.response.message
109
- )
110
- end
96
+ return response if response.code.between?(200, 299)
97
+
98
+ if response.request.format == :json && response['error']
99
+ raise ServiceError.new(
100
+ code: response['error']['code'],
101
+ message: response['error']['message']
102
+ )
111
103
  end
104
+
105
+ raise NetError.new(
106
+ code: response.code,
107
+ message: response.response.message
108
+ )
112
109
  end
113
110
 
114
111
  def headers
@@ -8,7 +8,7 @@ module TranslatorText
8
8
  transform_keys(&:to_sym)
9
9
 
10
10
  attribute :translations, Types::Array.of(Translation)
11
- attribute :detectedLanguage, Types::Hash.default({})
11
+ attribute :detectedLanguage, Types::Hash.default({}.freeze)
12
12
 
13
13
  # Returns the detected language
14
14
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TranslatorText
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translator-text
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aymeric Brisse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-15 00:00:00.000000000 Z
11
+ date: 2025-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubygems_version: 3.3.26
93
+ rubygems_version: 3.3.27
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: API Wrapper for the Microsoft Translator Text API