imgix 3.3.1 → 3.4.0
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 +4 -4
- data/.github/pull_request_template.md +1 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -0
- data/README.md +2 -0
- data/Rakefile +2 -0
- data/imgix.gemspec +3 -4
- data/lib/imgix/client.rb +7 -2
- data/lib/imgix/path.rb +2 -2
- data/lib/imgix/version.rb +1 -1
- data/test/test_helper.rb +0 -1
- data/test/units/purge_test.rb +62 -17
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8de76cc2340cbfa3ecd0479b9bb421fa163f78c1e8e38011dd5938849665802
|
4
|
+
data.tar.gz: 10cac9471323181870d48be911b225323ccb2d02583176f45639af5c19d4eddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2233648d430a37c9ea72d89420f492c50f28f6e341c3cf7fe70eb711983b6a7b12b0cd103b118cd8783c373cb2b27e62d53a8ae6b2f8e93946d0309d7f812e2
|
7
|
+
data.tar.gz: 85209a1262a7d3fd7a39796c487fe87e6c0f75a5a55213676d91834a1af456d8ff01ecb9882ff38818a9dc24c638a64f5c6171bcc09b4f415f9bc38bfb0a136c
|
@@ -27,7 +27,7 @@ Please use the checklist that is most closely related to your PR, and delete the
|
|
27
27
|
|
28
28
|
- [ ] Each commit follows the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) format: e.g. `chore(readme): fixed typo`. See the end of this file for more information.
|
29
29
|
- [ ] Any breaking changes are specified on the commit on which they are introduced with `BREAKING CHANGE` in the body of the commit.
|
30
|
-
- [ ] If this is a big feature with breaking changes, consider [opening an issue]
|
30
|
+
- [ ] If this is a big feature with breaking changes, consider [opening an issue](https://github.com/imgix/imgix-rb/issues/new?labels=&template=feature_request.md&title=) to discuss first. This is completely up to you, but please keep in mind that your PR might not be accepted.
|
31
31
|
- [ ] Run unit tests to ensure all existing tests are still passing
|
32
32
|
- [ ] Add new passing unit tests to cover the code introduced by your PR
|
33
33
|
- [ ] Update the readme
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [3.4.0](https://github.com/imgix/imgix-rb/compare/3.3.1...3.4.0) - August 12, 2020
|
7
|
+
|
8
|
+
* fix: deprecate api key versions ([#87](https://github.com/imgix/imgix-rb/pull/87))
|
9
|
+
* docs(readme): deprecation notice for pre-4.0 api keys ([#88](https://github.com/imgix/imgix-rb/pull/88))
|
10
|
+
|
6
11
|
## [3.3.1](https://github.com/imgix/imgix-rb/compare/3.3.0...3.3.1) - July 27, 2020
|
7
12
|
|
8
13
|
* fix: ensure host is initialized ([#82](https://github.com/imgix/imgix-rb/pull/82))
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -230,6 +230,8 @@ path.noise_reduction(50,50)
|
|
230
230
|
|
231
231
|
## Purge Cache
|
232
232
|
|
233
|
+
**Deprecation Notice:** The API keys used in `Imgix::Client#purge` version `3.3.X` have been deprecated. To utilize the updated `Imgix::Client#purge` method in version `4.0.0`, please regenerate your API key at `http://dashboard.imgix.com/api-keys`. Feel free to reach out to our [support line](support@imgix.com) if you have any questions or concerns.
|
234
|
+
|
233
235
|
If you need to remove or update an image on imgix, you can purge it from our cache by initializing a client with your api_key, then calling Imgix::Client#purge with the resource path.
|
234
236
|
|
235
237
|
```ruby
|
data/Rakefile
CHANGED
data/imgix.gemspec
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
require 'imgix/version'
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/imgix/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = 'imgix'
|
data/lib/imgix/client.rb
CHANGED
@@ -44,8 +44,13 @@ module Imgix
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def purge(path)
|
47
|
-
|
48
|
-
|
47
|
+
api_key_deprecated = \
|
48
|
+
"Warning: Your `api_key` will no longer work after upgrading to\n" \
|
49
|
+
"imgix-rb version >= 4.0.0.\n"
|
50
|
+
warn api_key_deprecated
|
51
|
+
|
52
|
+
api_key_error = 'A valid api key is required to send purge requests'
|
53
|
+
raise api_key_error if @api_key.nil?
|
49
54
|
|
50
55
|
url = new_prefix + path
|
51
56
|
uri = URI.parse('https://api.imgix.com/v2/image/purger')
|
data/lib/imgix/path.rb
CHANGED
@@ -153,7 +153,7 @@ module Imgix
|
|
153
153
|
srcset_widths = @target_widths
|
154
154
|
end
|
155
155
|
|
156
|
-
|
156
|
+
srcset_widths.each do |width|
|
157
157
|
params[:w] = width
|
158
158
|
srcset += "#{to_url(params)} #{width}w,\n"
|
159
159
|
end
|
@@ -170,7 +170,7 @@ module Imgix
|
|
170
170
|
target_ratios = [1, 2, 3, 4, 5]
|
171
171
|
quality = params[:q]
|
172
172
|
|
173
|
-
|
173
|
+
target_ratios.each do |ratio|
|
174
174
|
params[:dpr] = ratio
|
175
175
|
|
176
176
|
unless disable_variable_quality
|
data/lib/imgix/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
data/test/units/purge_test.rb
CHANGED
@@ -1,25 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
class PurgeTest < Imgix::Test
|
4
6
|
def test_runtime_error_without_api_key
|
5
|
-
assert_raises(RuntimeError)
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
assert_raises(RuntimeError) do
|
8
|
+
mock_client(api_key: nil).purge(mock_image)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_purger_version_warns
|
13
|
+
stub_request(:post, endpoint).with(body: body).to_return(status: 200)
|
14
|
+
|
15
|
+
assert_output(nil, deprecation_warning) do
|
16
|
+
mock_client(api_key: '10adc394').purge('/images/demo.png')
|
17
|
+
end
|
9
18
|
end
|
10
|
-
|
19
|
+
|
11
20
|
def test_successful_purge
|
12
|
-
stub_request(:post,
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
body: 'url=https%3A%2F%2Fdemo.imgix.net%2Fimages%2Fdemo.png',
|
22
|
-
headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Basic MTBhZGMzOTQ6', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>"imgix rb-#{ Imgix::VERSION}"},
|
21
|
+
stub_request(:post, endpoint).with(body: body).to_return(status: 200)
|
22
|
+
|
23
|
+
mock_client(api_key: '10adc394').purge('/images/demo.png')
|
24
|
+
|
25
|
+
assert_requested(
|
26
|
+
:post,
|
27
|
+
endpoint,
|
28
|
+
body: 'url=https%3A%2F%2Fdemo.imgix.net%2Fimages%2Fdemo.png',
|
29
|
+
headers: mock_headers,
|
23
30
|
times: 1
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def mock_client(api_key: '')
|
37
|
+
Imgix::Client.new(
|
38
|
+
domain: 'demo.imgix.net',
|
39
|
+
api_key: api_key,
|
40
|
+
include_library_param: false
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def mock_headers
|
45
|
+
{
|
46
|
+
'Accept' => '*/*',
|
47
|
+
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
48
|
+
'Authorization' => 'Basic MTBhZGMzOTQ6',
|
49
|
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
50
|
+
'User-Agent' => "imgix rb-#{Imgix::VERSION}"
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def mock_image
|
55
|
+
'https://demo.imgix.net/images/demo.png'
|
56
|
+
end
|
57
|
+
|
58
|
+
def endpoint
|
59
|
+
'https://api.imgix.com/v2/image/purger'
|
60
|
+
end
|
61
|
+
|
62
|
+
def body
|
63
|
+
{ 'url' => mock_image }
|
64
|
+
end
|
65
|
+
|
66
|
+
def deprecation_warning
|
67
|
+
"Warning: Your `api_key` will no longer work after upgrading to\n" \
|
68
|
+
"imgix-rb version >= 4.0.0.\n"
|
24
69
|
end
|
25
|
-
end
|
70
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Sutton
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2020-
|
16
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: addressable
|
@@ -87,8 +87,8 @@ licenses:
|
|
87
87
|
metadata:
|
88
88
|
bug_tracker_uri: https://github.com/imgix/imgix-rb/issues
|
89
89
|
changelog_uri: https://github.com/imgix/imgix-rb/blob/main/CHANGELOG.md
|
90
|
-
documentation_uri: https://www.rubydoc.info/gems/imgix/3.
|
91
|
-
source_code_uri: https://github.com/imgix/imgix-rb/tree/3.
|
90
|
+
documentation_uri: https://www.rubydoc.info/gems/imgix/3.4.0
|
91
|
+
source_code_uri: https://github.com/imgix/imgix-rb/tree/3.4.0
|
92
92
|
post_install_message:
|
93
93
|
rdoc_options: []
|
94
94
|
require_paths:
|