smallpict 0.0.2 → 0.0.3
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/CHANGELOG.md +1 -1
- data/README.md +9 -1
- data/lib/smallpict/client.rb +6 -5
- data/lib/smallpict/models/optimize_options.rb +4 -2
- data/lib/smallpict/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: deb499b3b7054ce23e0df602e72dcb71e5f64e2c915ad4bd151a538e66323696
|
|
4
|
+
data.tar.gz: 20d65fa89fc225ec5d93af1200ea6051bbea2ea838df348f755bce9e4c2691c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b744a45b8b6372724292010fef0f33347afd455e0c9e755e7f4236019b3db28fd4cbc1345d0de1e29c35dc02d677e98769a6a58b74fca9f687bd7c353d01b63c
|
|
7
|
+
data.tar.gz: 62785d9953f7152563493da2b8bbb4867109ae59d5dbef357f0b247bce4bb31de961aa11abaaac272ebb12845bf9d689e0fc350c2d5c51e60f06982f01139860
|
data/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,7 @@ All notable changes to the `smallpict` gem will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [0.0.2] - 2026-08-22
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
- Official Ruby SDK implementation for SmallPict OpenAPI 3.1.0 API.
|
data/README.md
CHANGED
|
@@ -24,13 +24,15 @@ Official Ruby gem for the [SmallPict Image Optimization API](https://smallpict.a
|
|
|
24
24
|
Add to your application's `Gemfile`:
|
|
25
25
|
|
|
26
26
|
```ruby
|
|
27
|
-
gem "smallpict", "~>
|
|
27
|
+
gem "smallpict", "~> 0.0.2"
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
And then execute:
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
bundle install
|
|
34
|
+
# or install directly
|
|
35
|
+
gem install smallpict
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
---
|
|
@@ -117,6 +119,12 @@ bundle exec rubocop
|
|
|
117
119
|
|
|
118
120
|
---
|
|
119
121
|
|
|
122
|
+
## 🔒 Security & Schema Compatibility (2026)
|
|
123
|
+
|
|
124
|
+
- **`mime_type` & `content_type` Dual Support**: `OptimizeOptions` accepts both `mime_type` and `content_type` keyword arguments. Outgoing optimization payloads include both `mime_type` and `content_type` fields, ensuring seamless zero-disruption compatibility across all SmallPict API versions.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
120
128
|
## 📄 License
|
|
121
129
|
|
|
122
130
|
MIT © [SmallPict Engineering](https://smallpict.app)
|
data/lib/smallpict/client.rb
CHANGED
|
@@ -33,10 +33,11 @@ module SmallPict
|
|
|
33
33
|
resolved = resolve_source(source, opts)
|
|
34
34
|
|
|
35
35
|
payload = {
|
|
36
|
-
filename:
|
|
37
|
-
mime_type:
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
filename: resolved[:filename],
|
|
37
|
+
mime_type: resolved[:mime_type],
|
|
38
|
+
content_type: resolved[:mime_type],
|
|
39
|
+
filesize: resolved[:filesize],
|
|
40
|
+
options: opts.to_h
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
begin
|
|
@@ -224,7 +225,7 @@ module SmallPict
|
|
|
224
225
|
|
|
225
226
|
def resolve_source(source, options)
|
|
226
227
|
filename = options.filename || "image.jpg"
|
|
227
|
-
mime_type = options.mime_type || "image/jpeg"
|
|
228
|
+
mime_type = options.mime_type || (options.respond_to?(:content_type) ? options.content_type : nil) || "image/jpeg"
|
|
228
229
|
filesize = 0
|
|
229
230
|
bytes = nil
|
|
230
231
|
|
|
@@ -4,7 +4,7 @@ module SmallPict
|
|
|
4
4
|
module Models
|
|
5
5
|
class OptimizeOptions
|
|
6
6
|
attr_reader :format, :quality, :max_width, :max_height, :fit,
|
|
7
|
-
:lossless, :strip_metadata, :filename, :mime_type, :idempotency_key
|
|
7
|
+
:lossless, :strip_metadata, :filename, :mime_type, :content_type, :idempotency_key
|
|
8
8
|
|
|
9
9
|
def initialize(
|
|
10
10
|
format: "auto",
|
|
@@ -16,6 +16,7 @@ module SmallPict
|
|
|
16
16
|
strip_metadata: true,
|
|
17
17
|
filename: nil,
|
|
18
18
|
mime_type: nil,
|
|
19
|
+
content_type: nil,
|
|
19
20
|
idempotency_key: nil
|
|
20
21
|
)
|
|
21
22
|
@format = format.to_s
|
|
@@ -26,7 +27,8 @@ module SmallPict
|
|
|
26
27
|
@lossless = lossless
|
|
27
28
|
@strip_metadata = strip_metadata
|
|
28
29
|
@filename = filename
|
|
29
|
-
@mime_type = mime_type
|
|
30
|
+
@mime_type = mime_type || content_type
|
|
31
|
+
@content_type = content_type || mime_type
|
|
30
32
|
@idempotency_key = idempotency_key
|
|
31
33
|
end
|
|
32
34
|
|
data/lib/smallpict/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smallpict
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SmallPict Engineering
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|