imgix 3.3.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 +7 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
- data/.github/ISSUE_TEMPLATE/question.md +17 -0
- data/.github/pull_request_template.md +73 -0
- data/.gitignore +18 -0
- data/.travis.yml +21 -0
- data/CHANGELOG.md +84 -0
- data/Contributing.markdown +19 -0
- data/Gemfile +9 -0
- data/LICENSE +22 -0
- data/README.md +258 -0
- data/Rakefile +16 -0
- data/imgix.gemspec +31 -0
- data/lib/imgix.rb +51 -0
- data/lib/imgix/client.rb +90 -0
- data/lib/imgix/param_helpers.rb +19 -0
- data/lib/imgix/path.rb +220 -0
- data/lib/imgix/version.rb +5 -0
- data/test/test_helper.rb +13 -0
- data/test/units/domains_test.rb +17 -0
- data/test/units/param_helpers_test.rb +23 -0
- data/test/units/path_test.rb +182 -0
- data/test/units/purge_test.rb +25 -0
- data/test/units/srcset_test.rb +755 -0
- data/test/units/url_test.rb +80 -0
- metadata +117 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class UrlTest < Imgix::Test
|
6
|
+
DEMO_IMAGE_PATH = '/images/demo.png'
|
7
|
+
|
8
|
+
def test_signing_with_no_params
|
9
|
+
path = client.path(DEMO_IMAGE_PATH)
|
10
|
+
|
11
|
+
assert_equal 'https://demo.imgix.net/images/demo.png?s=2c7c157eaf23b06a0deb2f60b81938c4', path.to_url
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_signing_with_one
|
15
|
+
path = client.path(DEMO_IMAGE_PATH)
|
16
|
+
|
17
|
+
assert_output(nil, "Warning: `Path.width=' has been deprecated and " \
|
18
|
+
"will be removed in the next major version (along " \
|
19
|
+
"with all parameter `ALIASES`).\n") {
|
20
|
+
path.width = 200
|
21
|
+
}
|
22
|
+
|
23
|
+
assert_equal 'https://demo.imgix.net/images/demo.png?w=200&s=da421114ca238d1f4a927b889f67c34e', path.to_url
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_signing_with_multiple_params
|
27
|
+
path = client.path(DEMO_IMAGE_PATH)
|
28
|
+
|
29
|
+
assert_output(nil, "Warning: `Path.height=' has been deprecated and " \
|
30
|
+
"will be removed in the next major version (along " \
|
31
|
+
"with all parameter `ALIASES`).\n") {
|
32
|
+
path.height = 200
|
33
|
+
}
|
34
|
+
|
35
|
+
assert_output(nil, "Warning: `Path.width=' has been deprecated and " \
|
36
|
+
"will be removed in the next major version (along " \
|
37
|
+
"with all parameter `ALIASES`).\n") {
|
38
|
+
path.width = 200
|
39
|
+
}
|
40
|
+
|
41
|
+
assert_equal 'https://demo.imgix.net/images/demo.png?h=200&w=200&s=d570a1ecd765470f7b34a69b56718a7a', path.to_url
|
42
|
+
|
43
|
+
path = client.path(DEMO_IMAGE_PATH)
|
44
|
+
|
45
|
+
assert_output(nil, "Warning: `Path.width=' has been deprecated and " \
|
46
|
+
"will be removed in the next major version (along " \
|
47
|
+
"with all parameter `ALIASES`).\n") {
|
48
|
+
path.width = 200
|
49
|
+
}
|
50
|
+
|
51
|
+
assert_output(nil, "Warning: `Path.height=' has been deprecated and " \
|
52
|
+
"will be removed in the next major version (along " \
|
53
|
+
"with all parameter `ALIASES`).\n") {
|
54
|
+
path.height = 200
|
55
|
+
}
|
56
|
+
|
57
|
+
assert_equal 'https://demo.imgix.net/images/demo.png?w=200&h=200&s=00b5cde5c7b8bca8618cb911da4ac379', path.to_url
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_domain_resolves_host_warn
|
61
|
+
assert_output(nil, "Warning: The identifier `host' has been deprecated and " \
|
62
|
+
"will\nappear as `domain' in the next major version, e.g. " \
|
63
|
+
"`@host'\nbecomes `@domain', `options[:host]' becomes " \
|
64
|
+
"`options[:domain]'.\n") {
|
65
|
+
Imgix::Client.new(host: 'demo.imgix.net', include_library_param: false)
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
# Assert the output of this call (to both stdout and stderr) is nil.
|
70
|
+
assert_output(nil, nil) {
|
71
|
+
Imgix::Client.new(domain: 'demo.imgix.net', include_library_param: false)
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def client
|
78
|
+
@client ||= Imgix::Client.new(host: 'demo.imgix.net', secure_url_token: '10adc394', include_library_param: false)
|
79
|
+
end
|
80
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: imgix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kelly Sutton
|
8
|
+
- Sam Soffes
|
9
|
+
- Ryan LeFevre
|
10
|
+
- Antony Denyer
|
11
|
+
- Paul Straw
|
12
|
+
- Sherwin Heydarbeygi
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: addressable
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: webmock
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: Easily create and sign imgix URLs.
|
47
|
+
email:
|
48
|
+
- kelly@imgix.com
|
49
|
+
- sam@soff.es
|
50
|
+
- ryan@layervault.com
|
51
|
+
- email@antonydenyer.co.uk
|
52
|
+
- paul@imgix.com
|
53
|
+
- sherwin@imgix.com
|
54
|
+
executables: []
|
55
|
+
extensions: []
|
56
|
+
extra_rdoc_files: []
|
57
|
+
files:
|
58
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
59
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
60
|
+
- ".github/ISSUE_TEMPLATE/question.md"
|
61
|
+
- ".github/pull_request_template.md"
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- CHANGELOG.md
|
65
|
+
- Contributing.markdown
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- imgix.gemspec
|
71
|
+
- lib/imgix.rb
|
72
|
+
- lib/imgix/client.rb
|
73
|
+
- lib/imgix/param_helpers.rb
|
74
|
+
- lib/imgix/path.rb
|
75
|
+
- lib/imgix/version.rb
|
76
|
+
- test/test_helper.rb
|
77
|
+
- test/units/domains_test.rb
|
78
|
+
- test/units/param_helpers_test.rb
|
79
|
+
- test/units/path_test.rb
|
80
|
+
- test/units/purge_test.rb
|
81
|
+
- test/units/srcset_test.rb
|
82
|
+
- test/units/url_test.rb
|
83
|
+
homepage: https://github.com/imgix/imgix-rb
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata:
|
87
|
+
bug_tracker_uri: https://github.com/imgix/imgix-rb/issues
|
88
|
+
changelog_uri: https://github.com/imgix/imgix-rb/blob/main/CHANGELOG.md
|
89
|
+
documentation_uri: https://www.rubydoc.info/gems/imgix/3.3.0
|
90
|
+
source_code_uri: https://github.com/imgix/imgix-rb/tree/3.3.0
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.9.0
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubygems_version: 3.1.2
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Official Ruby Gem for easily creating and signing imgix URLs.
|
110
|
+
test_files:
|
111
|
+
- test/test_helper.rb
|
112
|
+
- test/units/domains_test.rb
|
113
|
+
- test/units/param_helpers_test.rb
|
114
|
+
- test/units/path_test.rb
|
115
|
+
- test/units/purge_test.rb
|
116
|
+
- test/units/srcset_test.rb
|
117
|
+
- test/units/url_test.rb
|