tinify 1.7.0 → 1.7.1

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: 6947ac2a5fe37cabbd10fcafeb6e762fc15a19c637f6f617b5179b7057ecb2c4
4
- data.tar.gz: 2b8964ae5761665b4400f83008a4a43bf795ce6e0c60e3d8a9f02f11e3505a58
3
+ metadata.gz: af537d83d7cd098489a231282b5e847fa63537aa116d9489897906cccf54d4d3
4
+ data.tar.gz: 017bd7ce4f73aac4d6042481ef126d3a7fed319ba67da35ff6e7671705f50a03
5
5
  SHA512:
6
- metadata.gz: 473ff8623d4142617493e00c2f0d1a2e06ea9342ceccdd07794df8113e378c3b583c1a3a98d4d22d558003ba1c65d7fdc668e592cbd7b2710830185dbbe3914e
7
- data.tar.gz: ee5ef195846f70e996576295c7f06c2403d77ddb8d03984162baf4b8b29622f86f62ef93be1d29943d0f50355ef89cc00b3db70ee63513d5ca7e4cf777ec8316
6
+ metadata.gz: 9bc3ab091b52286e90bd0af83aed1fadc868642fbbfd1297e477f977ab97f8ffa06dd12bd9c8dd2007efcea2d216500e6fe486693cd2ae6220783b80a99f8256
7
+ data.tar.gz: c140345d128d4317d4d653af7008e71972a82b2e30c06aab93f10e6662bacfcb4fdf11bddac60ece01e76eac7b4c53aeed1cef9285968bd083917c93f0764784
@@ -1,3 +1,7 @@
1
+ ## 1.7.1
2
+ * Update `rexml` because of `CVE-2025-58767`.
3
+ * Fix source `:result` to use post when a body is given.
4
+
1
5
  ## 1.7.0
2
6
 
3
7
  * Added base64 gem to Gemfile
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tinify (1.7.0)
4
+ tinify (1.7.1)
5
5
  httpclient (>= 2.9, < 3)
6
6
 
7
7
  GEM
@@ -9,20 +9,20 @@ GEM
9
9
  specs:
10
10
  addressable (2.8.7)
11
11
  public_suffix (>= 2.0.2, < 7.0)
12
- base64 (0.2.0)
13
- bigdecimal (3.1.9)
14
- bigdecimal (3.1.9-java)
12
+ base64 (0.3.0)
13
+ bigdecimal (3.2.3)
14
+ bigdecimal (3.2.3-java)
15
15
  crack (1.0.0)
16
16
  bigdecimal
17
17
  rexml
18
- hashdiff (1.1.2)
18
+ hashdiff (1.2.1)
19
19
  httpclient (2.9.0)
20
20
  mutex_m
21
21
  minitest (5.25.5)
22
22
  mutex_m (0.3.0)
23
- public_suffix (6.0.1)
24
- rake (13.2.1)
25
- rexml (3.4.1)
23
+ public_suffix (6.0.2)
24
+ rake (13.3.0)
25
+ rexml (3.4.4)
26
26
  webmock (3.25.1)
27
27
  addressable (>= 2.8.0)
28
28
  crack (>= 0.3.2)
@@ -44,4 +44,4 @@ DEPENDENCIES
44
44
  webmock
45
45
 
46
46
  BUNDLED WITH
47
- 2.3.19
47
+ 2.3.27
data/lib/tinify/source.rb CHANGED
@@ -43,7 +43,12 @@ module Tinify
43
43
  end
44
44
 
45
45
  def result
46
- response = Tinify.client.request(:get, @url, @commands)
46
+ response = if @commands&.empty?
47
+ Tinify.client.request(:get, @url)
48
+ else
49
+ Tinify.client.request(:post, @url, @commands)
50
+ end
51
+
47
52
  Result.new(response.headers, response.body).freeze
48
53
  end
49
54
 
@@ -1,3 +1,3 @@
1
1
  module Tinify
2
- VERSION = "1.7.0"
2
+ VERSION = "1.7.1"
3
3
  end
@@ -153,8 +153,35 @@ describe Tinify::Source do
153
153
  body: "compressed file")
154
154
  end
155
155
 
156
- it "should return result" do
157
- assert_kind_of Tinify::Result, Tinify::Source.from_buffer("png file").result
156
+ it 'has a `Tinify::Result`' do
157
+ assert_kind_of(Tinify::Result,
158
+ Tinify::Source.from_buffer("png file").result)
159
+ end
160
+
161
+ it 'has result data' do
162
+ assert_equal('compressed file',
163
+ Tinify::Source.from_buffer("png file").result.data)
164
+ end
165
+
166
+ it 'is a :get request' do
167
+ Tinify::Source.from_buffer("png file").result
168
+
169
+ assert_requested(:get, "https://api.tinify.com/some/location",
170
+ times: 1)
171
+ end
172
+
173
+ it 'is a :post request' do
174
+ stub_request(:post, "https://api.tinify.com/some/location")
175
+ .with(basic_auth: ['api', 'valid'],
176
+ body: '{"preserve":["copyright","location"]}')
177
+ .to_return(status: 200, body: "copyrighted file")
178
+
179
+ Tinify::Source.from_buffer("png file")
180
+ .preserve("copyright", "location")
181
+ .result
182
+
183
+ assert_requested(:post, "https://api.tinify.com/some/location",
184
+ times: 1)
158
185
  end
159
186
  end
160
187
 
@@ -167,7 +194,7 @@ describe Tinify::Source do
167
194
  headers: { Location: "https://api.tinify.com/some/location" },
168
195
  body: '{}')
169
196
 
170
- stub_request(:get, "https://api.tinify.com/some/location")
197
+ stub_request(:post, "https://api.tinify.com/some/location")
171
198
  .with(
172
199
  basic_auth: ['api', 'valid'],
173
200
  body: '{"preserve":["copyright","location"]}')
@@ -192,7 +219,7 @@ describe Tinify::Source do
192
219
  end
193
220
 
194
221
  it "should include other options if set" do
195
- stub_request(:get, "https://api.tinify.com/some/location")
222
+ stub_request(:post, "https://api.tinify.com/some/location")
196
223
  .with(
197
224
  basic_auth: ['api', 'valid'],
198
225
  body: '{"resize":{"width":400},"preserve":["copyright","location"]}')
@@ -214,7 +241,7 @@ describe Tinify::Source do
214
241
  headers: { Location: "https://api.tinify.com/some/location" },
215
242
  body: '{}')
216
243
 
217
- stub_request(:get, "https://api.tinify.com/some/location")
244
+ stub_request(:post, "https://api.tinify.com/some/location")
218
245
  .with(
219
246
  basic_auth: ['api', 'valid'],
220
247
  body: '{"resize":{"width":400}}')
@@ -241,7 +268,7 @@ describe Tinify::Source do
241
268
  headers: { Location: "https://api.tinify.com/some/location" },
242
269
  body: '{}')
243
270
 
244
- stub_request(:get, "https://api.tinify.com/some/location")
271
+ stub_request(:post, "https://api.tinify.com/some/location")
245
272
  .with(
246
273
  basic_auth: ['api', 'valid'],
247
274
  body: '{"convert":{"type":["image/webp"]}}')
@@ -268,7 +295,7 @@ describe Tinify::Source do
268
295
  headers: { Location: "https://api.tinify.com/some/location" },
269
296
  body: '{}')
270
297
 
271
- stub_request(:get, "https://api.tinify.com/some/location")
298
+ stub_request(:post, "https://api.tinify.com/some/location")
272
299
  .with(
273
300
  basic_auth: ['api', 'valid'],
274
301
  body: '{"transform":{"color":"black"}}')
@@ -286,11 +313,9 @@ describe Tinify::Source do
286
313
  end
287
314
 
288
315
  it "should include other options if set" do
289
-
290
- stub_request(:get, "https://api.tinify.com/some/location").
291
- with(:body => '{"convert":{"type":["image/webp"]},"transform":{"color":"black"}}',
292
- ).
293
- to_return(:status => 200, :body => "trans-formed-and-coded", :headers => {})
316
+ stub_request(:post, "https://api.tinify.com/some/location")
317
+ .with(:body => '{"convert":{"type":["image/webp"]},"transform":{"color":"black"}}')
318
+ .to_return(:status => 200, :body => "trans-formed-and-coded", :headers => {})
294
319
 
295
320
  result = Tinify::Source.from_buffer("png file").convert(type: ["image/webp"]).transform(color: "black")
296
321
  assert_equal "trans-formed-and-coded", result.to_buffer
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rolf Timmermans
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: httpclient
@@ -39,7 +39,7 @@ extra_rdoc_files: []
39
39
  files:
40
40
  - ".github/workflows/ci-cd.yaml"
41
41
  - ".gitignore"
42
- - CHANGES.md
42
+ - CHANGELOG.md
43
43
  - Gemfile
44
44
  - Gemfile.lock
45
45
  - LICENSE
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 3.6.2
85
+ rubygems_version: 3.6.9
86
86
  specification_version: 4
87
87
  summary: Ruby client for the Tinify API.
88
88
  test_files: