@@ -33,10 +33,7 @@ image_kit = Imagekit::Client.new(
3333 password: ENV [" OPTIONAL_IMAGEKIT_IGNORES_THIS" ] # This is the default and can be omitted
3434)
3535
36- response = image_kit.files.upload(
37- file: StringIO .new (" https://www.example.com/public-url.jpg" ),
38- file_name: " file-name.jpg"
39- )
36+ response = image_kit.files.upload(file: " https://www.example.com/public-url.jpg" , file_name: " file-name.jpg" )
4037
4138puts (response.videoCodec)
4239```
@@ -69,10 +66,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
6966
7067``` ruby
7168begin
72- file = image_kit.files.upload(
73- file: StringIO .new (" https://www.example.com/public-url.jpg" ),
74- file_name: " file-name.jpg"
75- )
69+ file = image_kit.files.upload(file: " https://www.example.com/public-url.jpg" , file_name: " file-name.jpg" )
7670rescue Imagekit ::Errors ::APIConnectionError => e
7771 puts (" The server could not be reached" )
7872 puts (e.cause) # an underlying Exception, likely raised within `net/http`
@@ -116,7 +110,7 @@ image_kit = Imagekit::Client.new(
116110
117111# Or, configure per-request:
118112image_kit.files.upload(
119- file: StringIO . new ( " https://www.example.com/public-url.jpg" ) ,
113+ file: " https://www.example.com/public-url.jpg" ,
120114 file_name: " file-name.jpg" ,
121115 request_options: {max_retries: 5 }
122116)
@@ -134,7 +128,7 @@ image_kit = Imagekit::Client.new(
134128
135129# Or, configure per-request:
136130image_kit.files.upload(
137- file: StringIO . new ( " https://www.example.com/public-url.jpg" ) ,
131+ file: " https://www.example.com/public-url.jpg" ,
138132 file_name: " file-name.jpg" ,
139133 request_options: {timeout: 5 }
140134)
@@ -169,7 +163,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
169163``` ruby
170164response =
171165 image_kit.files.upload(
172- file: StringIO . new ( " https://www.example.com/public-url.jpg" ) ,
166+ file: " https://www.example.com/public-url.jpg" ,
173167 file_name: " file-name.jpg" ,
174168 request_options: {
175169 extra_query: {my_query_parameter: value},
@@ -216,26 +210,17 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
216210You can provide typesafe request parameters like so:
217211
218212``` ruby
219- image_kit.files.upload(
220- file: StringIO .new (" https://www.example.com/public-url.jpg" ),
221- file_name: " file-name.jpg"
222- )
213+ image_kit.files.upload(file: " https://www.example.com/public-url.jpg" , file_name: " file-name.jpg" )
223214```
224215
225216Or, equivalently:
226217
227218``` ruby
228219# Hashes work, but are not typesafe:
229- image_kit.files.upload(
230- file: StringIO .new (" https://www.example.com/public-url.jpg" ),
231- file_name: " file-name.jpg"
232- )
220+ image_kit.files.upload(file: " https://www.example.com/public-url.jpg" , file_name: " file-name.jpg" )
233221
234222# You can also splat a full Params class:
235- params = Imagekit ::FileUploadParams .new (
236- file: StringIO .new (" https://www.example.com/public-url.jpg" ),
237- file_name: " file-name.jpg"
238- )
223+ params = Imagekit ::FileUploadParams .new (file: " https://www.example.com/public-url.jpg" , file_name: " file-name.jpg" )
239224image_kit.files.upload(** params)
240225```
241226
0 commit comments