From b40651d252b5ced648764a438d0452ae625f4093 Mon Sep 17 00:00:00 2001 From: shuhei kaneko Date: Mon, 14 Aug 2023 13:25:06 +0900 Subject: [PATCH 1/6] Fix AVAILABLE_TYPES order --- lib/kinu/geometry.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kinu/geometry.rb b/lib/kinu/geometry.rb index f1415d8..a0e8923 100644 --- a/lib/kinu/geometry.rb +++ b/lib/kinu/geometry.rb @@ -5,14 +5,14 @@ class Geometry height: :h, quality: :q, crop: :c, - original: :o, - middle: :m, manual_crop: :mc, width_offset: :wo, height_offset: :ho, crop_width: :cw, crop_height: :ch, assumption_width: :aw, + original: :o, + middle: :m, }.freeze def initialize(options) From 75599efa9a5dc6689d97a86fbd805989cd08fcdf Mon Sep 17 00:00:00 2001 From: shuhei kaneko Date: Mon, 14 Aug 2023 14:27:56 +0900 Subject: [PATCH 2/6] Bump version --- lib/kinu/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kinu/version.rb b/lib/kinu/version.rb index f56f7fb..dfae2a3 100644 --- a/lib/kinu/version.rb +++ b/lib/kinu/version.rb @@ -1,3 +1,3 @@ module Kinu - VERSION = "2.0.1" + VERSION = "2.0.2" end From 6d8ac84b9a952f63f995820ab7b97c33958d861d Mon Sep 17 00:00:00 2001 From: shuhei kaneko Date: Tue, 15 Aug 2023 16:02:41 +0900 Subject: [PATCH 3/6] Add specs for manual crop option --- spec/kinu/resource_base_spec.rb | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/spec/kinu/resource_base_spec.rb b/spec/kinu/resource_base_spec.rb index 20fb0d5..a8abf3c 100644 --- a/spec/kinu/resource_base_spec.rb +++ b/spec/kinu/resource_base_spec.rb @@ -57,6 +57,62 @@ module Kinu end end + context 'with manual crop option' do + let(:height) { 100 } + let(:width) { 100 } + let(:width_offset) { 10 } + let(:height_offset) { 10 } + let(:crop_width) { 80 } + let(:crop_height) { 80 } + let(:assumption_width) { 100 } + let(:geometry) do + { + width: width, + height: height, + width_offset: width_offset, + height_offset: height_offset, + crop_width: crop_width, + crop_height: crop_height, + assumption_width: assumption_width, + } + end + let(:uri) do + URI::HTTP.build( + host: hostname, + path: "/images/#{name}/w=#{width},h=#{height},wo=#{width_offset},ho=#{height_offset},cw=#{crop_width},ch=#{crop_height},aw=#{assumption_width}/#{id}.jpg" + ) + end + + it 'returns uri' do + is_expected.to eq(uri) + end + + context 'with original' do + let(:geometry) do + { + width: width, + height: height, + width_offset: width_offset, + height_offset: height_offset, + crop_width: crop_width, + crop_height: crop_height, + assumption_width: assumption_width, + original: true, + } + end + let(:uri) do + URI::HTTP.build( + host: hostname, + path: "/images/#{name}/w=#{width},h=#{height},wo=#{width_offset},ho=#{height_offset},cw=#{crop_width},ch=#{crop_height},aw=#{assumption_width},o=true/#{id}.jpg" + ) + end + + it 'returns uri' do + is_expected.to eq(uri) + end + end + end + context 'with middle' do let(:geometry) { { middle: true } } let(:uri) { URI::HTTP.build(host: hostname, path: "/images/#{name}/m=true/#{id}.jpg") } From 46b5938ed7fbfbcfc96907a76b93f44a6df4b199 Mon Sep 17 00:00:00 2001 From: shuhei kaneko Date: Wed, 16 Aug 2023 17:50:52 +0900 Subject: [PATCH 4/6] Add release.yml --- .github/release.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..2effdb3 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,14 @@ +changelog: + categories: + - title: Added + labels: + - add + - title: Changed + labels: + - change + - title: Removed + labels: + - remove + - title: Others + labels: + - "*" From 590a3295120303e3ccc28aa51959910e567d3bbe Mon Sep 17 00:00:00 2001 From: shuhei kaneko Date: Wed, 6 Sep 2023 14:02:15 +0900 Subject: [PATCH 5/6] Add dependency --- kinu.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/kinu.gemspec b/kinu.gemspec index bf28344..36fe1a7 100644 --- a/kinu.gemspec +++ b/kinu.gemspec @@ -25,6 +25,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "faraday" + spec.add_dependency "faraday-multipart" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0" From eb49c36ad2450c61bd0ad5f6585579122d641f7a Mon Sep 17 00:00:00 2001 From: shuhei kaneko Date: Wed, 6 Sep 2023 14:02:45 +0900 Subject: [PATCH 6/6] Require faraday/multipart --- lib/kinu/http_client.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/kinu/http_client.rb b/lib/kinu/http_client.rb index 3aebae5..19443c6 100644 --- a/lib/kinu/http_client.rb +++ b/lib/kinu/http_client.rb @@ -1,4 +1,5 @@ require 'faraday' +require 'faraday/multipart' require 'kinu/errors' module Kinu