Skip to content

Commit 354b081

Browse files
committed
update readme
1 parent 57947b6 commit 354b081

File tree

1 file changed

+92
-53
lines changed

1 file changed

+92
-53
lines changed

README.md

Lines changed: 92 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ Get image url:
110110
# To get the original image url, use
111111
@employee.avatar.url
112112

113+
# To get the file metadata
114+
@employee.avatar.metadata
115+
116+
113117
# And to get transformed url use
114118
# options is a transformation options
115119
@employee.avatar.url_with(options)
@@ -387,26 +391,35 @@ in the [documentation here](https://docs.imagekit.io/api-reference/media-api/lis
387391
correct values to get the results.
388392

389393
```ruby
390-
imagekitio.list_files({skip: 0, limit: 5})
394+
imagekitio.list_files(
395+
skip: 0,
396+
limit: 5
397+
)
391398
```
392399
**2. Get File Details**
393400
Accepts the file ID and fetches the details as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/get-file-details)
394401

395402
```ruby
396-
imagekitio.get_file_details(file_id: 'file_id_xyz')
403+
imagekitio.get_file_details(
404+
file_id: '598821f949c0a938d57563bd'
405+
)
397406
```
398407

399408
**3. Get File Metadata**
400409
Accepts the file ID and fetches the metadata as per the [API documentation here](https://docs.imagekit.io/api-reference/metadata-api/get-image-metadata-for-uploaded-media-files)
401410
```ruby
402-
imagekit.get_file_metadata(file_id: 'file_id_xyz')
411+
imagekit.get_file_metadata(
412+
file_id: '598821f949c0a938d57563bd'
413+
)
403414
```
404415

405416
**3. Get File Metadata from remote url**
406417
Accepts the remote file url and fetches the metadata as per the [API documentation here](https://docs.imagekit.io/api-reference/metadata-api/get-image-metadata-from-remote-url)
407418

408419
```ruby
409-
imagekit.get_remote_file_url_metadata(remote_file_url: "https://ik.imagekit.io/demo/tr:w-100/default-image.jpg")
420+
imagekit.get_remote_file_url_metadata(
421+
remote_file_url: "https://ik.imagekit.io/demo/tr:w-100/default-image.jpg"
422+
)
410423
```
411424

412425
**4. Update File Details**
@@ -427,15 +440,21 @@ imagekitio.update_file_details(
427440
Copy file from one path to another path using the source file path and the destination path as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-file)
428441

429442
```ruby
430-
imagekitio.copy_file(source_file_path: '/path/to/file.jpg', destination_path: '/folder/to/copy/into')
443+
imagekitio.copy_file(
444+
source_file_path: '/path/to/file.jpg',
445+
destination_path: '/folder/to/copy/into'
446+
)
431447
```
432448

433449
**6. Move File**
434450

435451
Move file from one folder to another folder using the source file path and destination path as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/move-file)
436452

437453
```ruby
438-
imagekitio.move_file(source_file_path: '/path/to/file.jpg', destination_path: '/folder/to/move/into/')
454+
imagekitio.move_file(
455+
source_file_path: '/path/to/file.jpg',
456+
destination_path: '/folder/to/move/into/'
457+
)
439458
```
440459

441460
**7. Rename File**
@@ -444,125 +463,139 @@ Rename file as per the [API documentation here](https://docs.imagekit.io/api-ref
444463

445464
```ruby
446465
imagekitio.rename_file(
447-
file_path: '/path/to/old-file-name.jpg',
448-
new_file_name: 'new-file-name.jpg',
449-
purge_cache: true #optional
466+
file_path: '/path/to/old-file-name.jpg',
467+
new_file_name: 'new-file-name.jpg',
468+
purge_cache: true #optional
450469
)
451470
```
452471

453472
**8. Delete file**
454473
Delete a file as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-file). The method accepts the file ID of the file that has to be deleted.
455474

456475
```ruby
457-
imagekitio.delete_file(file_id: file_id)
476+
imagekitio.delete_file(
477+
file_id: '598821f949c0a938d57563bd'
478+
)
458479
```
459480

460481
**9. Bulk File Delete by IDs**
461482
Delete a file as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-files-bulk). The method accepts a list of file IDs of files that has to be
462483
deleted.
463484

464485
```ruby
465-
imagekitio.delete_bulk_files(file_ids: ["file_id1", "file_id2"])
486+
imagekitio.delete_bulk_files(
487+
file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57543bd"]
488+
)
466489
```
467490

468491
**10. Purge Cache**
469492
Programmatically issue a cache clear request as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/purge-cache).
470493
Accepts the full URL of the file for which the cache has to be cleared.
471494

472495
```ruby
473-
imagekitio.purge_file_cache(file_url: 'https://ik.imagekit.io/demo/logo-white_SJwqB4Nfe.png')
496+
imagekitio.purge_file_cache(
497+
file_url: 'https://ik.imagekit.io/demo/logo-white_SJwqB4Nfe.png'
498+
)
474499
```
475500
**11. Purge Cache Status**
476501

477502
Get the purge cache request status using the request ID returned when a purge cache request gets submitted as per the
478503
[API documentation here](https://docs.imagekit.io/api-reference/media-api/purge-cache-status)
479504

480505
```ruby
481-
imagekitio.purge_file_cache_status(request_id: cache_request_id)
482-
```
483-
484-
**12. Stream Large File**
485-
486-
Stream large size file using the file url and the block to evaluate on each chunk of response data.
487-
(supported on active_storage)
488-
489-
```ruby
490-
blob_record = employee.avatar.blob
491-
temp_file = Tempfile.new(['downloaded_file.png', '.png'], binmode: true)
492-
blob_record.service.download(blob_record.key) do |chunk|
493-
temp_file.write(chunk)
494-
end
506+
imagekitio.purge_file_cache_status(
507+
request_id: '598821f949c0a938d57543bd'
508+
)
495509
```
496510

497-
**13. Add Bulk Tags**
511+
**12. Add Bulk Tags**
498512

499513
Add multiple tags on multiple files using array of file ids and array of tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/add-tags-bulk)
500514

501515
```ruby
502-
imagekitio.add_bulk_tags(file_ids: ['id_1', 'id_2'], tags: ['custom_tags', 'image', 'favourite'])
516+
imagekitio.add_bulk_tags(
517+
file_ids: ['598821f949c0a938d57543bd', '598921f949c0a938d57543bd'],
518+
tags: ['custom_tags', 'image', 'favourite']
519+
)
503520
```
504521

505-
**14. Delete Bulk Tags**
522+
**13. Delete Bulk Tags**
506523

507524
Remove multiple tags from multiple files using array of file ids and array of tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/remove-tags-bulk)
508525

509526
```ruby
510-
imagekitio.delete_bulk_tags(file_ids: ['id_1', 'id_2'], tags: ['custom_tags', 'image'])
527+
imagekitio.delete_bulk_tags(
528+
file_ids: ['598821f949c0a938d57543bd', '598921f949c0a938d57543bd'],
529+
tags: ['custom_tags', 'image']
530+
)
511531
```
512532

513-
**15. Delete Bulk Ai Tags**
533+
**14. Delete Bulk Ai Tags**
514534

515535
Delete bulk ai tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/remove-aitags-bulk)
516536

517537
```ruby
518-
imagekitio.delete_bulk_ai_tags(file_ids: ['id_1', 'id_2'], ai_tags: ['custom_ai_tags'])
538+
imagekitio.delete_bulk_ai_tags(
539+
file_ids: ['598821f949c0a938d57543bd', '598921f949c0a938d57543bd'],
540+
ai_tags: ['custom_ai_tags']
541+
)
519542
```
520543

521-
**16. Create Folder**
544+
**15. Create Folder**
522545

523546
Create folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/create-folder)
524547

525548
```ruby
526549
imagekitio.create_folder(
527-
folder_name: 'new_folder',
528-
parent_folder_path: 'source/folder/path' #optional
550+
folder_name: 'new_folder',
551+
parent_folder_path: 'source/folder/path' #optional
529552
)
530553
```
531554

532555

533-
**17. Copy Folder**
556+
**16. Copy Folder**
534557

535558
Copy folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-folder)
536559

537560
```ruby
538-
imagekitio.copy_folder(source_folder_path: '/folder/to/copy', destination_path: '/folder/to/copy/into')
561+
imagekitio.copy_folder(
562+
source_folder_path: '/folder/to/copy',
563+
destination_path: '/folder/to/copy/into'
564+
)
539565
```
540566

541-
**18. Move Folder**
567+
**17. Move Folder**
542568

543569
Move folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/move-folder)
544570

545571
```ruby
546-
imagekitio.move_folder(source_folder_path: '/folder/to/move', destination_path: '/folder/to/move/into/')
572+
imagekitio.move_folder(
573+
source_folder_path: '/folder/to/move',
574+
destination_path: '/folder/to/move/into/'
575+
)
547576
```
548577

549-
**19. Delete Folder**
578+
**18. Delete Folder**
550579

551580
Delete folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-folder)
552581

553582
```ruby
554-
imagekitio.delete_folder(folder_path: 'folder/to/delete')
583+
imagekitio.delete_folder(
584+
folder_path: 'folder/to/delete'
585+
)
555586
```
556587

557-
**20. Bulk Job Status**
588+
**19. Bulk Job Status**
558589

559590
Get the bulk job status as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-move-folder-status)
560591

561592
```ruby
562-
imagekitio.bulk_job_status(job_id: 'job_id_xyz')
593+
imagekitio.bulk_job_status(
594+
job_id: '5e21880d5efe355febd4cccd'
595+
)
563596
```
564597

565-
**21. Create Custom Metadata Fields**
598+
**20. Create Custom Metadata Fields**
566599

567600
Create custom metadata fields as per the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/create-custom-metadata-field)
568601

@@ -572,37 +605,43 @@ imagekitio.create_custom_metadata_field(
572605
name: 'price',
573606
label: 'price_label',
574607
schema: {
575-
type: 'Number',
576-
minValue: 100,
577-
maxValue: 300
608+
'type': 'Number',
609+
'minValue': 100,
610+
'maxValue': 300
578611
}
579612
)
580613
```
581614

582-
**22. Get Custom Metadata Fields**
615+
**21. Get Custom Metadata Fields**
583616

584617
Get the custom metadata fields as per the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/get-custom-metadata-field)
585618

586619
```ruby
587620
imagekitio.get_custom_metadata_field(
588-
include_deleted: true #optional
621+
include_deleted: true #optional
589622
)
590623
```
591624

592-
**23. Update Custom Metadata Fields**
625+
**22. Update Custom Metadata Fields**
593626

594627
Update custom metadata fields as per the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/update-custom-metadata-field)
595628

596629
```ruby
597-
imagekitio.update_custom_metadata_field(id: 'file_id_xyz', label: 'custom-price', schema: nil)
630+
imagekitio.update_custom_metadata_field(
631+
id: '5e21880d5efe355febd4bccd', #field_id
632+
label: 'custom-price',
633+
schema: nil
634+
)
598635
```
599636

600-
**24. Delete Custom Metadata Fields**
637+
**23. Delete Custom Metadata Fields**
601638

602639
Delete custom metadata fields as per the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/delete-custom-metadata-field)
603640

604641
```ruby
605-
imagekitio.delete_custom_metadata_field(id: 'file_id_xyz')
642+
imagekitio.delete_custom_metadata_field(
643+
id: '5e21880d5efe355febd4bccd' #field_id
644+
)
606645
```
607646

608647

0 commit comments

Comments
 (0)