From 23379b5f58a1db116a12bf6ed4621866ae7b3656 Mon Sep 17 00:00:00 2001 From: Alex Gusev Date: Thu, 30 Apr 2026 18:01:58 +0600 Subject: [PATCH 1/3] Add Context7 configuration --- context7.json | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 context7.json diff --git a/context7.json b/context7.json new file mode 100644 index 0000000..dbca833 --- /dev/null +++ b/context7.json @@ -0,0 +1,69 @@ +{ + "$schema": "https://context7.com/schema/context7.json", + "projectTitle": "Uploadcare Ruby", + "description": "Ruby API client for Uploadcare uploads, file management, conversions, webhooks, add-ons, and signed CDN URLs.", + "url": "https://context7.com/uploadcare/uploadcare-ruby", + "public_key": "pk_WoigIc3LrHKMjLxnI0IA2", + "branch": "main", + "folders": [ + "lib", + "api_examples" + ], + "excludeFolders": [ + ".github", + "bin", + "spec", + "vendor", + "tmp", + "coverage", + "pkg", + "doc", + "*archive*", + "*archived*", + "old", + "docs/old", + "*deprecated*", + "*legacy*", + "*previous*", + "*outdated*", + "*superseded*" + ], + "excludeFiles": [ + "CHANGELOG.md", + "changelog.md", + "CHANGELOG.mdx", + "changelog.mdx", + "LICENSE", + "LICENSE.md", + "license.md", + "CODE_OF_CONDUCT.md", + "code_of_conduct.md", + "Gemfile", + "Rakefile", + "uploadcare-ruby.gemspec", + ".rspec", + ".rubocop.yml", + ".yardopts" + ], + "rules": [ + "Install the gem as `uploadcare-ruby` and require it with `require \"uploadcare\"`.", + "Configure credentials with `Uploadcare.config.public_key` and `Uploadcare.config.secret_key` or the UPLOADCARE_PUBLIC_KEY and UPLOADCARE_SECRET_KEY environment variables.", + "Never hardcode real Uploadcare API keys in examples or application code; use environment variables or an application secrets store.", + "Use `Uploadcare::Uploader.upload` for automatic upload method selection and `Uploadcare::Uploader.multipart_upload` for explicit large-file multipart uploads.", + "Prefer public entity helpers such as `Uploadcare::File`, `Uploadcare::FileList`, `Uploadcare::Group`, `Uploadcare::Webhook`, and conversion methods over internal clients." + ], + "previousVersions": [ + { + "tag": "v4.4.3" + }, + { + "tag": "v3.3.2" + }, + { + "tag": "v2.1.2" + }, + { + "tag": "v1.2.2" + } + ] +} From c39b82cd431f88b3f4673f54fa66772a13402b1d Mon Sep 17 00:00:00 2001 From: Alex Gusev Date: Fri, 1 May 2026 13:21:29 +0600 Subject: [PATCH 2/3] Fix file handling style --- api_examples/upload_api/post_base.rb | 5 +++-- api_examples/upload_api/post_multipart_complete.rb | 5 +++-- api_examples/upload_api/post_multipart_start.rb | 5 +++-- api_examples/upload_api/put_presigned_url_x.rb | 5 +++-- spec/support/generate_file_fixtures.rb | 10 ++++++---- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/api_examples/upload_api/post_base.rb b/api_examples/upload_api/post_base.rb index 20b10b3..b949466 100644 --- a/api_examples/upload_api/post_base.rb +++ b/api_examples/upload_api/post_base.rb @@ -2,5 +2,6 @@ Uploadcare.config.public_key = 'YOUR_PUBLIC_KEY' Uploadcare.config.secret_key = 'YOUR_SECRET_KEY' -source_file = File.open('image.png') -Uploadcare::Uploader.upload(source_file, store: 'auto') +File.open('image.png') do |source_file| + Uploadcare::Uploader.upload(source_file, store: 'auto') +end diff --git a/api_examples/upload_api/post_multipart_complete.rb b/api_examples/upload_api/post_multipart_complete.rb index 0978956..f431eb6 100644 --- a/api_examples/upload_api/post_multipart_complete.rb +++ b/api_examples/upload_api/post_multipart_complete.rb @@ -4,5 +4,6 @@ Uploadcare.config.public_key = 'YOUR_PUBLIC_KEY' Uploadcare.config.secret_key = 'YOUR_SECRET_KEY' -source_file = File.open('image.png') -Uploadcare::Uploader.upload(source_file, store: 'auto') +File.open('image.png') do |source_file| + Uploadcare::Uploader.upload(source_file, store: 'auto') +end diff --git a/api_examples/upload_api/post_multipart_start.rb b/api_examples/upload_api/post_multipart_start.rb index 0978956..f431eb6 100644 --- a/api_examples/upload_api/post_multipart_start.rb +++ b/api_examples/upload_api/post_multipart_start.rb @@ -4,5 +4,6 @@ Uploadcare.config.public_key = 'YOUR_PUBLIC_KEY' Uploadcare.config.secret_key = 'YOUR_SECRET_KEY' -source_file = File.open('image.png') -Uploadcare::Uploader.upload(source_file, store: 'auto') +File.open('image.png') do |source_file| + Uploadcare::Uploader.upload(source_file, store: 'auto') +end diff --git a/api_examples/upload_api/put_presigned_url_x.rb b/api_examples/upload_api/put_presigned_url_x.rb index 0978956..f431eb6 100644 --- a/api_examples/upload_api/put_presigned_url_x.rb +++ b/api_examples/upload_api/put_presigned_url_x.rb @@ -4,5 +4,6 @@ Uploadcare.config.public_key = 'YOUR_PUBLIC_KEY' Uploadcare.config.secret_key = 'YOUR_SECRET_KEY' -source_file = File.open('image.png') -Uploadcare::Uploader.upload(source_file, store: 'auto') +File.open('image.png') do |source_file| + Uploadcare::Uploader.upload(source_file, store: 'auto') +end diff --git a/spec/support/generate_file_fixtures.rb b/spec/support/generate_file_fixtures.rb index 7cb4e3f..43dc982 100644 --- a/spec/support/generate_file_fixtures.rb +++ b/spec/support/generate_file_fixtures.rb @@ -12,8 +12,10 @@ def generate_big_file return if File.file?('spec/fixtures/big.jpeg') FileUtils.cp('spec/fixtures/kitten.jpeg', 'spec/fixtures/big.jpeg') - source_file = File.open('spec/fixtures/kitten.jpeg') - destination = File.open('spec/fixtures/big.jpeg', 'w') - destination.write(source_file.read) - destination.write('a' * 10 * 1024 * 1024) + File.open('spec/fixtures/kitten.jpeg') do |source_file| + File.open('spec/fixtures/big.jpeg', 'w') do |destination| + destination.write(source_file.read) + destination.write('a' * 10 * 1024 * 1024) + end + end end From cedea5b0de9f0d8e57de1817756cebf571c71567 Mon Sep 17 00:00:00 2001 From: Alex Gusev Date: Fri, 1 May 2026 13:23:31 +0600 Subject: [PATCH 3/3] Fix query parsing spec --- spec/uploadcare/entity/decorator/paginator_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/uploadcare/entity/decorator/paginator_spec.rb b/spec/uploadcare/entity/decorator/paginator_spec.rb index 281ef4b..72be90b 100644 --- a/spec/uploadcare/entity/decorator/paginator_spec.rb +++ b/spec/uploadcare/entity/decorator/paginator_spec.rb @@ -36,7 +36,9 @@ module Decorator fl_path = fl_with_params.delete(:next) previous_page_path = previous_page.delete(:next) expect(fl_with_params).to eq(previous_page) - expect(CGI.parse(URI.parse(fl_path).query)).to eq(CGI.parse(URI.parse(previous_page_path).query)) + fl_query = URI.decode_www_form(URI.parse(fl_path).query).sort + previous_page_query = URI.decode_www_form(URI.parse(previous_page_path).query).sort + expect(fl_query).to eq(previous_page_query) end end end