tinify 1.5.1 → 1.7.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/workflows/ci-cd.yaml +110 -0
- data/.gitignore +2 -0
- data/CHANGES.md +33 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +31 -16
- data/README.md +3 -1
- data/lib/tinify/result.rb +7 -0
- data/lib/tinify/source.rb +8 -0
- data/lib/tinify/version.rb +1 -1
- data/test/helper.rb +9 -3
- data/test/integration.rb +11 -0
- data/test/tinify_client_test.rb +89 -54
- data/test/tinify_result_test.rb +13 -0
- data/test/tinify_source_test.rb +123 -30
- data/test/tinify_test.rb +52 -34
- data/tinify.gemspec +1 -6
- metadata +14 -66
- data/.travis.yml +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6947ac2a5fe37cabbd10fcafeb6e762fc15a19c637f6f617b5179b7057ecb2c4
|
4
|
+
data.tar.gz: 2b8964ae5761665b4400f83008a4a43bf795ce6e0c60e3d8a9f02f11e3505a58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 473ff8623d4142617493e00c2f0d1a2e06ea9342ceccdd07794df8113e378c3b583c1a3a98d4d22d558003ba1c65d7fdc668e592cbd7b2710830185dbbe3914e
|
7
|
+
data.tar.gz: ee5ef195846f70e996576295c7f06c2403d77ddb8d03984162baf4b8b29622f86f62ef93be1d29943d0f50355ef89cc00b3db70ee63513d5ca7e4cf777ec8316
|
@@ -0,0 +1,110 @@
|
|
1
|
+
name: Ruby CI/CD
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
permissions: {}
|
6
|
+
jobs:
|
7
|
+
Unit_tests:
|
8
|
+
runs-on: ${{ matrix.os }}
|
9
|
+
timeout-minutes: 10
|
10
|
+
# continue-on-error: ${{ matrix.experimental }}
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
ruby-version: ['3.1', '3.2', '3.3', '3.4', 'jruby']
|
15
|
+
os: [ubuntu-latest, macOS-latest, windows-latest]
|
16
|
+
# experimental: [false]
|
17
|
+
include:
|
18
|
+
# TruffleRuby on Windows may fail
|
19
|
+
# commented out, because it marks the build as failed with a red cross (X)
|
20
|
+
# - ruby-version: truffleruby
|
21
|
+
# os: windows-latest
|
22
|
+
# experimental: true
|
23
|
+
- ruby-version: truffleruby
|
24
|
+
os: macOS-latest
|
25
|
+
experimental: false
|
26
|
+
- ruby-version: truffleruby
|
27
|
+
os: ubuntu-latest
|
28
|
+
experimental: false
|
29
|
+
steps:
|
30
|
+
- uses: actions/checkout@v4
|
31
|
+
|
32
|
+
- name: Set up ruby ${{ matrix.ruby-version }}
|
33
|
+
uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby-version }}
|
36
|
+
bundler-cache: true
|
37
|
+
|
38
|
+
- name: Install dependencies
|
39
|
+
run: bundle install
|
40
|
+
|
41
|
+
- name: Run specs
|
42
|
+
run: bundle exec rake
|
43
|
+
|
44
|
+
Integration_tests:
|
45
|
+
if: github.event_name == 'push'
|
46
|
+
runs-on: ${{ matrix.os }}
|
47
|
+
timeout-minutes: 10
|
48
|
+
needs: Unit_tests
|
49
|
+
strategy:
|
50
|
+
fail-fast: false
|
51
|
+
matrix:
|
52
|
+
ruby-version: [
|
53
|
+
"3.1", "3.4"
|
54
|
+
]
|
55
|
+
os: [
|
56
|
+
ubuntu-latest,
|
57
|
+
macOS-latest,
|
58
|
+
# Disable windows due to an issue with binary encoding in the tests
|
59
|
+
# windows-latest
|
60
|
+
]
|
61
|
+
steps:
|
62
|
+
- uses: actions/checkout@v4
|
63
|
+
- name: Set up ruby ${{ matrix.ruby-version }}
|
64
|
+
uses: ruby/setup-ruby@v1
|
65
|
+
with:
|
66
|
+
ruby-version: ${{ matrix.ruby-version }}
|
67
|
+
bundler-cache: true
|
68
|
+
- name: Install dependencies
|
69
|
+
run: |
|
70
|
+
bundle install
|
71
|
+
- name: Run tests
|
72
|
+
env:
|
73
|
+
TINIFY_KEY: ${{ secrets.TINIFY_KEY }}
|
74
|
+
run: |
|
75
|
+
bundle exec rake integration
|
76
|
+
Publish:
|
77
|
+
if: |
|
78
|
+
github.repository == 'tinify/tinify-ruby' &&
|
79
|
+
startsWith(github.ref, 'refs/tags') &&
|
80
|
+
github.event_name == 'push'
|
81
|
+
timeout-minutes: 10
|
82
|
+
needs: [Unit_tests, Integration_tests]
|
83
|
+
runs-on: ubuntu-latest
|
84
|
+
steps:
|
85
|
+
- uses: actions/checkout@v3
|
86
|
+
- name: Set up Ruby 3.4
|
87
|
+
uses: ruby/setup-ruby@v1
|
88
|
+
with:
|
89
|
+
ruby-version: 3.4
|
90
|
+
- name: Check if properly tagged
|
91
|
+
run: |
|
92
|
+
PACKAGE_VERSION="$(ruby -e 'puts Gem::Specification::load("tinify.gemspec").version')";
|
93
|
+
CURRENT_TAG="${GITHUB_REF#refs/*/}";
|
94
|
+
if [[ "${PACKAGE_VERSION}" != "${CURRENT_TAG}" ]]; then
|
95
|
+
>&2 echo "Tag mismatch"
|
96
|
+
>&2 echo "Version in lib/tinify/version.rb (${PACKAGE_VERSION}) does not match the current tag=${CURRENT_TAG}"
|
97
|
+
>&2 echo "Skipping deploy"
|
98
|
+
exit 1;
|
99
|
+
fi
|
100
|
+
- run: bundle install
|
101
|
+
- name: Publish to RubyGems
|
102
|
+
run: |
|
103
|
+
mkdir -p $HOME/.gem
|
104
|
+
touch $HOME/.gem/credentials
|
105
|
+
chmod 0600 $HOME/.gem/credentials
|
106
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
107
|
+
gem build *.gemspec
|
108
|
+
gem push *.gem
|
109
|
+
env:
|
110
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.gitignore
ADDED
data/CHANGES.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
## 1.7.0
|
2
|
+
|
3
|
+
* Added base64 gem to Gemfile
|
4
|
+
|
5
|
+
Extend runtime support for:
|
6
|
+
|
7
|
+
* Ruby 3.2
|
8
|
+
* Ruby 3.3
|
9
|
+
* Ruby 3.4
|
10
|
+
|
11
|
+
Remove runtime support for:
|
12
|
+
|
13
|
+
* Ruby 2.6
|
14
|
+
* Ruby 3.0
|
15
|
+
|
16
|
+
## 1.6.0
|
17
|
+
|
18
|
+
Added transform & convert methods for the Tinify API.
|
19
|
+
Added helper property for getting the file extension (Result.extension)
|
20
|
+
|
21
|
+
Extend runtime support for the following runtimes:
|
22
|
+
|
23
|
+
* Ruby 2.6
|
24
|
+
* Ruby 2.7
|
25
|
+
* Ruby 3.0
|
26
|
+
* Ruby 3.1
|
27
|
+
|
28
|
+
Experimental support
|
29
|
+
|
30
|
+
* JRuby
|
31
|
+
* Truffle Ruby
|
32
|
+
|
33
|
+
|
1
34
|
## 1.5.0
|
2
35
|
* Retry failed requests by default.
|
3
36
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,32 +1,47 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tinify (1.
|
5
|
-
httpclient (
|
4
|
+
tinify (1.7.0)
|
5
|
+
httpclient (>= 2.9, < 3)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
10
|
+
addressable (2.8.7)
|
11
|
+
public_suffix (>= 2.0.2, < 7.0)
|
12
|
+
base64 (0.2.0)
|
13
|
+
bigdecimal (3.1.9)
|
14
|
+
bigdecimal (3.1.9-java)
|
15
|
+
crack (1.0.0)
|
16
|
+
bigdecimal
|
17
|
+
rexml
|
18
|
+
hashdiff (1.1.2)
|
19
|
+
httpclient (2.9.0)
|
20
|
+
mutex_m
|
21
|
+
minitest (5.25.5)
|
22
|
+
mutex_m (0.3.0)
|
23
|
+
public_suffix (6.0.1)
|
24
|
+
rake (13.2.1)
|
25
|
+
rexml (3.4.1)
|
26
|
+
webmock (3.25.1)
|
27
|
+
addressable (>= 2.8.0)
|
19
28
|
crack (>= 0.3.2)
|
29
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
20
30
|
|
21
31
|
PLATFORMS
|
32
|
+
arm64-darwin
|
33
|
+
java
|
22
34
|
ruby
|
35
|
+
x64-mingw-ucrt
|
36
|
+
x86_64-darwin
|
37
|
+
x86_64-linux
|
23
38
|
|
24
39
|
DEPENDENCIES
|
25
|
-
|
26
|
-
minitest
|
27
|
-
rake
|
40
|
+
base64
|
41
|
+
minitest
|
42
|
+
rake
|
28
43
|
tinify!
|
29
|
-
webmock
|
44
|
+
webmock
|
30
45
|
|
31
46
|
BUNDLED WITH
|
32
|
-
|
47
|
+
2.3.19
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
[
|
1
|
+
[](https://rubygems.org/gems/tinify)
|
2
|
+
[ ](https://github.com/tinify/tinify-java/blob/main/LICENSE)
|
3
|
+
[](https://github.com/tinify/tinify-ruby/actions/workflows/ci-cd.yaml)
|
2
4
|
|
3
5
|
# Tinify API client for Ruby
|
4
6
|
|
data/lib/tinify/result.rb
CHANGED
data/lib/tinify/source.rb
CHANGED
@@ -29,6 +29,14 @@ module Tinify
|
|
29
29
|
self.class.new(@url, @commands.merge(resize: options))
|
30
30
|
end
|
31
31
|
|
32
|
+
def convert(options)
|
33
|
+
self.class.new(@url, @commands.merge(convert: options))
|
34
|
+
end
|
35
|
+
|
36
|
+
def transform(options)
|
37
|
+
self.class.new(@url, @commands.merge(transform: options))
|
38
|
+
end
|
39
|
+
|
32
40
|
def store(options)
|
33
41
|
response = Tinify.client.request(:post, @url, @commands.merge(store: options))
|
34
42
|
ResultMeta.new(response.headers).freeze
|
data/lib/tinify/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
Bundler.require
|
3
|
+
|
1
4
|
require "minitest/autorun"
|
2
5
|
require "webmock/minitest"
|
3
|
-
|
4
6
|
require "tinify"
|
5
7
|
|
8
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|
9
|
+
|
6
10
|
module TestHelpers
|
7
11
|
def before_setup
|
8
12
|
Tinify.key = nil
|
@@ -24,6 +28,8 @@ module TestHelpers
|
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
module Minitest
|
32
|
+
class Spec
|
33
|
+
include TestHelpers
|
34
|
+
end
|
29
35
|
end
|
data/test/integration.rb
CHANGED
@@ -76,4 +76,15 @@ describe "client integration" do
|
|
76
76
|
assert_includes contents, "Copyright Voormedia".force_encoding("binary")
|
77
77
|
end
|
78
78
|
end
|
79
|
+
|
80
|
+
it "should convert" do
|
81
|
+
Tempfile.open("optimized.png", encoding: "binary") do |file|
|
82
|
+
optimized.convert(type: "image/webp").to_file(file.path)
|
83
|
+
r = file.read
|
84
|
+
|
85
|
+
assert_equal r[0..3], "RIFF".force_encoding("binary")
|
86
|
+
assert_equal r[8..11], "WEBP".force_encoding("binary")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
79
90
|
end
|
data/test/tinify_client_test.rb
CHANGED
@@ -11,33 +11,38 @@ describe Tinify::Client do
|
|
11
11
|
describe "request" do
|
12
12
|
describe "when valid" do
|
13
13
|
before do
|
14
|
-
stub_request(:get, "https://api
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
stub_request(:get, "https://api.tinify.com")
|
15
|
+
.with(basic_auth: ['api', 'key'])
|
16
|
+
.to_return(
|
17
|
+
status: 201,
|
18
|
+
headers: { "Compression-Count" => "12" }
|
19
|
+
)
|
20
|
+
|
21
|
+
stub_request(:get, "https://api.tinify.com/shrink")
|
22
|
+
.with(basic_auth: ['api', 'key'])
|
23
|
+
.to_return(
|
24
|
+
status: 201,
|
25
|
+
headers: {
|
26
|
+
"Compression-Count" => "12",
|
27
|
+
"Location" => "https://api.tinify.com/output/3spbi1cd7rs812lb.png"
|
28
|
+
}
|
29
|
+
)
|
25
30
|
end
|
26
31
|
|
27
32
|
it "should issue request" do
|
28
33
|
subject.request(:get, "/")
|
29
|
-
assert_requested :get, "https://api
|
30
|
-
headers: { "Authorization" => "Basic
|
34
|
+
assert_requested :get, "https://api.tinify.com",
|
35
|
+
headers: { "Authorization" => "Basic #{ Base64.strict_encode64('api:key').chomp}" }
|
31
36
|
end
|
32
37
|
|
33
38
|
it "should issue request to endpoint" do
|
34
39
|
subject.request(:get, "/shrink", {})
|
35
|
-
assert_requested :get, "https://api
|
40
|
+
assert_requested :get, "https://api.tinify.com/shrink"
|
36
41
|
end
|
37
42
|
|
38
43
|
it "should issue request with method" do
|
39
44
|
subject.request(:get, "/shrink", {})
|
40
|
-
assert_requested :get, "https://api
|
45
|
+
assert_requested :get, "https://api.tinify.com/shrink"
|
41
46
|
end
|
42
47
|
|
43
48
|
it "should return response" do
|
@@ -47,25 +52,25 @@ describe Tinify::Client do
|
|
47
52
|
|
48
53
|
it "should issue request without body when options are empty" do
|
49
54
|
subject.request(:get, "/", {})
|
50
|
-
assert_requested :get, "https://api
|
55
|
+
assert_requested :get, "https://api.tinify.com", body: nil
|
51
56
|
end
|
52
57
|
|
53
58
|
it "should issue request without content type when options are empty" do
|
54
59
|
subject.request(:get, "/", {})
|
55
|
-
assert_not_requested :get, "https://api
|
60
|
+
assert_not_requested :get, "https://api.tinify.com",
|
56
61
|
headers: { "Content-Type" => "application/x-www-form-urlencoded" }
|
57
62
|
end
|
58
63
|
|
59
64
|
it "should issue request with json body" do
|
60
65
|
subject.request(:get, "/", { hello: "world" })
|
61
|
-
assert_requested :get, "https://api
|
66
|
+
assert_requested :get, "https://api.tinify.com",
|
62
67
|
headers: { "Content-Type" => "application/json" },
|
63
68
|
body: '{"hello":"world"}'
|
64
69
|
end
|
65
70
|
|
66
71
|
it "should issue request with user agent" do
|
67
72
|
subject.request(:get, "/")
|
68
|
-
assert_requested :get, "https://api
|
73
|
+
assert_requested :get, "https://api.tinify.com",
|
69
74
|
headers: { "User-Agent" => Tinify::Client::USER_AGENT }
|
70
75
|
end
|
71
76
|
|
@@ -81,7 +86,7 @@ describe Tinify::Client do
|
|
81
86
|
|
82
87
|
it "should issue request with user agent" do
|
83
88
|
subject.request(:get, "/")
|
84
|
-
assert_requested :get, "https://api
|
89
|
+
assert_requested :get, "https://api.tinify.com",
|
85
90
|
headers: { "User-Agent" => "#{Tinify::Client::USER_AGENT} TestApp/0.1" }
|
86
91
|
end
|
87
92
|
end
|
@@ -93,7 +98,7 @@ describe Tinify::Client do
|
|
93
98
|
|
94
99
|
it "should issue request with proxy authorization" do
|
95
100
|
subject.request(:get, "/")
|
96
|
-
assert_requested :get, "https://api
|
101
|
+
assert_requested :get, "https://api.tinify.com",
|
97
102
|
headers: { "Proxy-Authorization" => "Basic dXNlcjpwYXNz" }
|
98
103
|
end
|
99
104
|
end
|
@@ -101,8 +106,11 @@ describe Tinify::Client do
|
|
101
106
|
|
102
107
|
describe "with timeout once" do
|
103
108
|
before do
|
104
|
-
stub_request(:get, "https://api
|
105
|
-
.
|
109
|
+
stub_request(:get, "https://api.tinify.com")
|
110
|
+
.with(basic_auth: ['api', 'key'])
|
111
|
+
.to_timeout
|
112
|
+
.then
|
113
|
+
.to_return(status: 201)
|
106
114
|
end
|
107
115
|
|
108
116
|
it "should return response" do
|
@@ -113,7 +121,9 @@ describe Tinify::Client do
|
|
113
121
|
|
114
122
|
describe "with timeout repeatedly" do
|
115
123
|
before do
|
116
|
-
stub_request(:get, "https://api
|
124
|
+
stub_request(:get, "https://api.tinify.com")
|
125
|
+
.with(basic_auth: ['api', 'key'])
|
126
|
+
.to_timeout
|
117
127
|
end
|
118
128
|
|
119
129
|
it "should raise connection error" do
|
@@ -131,7 +141,8 @@ describe Tinify::Client do
|
|
131
141
|
|
132
142
|
describe "with socket error once" do
|
133
143
|
before do
|
134
|
-
stub_request(:get, "https://api
|
144
|
+
stub_request(:get, "https://api.tinify.com")
|
145
|
+
.with(basic_auth: ['api', 'key'])
|
135
146
|
.to_raise(SocketError.new("nodename nor servname provided"))
|
136
147
|
.then.to_return(status: 201)
|
137
148
|
end
|
@@ -144,7 +155,9 @@ describe Tinify::Client do
|
|
144
155
|
|
145
156
|
describe "with socket error repeatedly" do
|
146
157
|
before do
|
147
|
-
stub_request(:get, "https://api
|
158
|
+
stub_request(:get, "https://api.tinify.com")
|
159
|
+
.with(basic_auth: ['api', 'key'])
|
160
|
+
.to_raise(SocketError.new("nodename nor servname provided"))
|
148
161
|
end
|
149
162
|
|
150
163
|
it "should raise error" do
|
@@ -162,9 +175,11 @@ describe Tinify::Client do
|
|
162
175
|
|
163
176
|
describe "with unexpected error once" do
|
164
177
|
before do
|
165
|
-
stub_request(:get, "https://api
|
178
|
+
stub_request(:get, "https://api.tinify.com")
|
179
|
+
.with(basic_auth: ['api', 'key'])
|
166
180
|
.to_raise("some error")
|
167
|
-
.then
|
181
|
+
.then
|
182
|
+
.to_return(status: 201)
|
168
183
|
end
|
169
184
|
|
170
185
|
it "should return response" do
|
@@ -175,7 +190,9 @@ describe Tinify::Client do
|
|
175
190
|
|
176
191
|
describe "with unexpected error repeatedly" do
|
177
192
|
before do
|
178
|
-
stub_request(:get, "https://api
|
193
|
+
stub_request(:get, "https://api.tinify.com")
|
194
|
+
.with(basic_auth: ['api', 'key'])
|
195
|
+
.to_raise("some error")
|
179
196
|
end
|
180
197
|
|
181
198
|
it "should raise error" do
|
@@ -193,10 +210,14 @@ describe Tinify::Client do
|
|
193
210
|
|
194
211
|
describe "with server error once" do
|
195
212
|
before do
|
196
|
-
stub_request(:get, "https://api
|
197
|
-
|
198
|
-
|
199
|
-
|
213
|
+
stub_request(:get, "https://api.tinify.com")
|
214
|
+
.with(basic_auth: ['api', 'key'])
|
215
|
+
.to_return(
|
216
|
+
status: 584,
|
217
|
+
body: '{"error":"InternalServerError","message":"Oops!"}'
|
218
|
+
)
|
219
|
+
.then
|
220
|
+
.to_return(status: 201)
|
200
221
|
end
|
201
222
|
|
202
223
|
it "should return response" do
|
@@ -207,10 +228,12 @@ describe Tinify::Client do
|
|
207
228
|
|
208
229
|
describe "with server error repeatedly" do
|
209
230
|
before do
|
210
|
-
stub_request(:get, "https://api
|
211
|
-
|
212
|
-
|
213
|
-
|
231
|
+
stub_request(:get, "https://api.tinify.com")
|
232
|
+
.with(basic_auth: ['api', 'key'])
|
233
|
+
.to_return(
|
234
|
+
status: 584,
|
235
|
+
body: '{"error":"InternalServerError","message":"Oops!"}'
|
236
|
+
)
|
214
237
|
end
|
215
238
|
|
216
239
|
it "should raise server error" do
|
@@ -228,10 +251,14 @@ describe Tinify::Client do
|
|
228
251
|
|
229
252
|
describe "with bad server response once" do
|
230
253
|
before do
|
231
|
-
stub_request(:get, "https://api
|
232
|
-
|
233
|
-
|
234
|
-
|
254
|
+
stub_request(:get, "https://api.tinify.com")
|
255
|
+
.with(basic_auth: ['api', 'key'])
|
256
|
+
.to_return(
|
257
|
+
status: 543,
|
258
|
+
body: '<!-- this is not json -->'
|
259
|
+
)
|
260
|
+
.then
|
261
|
+
.to_return(status: 201)
|
235
262
|
end
|
236
263
|
|
237
264
|
it "should return response" do
|
@@ -242,10 +269,12 @@ describe Tinify::Client do
|
|
242
269
|
|
243
270
|
describe "with bad server response repeatedly" do
|
244
271
|
before do
|
245
|
-
stub_request(:get, "https://api
|
246
|
-
|
247
|
-
|
248
|
-
|
272
|
+
stub_request(:get, "https://api.tinify.com")
|
273
|
+
.with(basic_auth: ['api', 'key'])
|
274
|
+
.to_return(
|
275
|
+
status: 543,
|
276
|
+
body: '<!-- this is not json -->'
|
277
|
+
)
|
249
278
|
end
|
250
279
|
|
251
280
|
it "should raise server error" do
|
@@ -255,7 +284,7 @@ describe Tinify::Client do
|
|
255
284
|
end
|
256
285
|
|
257
286
|
it "should raise error with message" do
|
258
|
-
assert_raise_with_message
|
287
|
+
assert_raise_with_message(/\(HTTP 543\/ParseError\)/) do
|
259
288
|
subject.request(:get, "/")
|
260
289
|
end
|
261
290
|
end
|
@@ -263,10 +292,13 @@ describe Tinify::Client do
|
|
263
292
|
|
264
293
|
describe "with client error" do
|
265
294
|
before do
|
266
|
-
stub_request(:get, "https://api
|
267
|
-
|
268
|
-
|
269
|
-
|
295
|
+
stub_request(:get, "https://api.tinify.com")
|
296
|
+
.with(basic_auth: ['api', 'key'])
|
297
|
+
.to_return(
|
298
|
+
status: 492,
|
299
|
+
body: '{"error":"BadRequest","message":"Oops!"}'
|
300
|
+
).then
|
301
|
+
.to_return(status: 201)
|
270
302
|
end
|
271
303
|
|
272
304
|
it "should raise client error" do
|
@@ -285,10 +317,13 @@ describe Tinify::Client do
|
|
285
317
|
|
286
318
|
describe "with bad credentials" do
|
287
319
|
before do
|
288
|
-
stub_request(:get, "https://api
|
289
|
-
|
290
|
-
|
291
|
-
|
320
|
+
stub_request(:get, "https://api.tinify.com")
|
321
|
+
.with(basic_auth: ['api', 'key'])
|
322
|
+
.to_return(
|
323
|
+
status: 401,
|
324
|
+
body: '{"error":"Unauthorized","message":"Oops!"}'
|
325
|
+
).then
|
326
|
+
.to_return(status: 201)
|
292
327
|
end
|
293
328
|
|
294
329
|
it "should raise account error" do
|
data/test/tinify_result_test.rb
CHANGED
@@ -47,6 +47,12 @@ describe Tinify::Result do
|
|
47
47
|
assert_equal "image data", subject.to_buffer
|
48
48
|
end
|
49
49
|
end
|
50
|
+
|
51
|
+
describe "extension" do
|
52
|
+
it "should return extension" do
|
53
|
+
assert_equal "png", subject.extension
|
54
|
+
end
|
55
|
+
end
|
50
56
|
end
|
51
57
|
|
52
58
|
describe "without meta and data" do
|
@@ -89,5 +95,12 @@ describe Tinify::Result do
|
|
89
95
|
assert_nil subject.to_buffer
|
90
96
|
end
|
91
97
|
end
|
98
|
+
|
99
|
+
describe "extension" do
|
100
|
+
it "should return nil" do
|
101
|
+
assert_nil subject.extension
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
92
105
|
end
|
93
106
|
end
|
data/test/tinify_source_test.rb
CHANGED
@@ -7,7 +7,8 @@ describe Tinify::Source do
|
|
7
7
|
before do
|
8
8
|
Tinify.key = "invalid"
|
9
9
|
|
10
|
-
stub_request(:post, "https://api
|
10
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
11
|
+
.with(basic_auth: ['api', 'invalid'])
|
11
12
|
.to_return(
|
12
13
|
status: 401,
|
13
14
|
body: '{"error":"Unauthorized","message":"Credentials are invalid"}')
|
@@ -45,13 +46,15 @@ describe Tinify::Source do
|
|
45
46
|
|
46
47
|
describe "from_file" do
|
47
48
|
before do
|
48
|
-
stub_request(:post, "https://api
|
49
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
50
|
+
.with(basic_auth: ['api', 'valid'])
|
49
51
|
.to_return(
|
50
52
|
status: 201,
|
51
53
|
headers: { Location: "https://api.tinify.com/some/location" },
|
52
54
|
body: '{}')
|
53
55
|
|
54
|
-
stub_request(:get, "https://api
|
56
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
57
|
+
.with(basic_auth: ['api', 'valid'])
|
55
58
|
.to_return(
|
56
59
|
status: 200,
|
57
60
|
body: "compressed file")
|
@@ -68,13 +71,15 @@ describe Tinify::Source do
|
|
68
71
|
|
69
72
|
describe "from_buffer" do
|
70
73
|
before do
|
71
|
-
stub_request(:post, "https://api
|
74
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
75
|
+
.with(basic_auth: ['api', 'valid'])
|
72
76
|
.to_return(
|
73
77
|
status: 201,
|
74
78
|
headers: { Location: "https://api.tinify.com/some/location" },
|
75
79
|
body: '{}')
|
76
80
|
|
77
|
-
stub_request(:get, "https://api
|
81
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
82
|
+
.with(basic_auth: ['api', 'valid'])
|
78
83
|
.to_return(
|
79
84
|
status: 200,
|
80
85
|
body: "compressed file")
|
@@ -91,20 +96,27 @@ describe Tinify::Source do
|
|
91
96
|
|
92
97
|
describe "from_url" do
|
93
98
|
before do
|
94
|
-
stub_request(:post, "https://api
|
95
|
-
.with(
|
99
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
100
|
+
.with(
|
101
|
+
basic_auth: ['api', 'valid'],
|
102
|
+
body: '{"source":{"url":"http://example.com/test.jpg"}}'
|
103
|
+
)
|
96
104
|
.to_return(
|
97
105
|
status: 201,
|
98
106
|
headers: { Location: "https://api.tinify.com/some/location" },
|
99
107
|
body: '{}')
|
100
108
|
|
101
|
-
stub_request(:post, "https://api
|
102
|
-
.with(
|
109
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
110
|
+
.with(
|
111
|
+
body: '{"source":{"url":"file://wrong"}}',
|
112
|
+
basic_auth: ['api', 'valid']
|
113
|
+
)
|
103
114
|
.to_return(
|
104
115
|
status: 400,
|
105
116
|
body: '{"error":"Source not found","message":"Cannot parse URL"}')
|
106
117
|
|
107
|
-
stub_request(:get, "https://api
|
118
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
119
|
+
.with(basic_auth: ['api', 'valid'])
|
108
120
|
.to_return(
|
109
121
|
status: 200,
|
110
122
|
body: "compressed file")
|
@@ -127,13 +139,15 @@ describe Tinify::Source do
|
|
127
139
|
|
128
140
|
describe "result" do
|
129
141
|
before do
|
130
|
-
stub_request(:post, "https://api
|
142
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
143
|
+
.with(basic_auth: ['api', 'valid'])
|
131
144
|
.to_return(
|
132
145
|
status: 201,
|
133
146
|
headers: { Location: "https://api.tinify.com/some/location" },
|
134
147
|
body: '{}')
|
135
148
|
|
136
|
-
stub_request(:get, "https://api
|
149
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
150
|
+
.with(basic_auth: ['api', 'valid'])
|
137
151
|
.to_return(
|
138
152
|
status: 200,
|
139
153
|
body: "compressed file")
|
@@ -146,14 +160,16 @@ describe Tinify::Source do
|
|
146
160
|
|
147
161
|
describe "preserve" do
|
148
162
|
before do
|
149
|
-
stub_request(:post, "https://api
|
163
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
164
|
+
.with(basic_auth: ['api', 'valid'])
|
150
165
|
.to_return(
|
151
166
|
status: 201,
|
152
167
|
headers: { Location: "https://api.tinify.com/some/location" },
|
153
168
|
body: '{}')
|
154
169
|
|
155
|
-
stub_request(:get, "https://api
|
170
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
156
171
|
.with(
|
172
|
+
basic_auth: ['api', 'valid'],
|
157
173
|
body: '{"preserve":["copyright","location"]}')
|
158
174
|
.to_return(
|
159
175
|
status: 200,
|
@@ -176,8 +192,9 @@ describe Tinify::Source do
|
|
176
192
|
end
|
177
193
|
|
178
194
|
it "should include other options if set" do
|
179
|
-
stub_request(:get, "https://api
|
195
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
180
196
|
.with(
|
197
|
+
basic_auth: ['api', 'valid'],
|
181
198
|
body: '{"resize":{"width":400},"preserve":["copyright","location"]}')
|
182
199
|
.to_return(
|
183
200
|
status: 200,
|
@@ -190,14 +207,16 @@ describe Tinify::Source do
|
|
190
207
|
|
191
208
|
describe "resize" do
|
192
209
|
before do
|
193
|
-
stub_request(:post, "https://api
|
210
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
211
|
+
.with(basic_auth: ['api', 'valid'])
|
194
212
|
.to_return(
|
195
213
|
status: 201,
|
196
214
|
headers: { Location: "https://api.tinify.com/some/location" },
|
197
215
|
body: '{}')
|
198
216
|
|
199
|
-
stub_request(:get, "https://api
|
217
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
200
218
|
.with(
|
219
|
+
basic_auth: ['api', 'valid'],
|
201
220
|
body: '{"resize":{"width":400}}')
|
202
221
|
.to_return(
|
203
222
|
status: 200,
|
@@ -213,17 +232,84 @@ describe Tinify::Source do
|
|
213
232
|
end
|
214
233
|
end
|
215
234
|
|
235
|
+
describe "convert" do
|
236
|
+
before do
|
237
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
238
|
+
.with(basic_auth: ['api', 'valid'])
|
239
|
+
.to_return(
|
240
|
+
status: 201,
|
241
|
+
headers: { Location: "https://api.tinify.com/some/location" },
|
242
|
+
body: '{}')
|
243
|
+
|
244
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
245
|
+
.with(
|
246
|
+
basic_auth: ['api', 'valid'],
|
247
|
+
body: '{"convert":{"type":["image/webp"]}}')
|
248
|
+
.to_return(
|
249
|
+
status: 200,
|
250
|
+
body: "converted file")
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should return source" do
|
254
|
+
assert_kind_of Tinify::Source, Tinify::Source.from_buffer("png file").convert(type: ["image/webp"])
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should return source with data" do
|
258
|
+
assert_equal "converted file", Tinify::Source.from_buffer("png file").convert(type: ["image/webp"]).to_buffer
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe "transform" do
|
263
|
+
before do
|
264
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
265
|
+
.with(basic_auth: ['api', 'valid'])
|
266
|
+
.to_return(
|
267
|
+
status: 201,
|
268
|
+
headers: { Location: "https://api.tinify.com/some/location" },
|
269
|
+
body: '{}')
|
270
|
+
|
271
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
272
|
+
.with(
|
273
|
+
basic_auth: ['api', 'valid'],
|
274
|
+
body: '{"transform":{"color":"black"}}')
|
275
|
+
.to_return(
|
276
|
+
status: 200,
|
277
|
+
body: "transformd file")
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should return source" do
|
281
|
+
assert_kind_of Tinify::Source, Tinify::Source.from_buffer("png file").transform(color: "black'")
|
282
|
+
end
|
283
|
+
|
284
|
+
it "should return source with data" do
|
285
|
+
assert_equal "transformd file", Tinify::Source.from_buffer("png file").transform(color: "black").to_buffer
|
286
|
+
end
|
287
|
+
|
288
|
+
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 => {})
|
294
|
+
|
295
|
+
result = Tinify::Source.from_buffer("png file").convert(type: ["image/webp"]).transform(color: "black")
|
296
|
+
assert_equal "trans-formed-and-coded", result.to_buffer
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
216
300
|
describe "store" do
|
217
301
|
before do
|
218
|
-
stub_request(:post, "https://api
|
302
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
303
|
+
.with(basic_auth: ['api', 'valid'])
|
219
304
|
.to_return(
|
220
305
|
status: 201,
|
221
306
|
headers: { Location: "https://api.tinify.com/some/location" },
|
222
307
|
body: '{}'
|
223
308
|
)
|
224
309
|
|
225
|
-
stub_request(:post, "https://api
|
310
|
+
stub_request(:post, "https://api.tinify.com/some/location")
|
226
311
|
.with(
|
312
|
+
basic_auth: ['api', 'valid'],
|
227
313
|
body: '{"store":{"service":"s3"}}')
|
228
314
|
.to_return(
|
229
315
|
status: 200,
|
@@ -240,8 +326,9 @@ describe Tinify::Source do
|
|
240
326
|
end
|
241
327
|
|
242
328
|
it "should include other options if set" do
|
243
|
-
stub_request(:post, "https://api
|
329
|
+
stub_request(:post, "https://api.tinify.com/some/location")
|
244
330
|
.with(
|
331
|
+
basic_auth: ['api', 'valid'],
|
245
332
|
body: '{"resize":{"width":400},"store":{"service":"s3"}}')
|
246
333
|
.to_return(
|
247
334
|
status: 200,
|
@@ -254,16 +341,19 @@ describe Tinify::Source do
|
|
254
341
|
|
255
342
|
describe "to_buffer" do
|
256
343
|
before do
|
257
|
-
stub_request(:post, "https://api
|
344
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
345
|
+
.with(basic_auth: ['api', 'valid'])
|
258
346
|
.to_return(
|
259
347
|
status: 201,
|
260
348
|
headers: { Location: "https://api.tinify.com/some/location" },
|
261
349
|
body: '{}')
|
262
350
|
|
263
|
-
stub_request(:get, "https://api
|
264
|
-
|
265
|
-
|
266
|
-
|
351
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
352
|
+
.with(basic_auth: ['api', 'valid'])
|
353
|
+
.to_return(
|
354
|
+
status: 200,
|
355
|
+
body: "compressed file"
|
356
|
+
)
|
267
357
|
end
|
268
358
|
|
269
359
|
it "should return image data" do
|
@@ -273,16 +363,19 @@ describe Tinify::Source do
|
|
273
363
|
|
274
364
|
describe "to_file" do
|
275
365
|
before do
|
276
|
-
stub_request(:post, "https://api
|
366
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
367
|
+
.with(basic_auth: ['api', 'valid'])
|
277
368
|
.to_return(
|
278
369
|
status: 201,
|
279
370
|
headers: { Location: "https://api.tinify.com/some/location" },
|
280
371
|
body: '{}')
|
281
372
|
|
282
|
-
stub_request(:get, "https://api
|
283
|
-
|
284
|
-
|
285
|
-
|
373
|
+
stub_request(:get, "https://api.tinify.com/some/location")
|
374
|
+
.with(basic_auth: ['api', 'valid'])
|
375
|
+
.to_return(
|
376
|
+
status: 200,
|
377
|
+
body: "compressed file"
|
378
|
+
)
|
286
379
|
end
|
287
380
|
|
288
381
|
it "should store image data" do
|
data/test/tinify_test.rb
CHANGED
@@ -5,7 +5,9 @@ describe Tinify do
|
|
5
5
|
|
6
6
|
describe "key" do
|
7
7
|
before do
|
8
|
-
stub_request(:get, "https://api
|
8
|
+
stub_request(:get, "https://api.tinify.com")
|
9
|
+
.with(basic_auth: ['api', 'fghij'])
|
10
|
+
.to_return(status: 200)
|
9
11
|
end
|
10
12
|
|
11
13
|
it "should reset client with new key" do
|
@@ -13,14 +15,16 @@ describe Tinify do
|
|
13
15
|
Tinify.client
|
14
16
|
Tinify.key = "fghij"
|
15
17
|
Tinify.client.request(:get, "/")
|
16
|
-
assert_requested :get, "https://api
|
17
|
-
headers: { "Authorization" => "Basic
|
18
|
+
assert_requested :get, "https://api.tinify.com",
|
19
|
+
headers: { "Authorization" => "Basic #{ Base64.strict_encode64('api:fghij').chomp}" }
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
23
|
describe "app_identifier" do
|
22
24
|
before do
|
23
|
-
stub_request(:get, "https://api
|
25
|
+
stub_request(:get, "https://api.tinify.com")
|
26
|
+
.with(basic_auth: ['api', 'abcde'])
|
27
|
+
.to_return(status: 200)
|
24
28
|
end
|
25
29
|
|
26
30
|
it "should reset client with new app identifier" do
|
@@ -29,14 +33,16 @@ describe Tinify do
|
|
29
33
|
Tinify.client
|
30
34
|
Tinify.app_identifier = "MyApp/2.0"
|
31
35
|
Tinify.client.request(:get, "/")
|
32
|
-
assert_requested :get, "https://api
|
36
|
+
assert_requested :get, "https://api.tinify.com",
|
33
37
|
headers: { "User-Agent" => "#{Tinify::Client::USER_AGENT} MyApp/2.0" }
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
37
41
|
describe "proxy" do
|
38
42
|
before do
|
39
|
-
stub_request(:get, "https://api
|
43
|
+
stub_request(:get, "https://api.tinify.com")
|
44
|
+
.with(basic_auth: ['api', 'abcde'])
|
45
|
+
.to_return(status: 200)
|
40
46
|
end
|
41
47
|
|
42
48
|
it "should reset client with new proxy" do
|
@@ -45,7 +51,7 @@ describe Tinify do
|
|
45
51
|
Tinify.client
|
46
52
|
Tinify.proxy = "http://user:pass@localhost:8080"
|
47
53
|
Tinify.client.request(:get, "/")
|
48
|
-
assert_requested :get, "https://api
|
54
|
+
assert_requested :get, "https://api.tinify.com",
|
49
55
|
headers: { "Proxy-Authorization" => "Basic dXNlcjpwYXNz" }
|
50
56
|
end
|
51
57
|
end
|
@@ -82,10 +88,12 @@ describe Tinify do
|
|
82
88
|
before do
|
83
89
|
Tinify.key = "valid"
|
84
90
|
|
85
|
-
stub_request(:post, "https://api
|
86
|
-
|
87
|
-
|
88
|
-
|
91
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
92
|
+
.with(basic_auth: ['api', 'valid'])
|
93
|
+
.to_return(
|
94
|
+
status: 400,
|
95
|
+
body: '{"error":"Input missing","message":"No input"}'
|
96
|
+
)
|
89
97
|
end
|
90
98
|
|
91
99
|
it "should return true" do
|
@@ -97,10 +105,12 @@ describe Tinify do
|
|
97
105
|
before do
|
98
106
|
Tinify.key = "valid"
|
99
107
|
|
100
|
-
stub_request(:post, "https://api
|
101
|
-
|
102
|
-
|
103
|
-
|
108
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
109
|
+
.with(basic_auth: ['api', 'valid'])
|
110
|
+
.to_return(
|
111
|
+
status: 429,
|
112
|
+
body: '{"error":"Too many requests","message":"Your monthly limit has been exceeded"}'
|
113
|
+
)
|
104
114
|
end
|
105
115
|
|
106
116
|
it "should return true" do
|
@@ -112,10 +122,12 @@ describe Tinify do
|
|
112
122
|
before do
|
113
123
|
Tinify.key = "invalid"
|
114
124
|
|
115
|
-
stub_request(:post, "https://api
|
116
|
-
|
117
|
-
|
118
|
-
|
125
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
126
|
+
.with(basic_auth: ['api', 'invalid'])
|
127
|
+
.to_return(
|
128
|
+
status: 401,
|
129
|
+
body: '{"error":"Unauthorized","message":"Credentials are invalid"}'
|
130
|
+
)
|
119
131
|
end
|
120
132
|
|
121
133
|
it "should raise error" do
|
@@ -130,11 +142,13 @@ describe Tinify do
|
|
130
142
|
before do
|
131
143
|
Tinify.key = "valid"
|
132
144
|
|
133
|
-
stub_request(:post, "https://api
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
145
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
146
|
+
.with(basic_auth: ['api', 'valid'])
|
147
|
+
.to_return(
|
148
|
+
status: 201,
|
149
|
+
headers: { Location: "https://api.tinify.com/some/location" },
|
150
|
+
body: '{}'
|
151
|
+
)
|
138
152
|
end
|
139
153
|
|
140
154
|
it "should return source" do
|
@@ -146,11 +160,13 @@ describe Tinify do
|
|
146
160
|
before do
|
147
161
|
Tinify.key = "valid"
|
148
162
|
|
149
|
-
stub_request(:post, "https://api
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
163
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
164
|
+
.with(basic_auth: ['api', 'valid'])
|
165
|
+
.to_return(
|
166
|
+
status: 201,
|
167
|
+
headers: { Location: "https://api.tinify.com/some/location" },
|
168
|
+
body: '{}'
|
169
|
+
)
|
154
170
|
end
|
155
171
|
|
156
172
|
it "should return source" do
|
@@ -162,11 +178,13 @@ describe Tinify do
|
|
162
178
|
before do
|
163
179
|
Tinify.key = "valid"
|
164
180
|
|
165
|
-
stub_request(:post, "https://api
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
181
|
+
stub_request(:post, "https://api.tinify.com/shrink")
|
182
|
+
.with(basic_auth: ['api', 'valid'])
|
183
|
+
.to_return(
|
184
|
+
status: 201,
|
185
|
+
headers: { Location: "https://api.tinify.com/some/location" },
|
186
|
+
body: '{}'
|
187
|
+
)
|
170
188
|
end
|
171
189
|
|
172
190
|
it "should return source" do
|
data/tinify.gemspec
CHANGED
@@ -18,10 +18,5 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^test/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency(
|
22
|
-
|
23
|
-
spec.add_development_dependency("bundler", "~> 1.7")
|
24
|
-
spec.add_development_dependency("rake", "~> 10.0")
|
25
|
-
spec.add_development_dependency("minitest", "~> 5.5")
|
26
|
-
spec.add_development_dependency("webmock", "~> 1.20")
|
21
|
+
spec.add_dependency('httpclient', '>= 2.9', '< 3')
|
27
22
|
end
|
metadata
CHANGED
@@ -1,85 +1,34 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rolf Timmermans
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-19 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: httpclient
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
|
-
- - "
|
16
|
+
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.6'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.7'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.7'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
18
|
+
version: '2.9'
|
19
|
+
- - "<"
|
46
20
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '5.5'
|
62
|
-
type: :development
|
21
|
+
version: '3'
|
22
|
+
type: :runtime
|
63
23
|
prerelease: false
|
64
24
|
version_requirements: !ruby/object:Gem::Requirement
|
65
25
|
requirements:
|
66
|
-
- - "
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '5.5'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: webmock
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
26
|
+
- - ">="
|
74
27
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
76
|
-
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
28
|
+
version: '2.9'
|
29
|
+
- - "<"
|
81
30
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
31
|
+
version: '3'
|
83
32
|
description: Ruby client for the Tinify API. Tinify compresses your images intelligently.
|
84
33
|
Read more at https://tinify.com.
|
85
34
|
email:
|
@@ -88,7 +37,8 @@ executables: []
|
|
88
37
|
extensions: []
|
89
38
|
extra_rdoc_files: []
|
90
39
|
files:
|
91
|
-
- ".
|
40
|
+
- ".github/workflows/ci-cd.yaml"
|
41
|
+
- ".gitignore"
|
92
42
|
- CHANGES.md
|
93
43
|
- Gemfile
|
94
44
|
- Gemfile.lock
|
@@ -118,7 +68,6 @@ homepage: https://tinify.com/developers
|
|
118
68
|
licenses:
|
119
69
|
- MIT
|
120
70
|
metadata: {}
|
121
|
-
post_install_message:
|
122
71
|
rdoc_options: []
|
123
72
|
require_paths:
|
124
73
|
- lib
|
@@ -133,8 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
82
|
- !ruby/object:Gem::Version
|
134
83
|
version: '0'
|
135
84
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
137
|
-
signing_key:
|
85
|
+
rubygems_version: 3.6.2
|
138
86
|
specification_version: 4
|
139
87
|
summary: Ruby client for the Tinify API.
|
140
88
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 1.9.2
|
4
|
-
- 1.9.3
|
5
|
-
- 2.0
|
6
|
-
- 2.1
|
7
|
-
- 2.2
|
8
|
-
- 2.3.0
|
9
|
-
- ruby-head
|
10
|
-
- jruby-19mode
|
11
|
-
- jruby-20mode
|
12
|
-
- rbx-2
|
13
|
-
env:
|
14
|
-
global:
|
15
|
-
- secure: u2JnTDMbqgf0kP5vDywFP+lL0ON135Q4a4jXTS1J4K8Kp7qFe/yzyrtYSmDJux31U3Ob/U/ptwYLlFUYuwjwMgTb4ow35jms8d9RvLb6vIBH7Yw9Sf6eq3iJxHGNOjM2pTL9N5DHx4TTO2ov+vQ1PT/QY5P70LVrSKurgKFDjgIZKwnYbFSZtusHX0qTPPQ3FL+NDdcuDmxLxiGt294o+9pFrUAQUKVV4NAk+HUnLjpqKWFqD9pMEw/DYrX4g9RAmN5YWt0sE+CCMFEaKh6Ghrfcfxov9yDEcKDz2ELXNiot9526wwoNONA/zT9hNQXfxhIXfV/67JsJ9cmbZIgP9FLWd/ziRs/yjoTJRaSloifXtAXAft2PMiNx7dnB2C9FFnDzJuTTkJdQfdSEkcXkn0a1Hy5wUI6Ur9Vdjn/Jc5yAHF6Uc78ekgkXBIVxc/J9J9EjophlaCsZHQbgM2H+mADbRIAA/qV1WD9XTISxANP6N19Pt6xFW+wGDnfBBDqbzCO6vK9M+9fU2LW4N8177rtCEG7XkUVSllbJvq841MPqOi2k++B9LD2xAu6Db3ubV5KFL/wg1QBoyP5QOd1uAZ+goQFdvxOZ/7mN/45ytKYYammQlngZFUi638dAE6f4j+NUtrczk4QQJmDuFxXoP+KBtgiD1nrtmenaxOEp/gk=
|
16
|
-
matrix:
|
17
|
-
allow_failures:
|
18
|
-
- rvm: jruby-20mode
|
19
|
-
- rvm: ruby-head
|
20
|
-
- rvm: rbx-2
|
21
|
-
include:
|
22
|
-
- rvm: 2.2
|
23
|
-
env: INTEGRATION_TESTS=true
|
24
|
-
script: "if [ \"$TRAVIS_PULL_REQUEST\" == \"false\" ]; then rake integration; fi"
|
25
|
-
notifications:
|
26
|
-
email: false
|
27
|
-
slack:
|
28
|
-
secure: udqUs5rLo5XXIM+PpqBDCTOEobzqnQs2Vq+eHOBaJggVSjfYrN6OYQAmZVBLIpysCJPcuZhZ64u93p2Zl+Yu9vJHXPnhFIBEmQlFybCjRIQtz1MMaeqZTMCO49avY+SCjBvXZV902PKJ8vVeeR2O3T5oj894JTejtAnXm5yEInNft3ODMsF+v3R5WFjD8cS+RWegZRotkbhQmQNrqCKxD7rZ3ufTyJuhpVnJPsUZVyaMJbWUWJRsessbl9nBxk3fFR74KXoURgEOv/OmbQD5AkVv1FkxGh0Y7wpn0aU9UOSmJZzzsXp/MaGNfZW7UwGx4iMtTa1YK+h+/fD3PNePfCPLZfvIvxnheIUn3Zrky9TDfK3KP9KHNuAtGdW3c5oxSCimRNTmx2MmsnbGO2sElR/u+Jxr+h0NO5xaBQBmHQeGKjv7VYv3Hexeac0I9lf6lQzmpk6XlstsPfht/Qwia/45RyEu2E8/s4OTFiKYgCBtpttkQ1VTvRowUPgHcuddldUKlI0j6CZlM2gpt9oLAQvzSmdlGX3j4Hpa6nCHILzW8vLoNHvMHTgjz6GU6RJwSj9JjIDkg1XCmq60EmQOKaacjEGXAG2plp0Fulm5THgU7WKnxC5PA+lrSgspmUFb8A0nmKG3tyuSOytVGBRAyu3FLEQih0xrPcZJ2rZ5T0s=
|
29
|
-
deploy:
|
30
|
-
provider: rubygems
|
31
|
-
api_key:
|
32
|
-
secure: E+dMU6AJuijnGrStl1+hrPizsiPzkWOAjpEG+zAhnuC6pBxTt0Ximc+UcrQiDmQdYQpxhulHreSO2otU9GkvDbpfrP+WE0c9j3AcAAHex6oHIctONWHwcbFnyyIMCNZpcFfMgVH8Nay3vnqVK+bhvNGLP/fVFeQE2co++JQp6BHpIMN6yxlIkGiJeP38Wcv4TVZmJMDcSxgLm+XlZ8xBIMkez9GEADnKXm2ZFfcx8p9K4bXK3hbZ34DF7bYYCN0eDqV4Y5ZGBF9FugUTz19fALyTlQxCks6NM2VT6gM/tg2ibGnzCQ4Wa3XR0pPH6H3xPJBtXlprUvXu27LYrb/PZ0rPN+cXI3nqGKsy6oxfCpVjr26qa5OoRG4XaX8w5ojUDo+D90HyT5Wxpe0BCAVQ+h/rgqOo9X0iByC2S9ORgCmo2lPPCUG442wmiX1V3um29rSNqX9CEb8WC0zZDgGwDp9YjlyztSy+hB96Ljy9rmQcSkQdcQETYSwareBqQmWFeHZbzy2iMR8xEzFpdCVUEnsY9isBVBeoJYYsAlrDRTrlt/A78K32JxP+9E5gQQegv6WQ/0nVJ9fmP6tnmFOLb1CUksmuAIJHA4FdVc0yZDnixHqZy8dyOxJ6dLwjAUx75TThI1ts36wATb8LBXIGgXXJb0y3RNP3KVY/DXPJE64=
|
33
|
-
gem: tinify
|
34
|
-
on:
|
35
|
-
tags: true
|
36
|
-
repo: tinify/tinify-ruby
|
37
|
-
ruby: 2.2
|
38
|
-
condition: "$INTEGRATION_TESTS != true"
|