uploadfuse 0.1.0 → 0.1.2
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 +5 -1
- data/lib/upload_fuse/resources/uploads.rb +7 -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: 8caf6cc2be29bc81634fb8add567ba5afebfbe74e4b468998f102f155436d408
|
4
|
+
data.tar.gz: e4bb9bf565c4686631c614747112fa56fe530967996bbed4f3a3d02353754ce3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b99c4911e1110892fffcf4fde893a4ce259ff0d077c672ed2b78ac7b825fced67aceeb3a254330bd893aaced3ab0722f68477ffb5f5713286ca52ec19457f578
|
7
|
+
data.tar.gz: c5524c8c966beceecc789da825760e73f40d61bfa0a28c6b23c64c4a6c87ad126d7109a036870aaf93cb8f3c174d1de996751785b842b835b0b6426aed7424d5
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,12 +33,16 @@ 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
|
40
41
|
@client.uploads.create_from_url url: "https://files.deanpcmad.com/abc.jpg"
|
41
42
|
#=> #<UploadFuse::Upload token="5e85e4a8...
|
43
|
+
|
44
|
+
# Delete an Upload
|
45
|
+
@client.uploads.delete id: "abc123"
|
42
46
|
```
|
43
47
|
|
44
48
|
## Contributing
|
@@ -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?
|
@@ -27,5 +27,10 @@ module UploadFuse
|
|
27
27
|
Upload.new(response.body["data"]) if response.success?
|
28
28
|
end
|
29
29
|
|
30
|
+
def delete(id:)
|
31
|
+
response = delete_request("uploads/#{id}")
|
32
|
+
response.success?
|
33
|
+
end
|
34
|
+
|
30
35
|
end
|
31
36
|
end
|
data/lib/upload_fuse/version.rb
CHANGED