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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65382f39e78ba8480a5b5403c599633f9bf238a02580b3bbfb54514096295eb5
4
- data.tar.gz: 44b861f3e0769e731549ed3ca079d1708a086e83a592e73a3970da67308e2d41
3
+ metadata.gz: 8caf6cc2be29bc81634fb8add567ba5afebfbe74e4b468998f102f155436d408
4
+ data.tar.gz: e4bb9bf565c4686631c614747112fa56fe530967996bbed4f3a3d02353754ce3
5
5
  SHA512:
6
- metadata.gz: 9c112f7517c0ba60c48b76ca535d339f3e4fccff8a2d0012696d03616be5443239e1cc34ff7224f74b509b6b8e39dcb6eb9c870e741167be5e06fb80620bc531
7
- data.tar.gz: b5a8de54ea6f2e657dc05104d715b36353783ba15606b83eb9a1cc15fd8c7dd69821abf7118db4f39608e4c4401b1c528813b53c5975867e2162730fcadd4bba
6
+ metadata.gz: b99c4911e1110892fffcf4fde893a4ce259ff0d077c672ed2b78ac7b825fced67aceeb3a254330bd893aaced3ab0722f68477ffb5f5713286ca52ec19457f578
7
+ data.tar.gz: c5524c8c966beceecc789da825760e73f40d61bfa0a28c6b23c64c4a6c87ad126d7109a036870aaf93cb8f3c174d1de996751785b842b835b0b6426aed7424d5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- uploadfuse (0.1.0)
4
+ uploadfuse (0.1.2)
5
5
  faraday (~> 2.0)
6
6
  faraday-multipart (~> 1.0)
7
7
  marcel (~> 1.0)
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
- @client.uploads.create_from_file file: File.new("myfile.jpg")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UploadFuse
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uploadfuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry