smallpict 0.0.2 → 0.0.5

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: 565675254d5e7cd7e11bdaced638c047936b1b43a9b91c6e145f09389718d48e
4
- data.tar.gz: 21c1e92af87a8f68e7707f4c0859891d2599177a4d65758c043c50cdd515e21c
3
+ metadata.gz: 07f81540dbb9ffdc18b971d6b7519d928505ba89713483e842ce7d5591b7283f
4
+ data.tar.gz: ad857c51ab6a2c763ce57c8ee213ed793c22d6750a709fe505b5bd4343bb8d33
5
5
  SHA512:
6
- metadata.gz: 7608905f03dae3e5bc6c18e8caafa8d8e501f817dff05cfdc9a09be3a453de686c692d04d8995aa7d014c7cb8378ef54186e7c0e82e1df9374d99ab508250504
7
- data.tar.gz: 66bd8b1ae819fd398fff79301686a2b10e47449b9dce602abf14774b12614ca73f8f148ff6019ec3b0a1c05d81e9d26d496b371669d4b7a6e9d494a5be0ded93
6
+ metadata.gz: 3bebb0287a363cc4822f714b892ca1d179cb128ce1b93da684fd02e27a6eb3618adf03fea5f323733fcc991586bab0a1acb66db44646ca7390e46272fd9911fb
7
+ data.tar.gz: a9c4ba6d3d0dc9ec41699a8b66c2b44ab32b664e06726c39fce4afbcb7dd7f5417f8d4d002a0cab65c8124ec1cef10806143bd11e43b275efc46645953325679
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
- ## [1.0.0] - 2026-08-22
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
@@ -4,7 +4,7 @@ Official Ruby gem for the [SmallPict Image Optimization API](https://smallpict.a
4
4
 
5
5
  [![Gem Version](https://img.shields.io/gem/v/smallpict.svg)](https://rubygems.org/gems/smallpict)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
- [![Ruby Version](https://img.shields.io/badge/ruby-%3E%3D3.0-ruby.svg)](https://www.ruby-lang.org)
7
+ [![Ruby Version](https://img.shields.io/badge/ruby-%3E%3D3.2-ruby.svg)](https://www.ruby-lang.org)
8
8
 
9
9
  ---
10
10
 
@@ -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", "~> 1.0"
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)
@@ -33,10 +33,11 @@ module SmallPict
33
33
  resolved = resolve_source(source, opts)
34
34
 
35
35
  payload = {
36
- filename: resolved[:filename],
37
- mime_type: resolved[:mime_type],
38
- filesize: resolved[:filesize],
39
- options: opts.to_h
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
 
@@ -3,30 +3,34 @@
3
3
  module SmallPict
4
4
  module Models
5
5
  class OptimizeOptions
6
- attr_reader :format, :quality, :max_width, :max_height, :fit,
7
- :lossless, :strip_metadata, :filename, :mime_type, :idempotency_key
6
+ attr_reader :format, :quality, :max_width, :max_height, :max_dimension, :fit,
7
+ :lossless, :strip_metadata, :filename, :mime_type, :content_type, :idempotency_key
8
8
 
9
9
  def initialize(
10
10
  format: "auto",
11
11
  quality: 80,
12
12
  max_width: nil,
13
13
  max_height: nil,
14
+ max_dimension: nil,
14
15
  fit: "cover",
15
16
  lossless: false,
16
17
  strip_metadata: true,
17
18
  filename: nil,
18
19
  mime_type: nil,
20
+ content_type: nil,
19
21
  idempotency_key: nil
20
22
  )
21
23
  @format = format.to_s
22
24
  @quality = quality&.clamp(1, 100)
23
25
  @max_width = max_width
24
26
  @max_height = max_height
27
+ @max_dimension = max_dimension
25
28
  @fit = fit.to_s
26
29
  @lossless = lossless
27
30
  @strip_metadata = strip_metadata
28
31
  @filename = filename
29
- @mime_type = mime_type
32
+ @mime_type = mime_type || content_type
33
+ @content_type = content_type || mime_type
30
34
  @idempotency_key = idempotency_key
31
35
  end
32
36
 
@@ -36,6 +40,7 @@ module SmallPict
36
40
  quality: @quality,
37
41
  max_width: @max_width,
38
42
  max_height: @max_height,
43
+ max_dimension: @max_dimension,
39
44
  fit: @fit,
40
45
  lossless: @lossless,
41
46
  strip_metadata: @strip_metadata
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmallPict
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.5"
5
5
  end
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.2
4
+ version: 0.0.5
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-09-06 00:00:00.000000000 Z
11
+ date: 2026-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -119,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 3.0.0
122
+ version: 3.2.0
123
123
  required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  requirements:
125
125
  - - ">="