@@ -19,6 +19,7 @@ The gem is built around:
1919- full endpoint coverage through ` client.api.rest ` and ` client.api.upload `
2020
2121- [ Requirements] ( #requirements )
22+ - [ Compatibility] ( #compatibility )
2223- [ Installation] ( #installation )
2324- [ Design] ( #design )
2425- [ Quick Start] ( #quick-start )
@@ -27,10 +28,12 @@ The gem is built around:
2728- [ Uploads] ( #uploads )
2829- [ Files] ( #files )
2930- [ Groups] ( #groups )
31+ - [ Project] ( #project )
3032- [ Metadata] ( #metadata )
3133- [ Webhooks] ( #webhooks )
3234- [ Add-ons] ( #add-ons )
3335- [ Conversions] ( #conversions )
36+ - [ Secure Delivery] ( #secure-delivery )
3437- [ Errors and Results] ( #errors-and-results )
3538- [ Request Options] ( #request-options )
3639- [ Raw API Access] ( #raw-api-access )
@@ -41,6 +44,14 @@ The gem is built around:
4144
4245- Ruby 3.3+
4346
47+ ## Compatibility
48+
49+ This gem is intended for plain Ruby applications and for framework integrations built on top of it.
50+
51+ - Use explicit ` Uploadcare::Client ` instances when you need multiple accounts in one process.
52+ - Use ` Uploadcare.configure ` and ` Uploadcare.client ` when one global default client is enough.
53+ - Use ` client.api.rest ` and ` client.api.upload ` when you want endpoint-level parity with the official API references.
54+
4455## Installation
4556
4657Add the gem to your Gemfile:
125136
126137The recommended style is explicit ` Uploadcare::Client ` instances. Global configuration is best treated as a default.
127138
139+ ## Example Usage
140+
141+ This is the shortest end-to-end flow for the main public API:
142+
143+ ``` ruby
144+ require " uploadcare"
145+
146+ client = Uploadcare ::Client .new (
147+ public_key: ENV .fetch(" UPLOADCARE_PUBLIC_KEY" ),
148+ secret_key: ENV .fetch(" UPLOADCARE_SECRET_KEY" )
149+ )
150+
151+ file = File .open (" photo.jpg" , " rb" ) do |io |
152+ client.files.upload(io, store: true )
153+ end
154+
155+ group = client.groups.create(uuids: [file.uuid])
156+
157+ puts file.uuid
158+ puts file.cdn_url
159+ puts group.id
160+ puts group.cdn_url
161+ ```
162+
128163## Configuration
129164
130165Use ` Uploadcare.configure ` to set process-wide defaults:
@@ -306,6 +341,19 @@ Common upload options:
306341- ` async: true ` for URL uploads
307342- ` threads: ` and ` part_size: ` for multipart uploads
308343
344+ If you prefer the older top-level style, the same flows can still be written through the global client:
345+
346+ ``` ruby
347+ Uploadcare .configure do |config |
348+ config.public_key = ENV .fetch(" UPLOADCARE_PUBLIC_KEY" )
349+ config.secret_key = ENV .fetch(" UPLOADCARE_SECRET_KEY" )
350+ end
351+
352+ file = File .open (" photo.jpg" , " rb" ) do |io |
353+ Uploadcare .files.upload(io, store: true )
354+ end
355+ ```
356+
309357## Files
310358
311359### Find a file
@@ -329,6 +377,12 @@ files.previous_page
329377files.all
330378```
331379
380+ Filters and API parameters can still be passed through:
381+
382+ ``` ruby
383+ files = client.files.list(stored: true , removed: false , limit: 100 )
384+ ```
385+
332386### Resource operations
333387
334388``` ruby
@@ -392,6 +446,18 @@ group.cdn_url
392446group.file_cdn_urls
393447```
394448
449+ ## Project
450+
451+ Fetch the current project:
452+
453+ ``` ruby
454+ project = client.project.current
455+
456+ puts project.name
457+ puts project.pub_key
458+ puts project.collaborators
459+ ```
460+
395461## Metadata
396462
397463``` ruby
@@ -453,6 +519,26 @@ Document conversion `convert` returns the API response hash.
453519
454520Video conversion ` convert ` returns a ` Uploadcare::VideoConversion ` resource.
455521
522+ ## Secure Delivery
523+
524+ The gem includes signed URL generators for delivery workflows.
525+
526+ ``` ruby
527+ generator = Uploadcare ::SignedUrlGenerators ::AkamaiGenerator .new (
528+ cdn_host: " example.com" ,
529+ secret_key: " your_hex_encoded_akamai_secret"
530+ )
531+
532+ signed_url = generator.generate_url(" a7d5645e-5cd7-4046-819f-a6a2933bafe3" )
533+ ```
534+
535+ Custom ACL and wildcard examples:
536+
537+ ``` ruby
538+ generator.generate_url(" a7d5645e-5cd7-4046-819f-a6a2933bafe3" , " /*" )
539+ generator.generate_url(" a7d5645e-5cd7-4046-819f-a6a2933bafe3" , wildcard: true )
540+ ```
541+
456542## Errors and Results
457543
458544The convenience layer raises exceptions:
@@ -525,6 +611,8 @@ client.api.upload.groups.create(files: ["uuid-1", "uuid-2"])
525611
526612Use this layer when you want exact control over the documented endpoints or when you are wrapping the gem from another library.
527613
614+ The raw layer is part of the public surface, but it is intentionally less promoted than ` client.files ` , ` client.groups ` , and the other convenience accessors.
615+
528616## Examples
529617
530618- [ api_examples/README.md] ( ./api_examples/README.md ) : one canonical script per documented REST and Upload API endpoint
0 commit comments