breadbox 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6435d5e69be8cc0c607ee02870ca0ac0047c0af6
4
- data.tar.gz: af4357cdb609b50286839edf6456c3c3076fe6cb
3
+ metadata.gz: af6366ca6d82477de1f12bd73a9f73a5c365eedb
4
+ data.tar.gz: bfaa27461d1e9a566add2fba9620a1e5508d57e5
5
5
  SHA512:
6
- metadata.gz: 8f6bdd73f1a41c82203f7b89455e877adcb831ff1542058849ee4de387bd032fa18f5e379085cd7e33619b0ebc19b222bc55e624b0d03af48d3e6d9166c51d2d
7
- data.tar.gz: 11995b4e8b75155051980abbc89972407140a1821d66a7fdf52772c4998c5009034d8c13d8d6fa480c2631a7396460e80ee6b799b7aed78a782e24937ad77d33
6
+ metadata.gz: 423bd1ae34de4bd77727b7b730d9c6c1e7eaca6ce7fdeec42669d617abf7c6f7a086e91e6c9207fdf8870816357b90b5b0839a6fccdb71d0f084c751d73c1ce9
7
+ data.tar.gz: ed241327293a87d34209cdf6c1a1eb4102e8ae136f73c88f939df4d87649ba181380c2189b8b6464c9254ef6c82df03a448aae55284fff49588963e96bc814fa
data/README.md CHANGED
@@ -83,6 +83,8 @@ end
83
83
  folder `/`.
84
84
  - `file`: The file object that you are uploading, ex: `file = File.open('./path-to-local-file').
85
85
  - `cleanup`: defaults to `false`, but if you pass `true` - it will remove the local file after uploading.
86
+ - `public`: defaults to `false`. Pass `true` if you'd like to set the file permission level to world readable.
87
+ - `content_type`: S3 knows how to handle most file types, but occasionally, you may need to specify your own
86
88
 
87
89
  ```ruby
88
90
  # to upload a file to [Dropbox Folder or S3 Bucket]/uploads/my-cool-file.jpg
@@ -12,11 +12,12 @@ module Breadbox
12
12
  end
13
13
 
14
14
  def upload(options = {})
15
- path = options[:path]
16
- file = options[:file]
17
- acl = options[:public] ? :public_read : nil
15
+ path = options[:path]
16
+ file = options[:file]
17
+ acl = options[:public] ? :public_read : nil
18
+ content_type = options[:content_type]
18
19
  filepath = filepath_from_paths_and_file(root_path, path, file)[1..-1]
19
- result = s3_bucket_object.objects[filepath].write(file, acl: acl)
20
+ result = s3_bucket_object.objects[filepath].write(file, acl: acl, content_type: content_type)
20
21
 
21
22
  if result
22
23
  result.public_url.to_s
@@ -1,3 +1,3 @@
1
1
  module Breadbox
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -78,11 +78,19 @@ module Breadbox
78
78
 
79
79
  it "writes a file to an S3 Bucket Object" do
80
80
  file = File.open("./tmp/new-file.jpg")
81
- options = { acl: :public_read }
81
+ options = { acl: :public_read, content_type: nil }
82
82
  expect_any_instance_of(AWS::S3::S3Object).to receive(:write)
83
83
  .with(file, options)
84
84
  client.upload(path: "/", file: file, public: true)
85
85
  end
86
+
87
+ it "passes content-type parameter" do
88
+ file = File.open("./tmp/new-file.jpg")
89
+ options = { content_type: "image/jpeg", acl: nil }
90
+ expect_any_instance_of(AWS::S3::S3Object).to receive(:write)
91
+ .with(file, options)
92
+ client.upload(path: "/", file: file, content_type: "image/jpeg")
93
+ end
86
94
  end
87
95
  end
88
96
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breadbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Watts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-08 00:00:00.000000000 Z
11
+ date: 2015-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dropbox-sdk
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.2.2
147
+ rubygems_version: 2.4.5
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: An interface for uploading to Dropbox or Amazon S3.
@@ -156,4 +156,3 @@ test_files:
156
156
  - spec/breadbox/s3_client_spec.rb
157
157
  - spec/breadbox_spec.rb
158
158
  - spec/spec_helper.rb
159
- has_rdoc: