uploadfuse 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/upload_fuse/resources/uploads.rb +2 -2
- data/lib/upload_fuse/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06bf922e554926e149b2820da83614ecdcfca08775e9b1940fe8e71d8e5e4bf1
|
4
|
+
data.tar.gz: ba351c55d59d32c320abb6dd0819360d28e77222af54696b0b1b575fbaea1eed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8469ea05b071a0b36af9cd27fcce51da6473a3096bc5288ca552fc5dcf09e87de00e850852009b64c30932e9b8742be2a1ad8f2e41dbd6bb62e761339f487cc6
|
7
|
+
data.tar.gz: 51e7aafba095e003bd0b6d197a7629b0072807ed2bb68ce612f73b45035156bc038f35a6cd7402936a23fe95a5d751ad346b5312f8e9b3585e484072f73783b2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,7 +33,8 @@ Firstly you'll need to create an API Access Token on your bucket page.
|
|
33
33
|
#=> #<UploadFuse::Upload token="abc123fb...
|
34
34
|
|
35
35
|
# Upload a file
|
36
|
-
|
36
|
+
# file_name is optional
|
37
|
+
@client.uploads.create_from_file file: File.new("myfile.jpg"), file_name: "other-file-name.jpg"
|
37
38
|
#=> #<UploadFuse::Upload token="63a3f8fb...
|
38
39
|
|
39
40
|
# Upload a file from a URL
|
@@ -11,12 +11,12 @@ module UploadFuse
|
|
11
11
|
Upload.new(response.body["data"]) if response.success?
|
12
12
|
end
|
13
13
|
|
14
|
-
def create_from_file(file:)
|
14
|
+
def create_from_file(file:, file_name: nil)
|
15
15
|
content_type = Marcel::MimeType.for file
|
16
16
|
|
17
17
|
# This method uses Faraday Multipart (lostisland/faraday-multipart)
|
18
18
|
payload = {}
|
19
|
-
payload[:file] = Faraday::Multipart::FilePart.new(file, content_type)
|
19
|
+
payload[:file] = Faraday::Multipart::FilePart.new(file, content_type, file_name)
|
20
20
|
|
21
21
|
response = client.connection_upload.post "uploads", payload
|
22
22
|
Upload.new(JSON.parse(response.body)["data"]) if response.success?
|
data/lib/upload_fuse/version.rb
CHANGED