@@ -529,7 +529,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
529529``` ruby
530530begin
531531 file = image_kit.files.upload(
532- file: StringIO . new ( " https://www.example.com/public-url .jpg" ),
532+ file: File .read( " /path/to/file .jpg" ),
533533 file_name: " file-name.jpg"
534534 )
535535rescue Imagekit ::Errors ::APIConnectionError => e
@@ -575,7 +575,7 @@ image_kit = Imagekit::Client.new(
575575
576576# Or, configure per-request:
577577image_kit.files.upload(
578- file: StringIO . new ( " https://www.example.com/public-url .jpg" ),
578+ file: File .read( " /path/to/file .jpg" ),
579579 file_name: " file-name.jpg" ,
580580 request_options: {max_retries: 5 }
581581)
@@ -593,7 +593,7 @@ image_kit = Imagekit::Client.new(
593593
594594# Or, configure per-request:
595595image_kit.files.upload(
596- file: StringIO . new ( " https://www.example.com/public-url .jpg" ),
596+ file: File .read( " /path/to/file .jpg" ),
597597 file_name: " file-name.jpg" ,
598598 request_options: {timeout: 5 }
599599)
@@ -628,7 +628,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
628628``` ruby
629629response =
630630 image_kit.files.upload(
631- file: StringIO . new ( " https://www.example.com/public-url .jpg" ),
631+ file: File .read( " /path/to/file .jpg" ),
632632 file_name: " file-name.jpg" ,
633633 request_options: {
634634 extra_query: {my_query_parameter: value},
@@ -676,7 +676,7 @@ You can provide typesafe request parameters like so:
676676
677677``` ruby
678678image_kit.files.upload(
679- file: StringIO . new ( " https://www.example.com/public-url .jpg" ),
679+ file: File .read( " /path/to/file .jpg" ),
680680 file_name: " file-name.jpg"
681681)
682682```
@@ -686,13 +686,13 @@ Or, equivalently:
686686``` ruby
687687# Hashes work, but are not typesafe:
688688image_kit.files.upload(
689- file: StringIO . new ( " https://www.example.com/public-url .jpg" ),
689+ file: File .read( " /path/to/file .jpg" ),
690690 file_name: " file-name.jpg"
691691)
692692
693693# You can also splat a full Params class:
694694params = Imagekit ::FileUploadParams .new (
695- file: StringIO . new ( " https://www.example.com/public-url .jpg" ),
695+ file: File .read( " /path/to/file .jpg" ),
696696 file_name: " file-name.jpg"
697697)
698698image_kit.files.upload(** params)
0 commit comments