zendesk_api 1.2.7 → 1.2.8
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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/zendesk_api/middleware/request/upload.rb +2 -1
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/core/middleware/request/upload_spec.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e146239de70d0901e0639c008355d837f8bc03d6
|
4
|
+
data.tar.gz: 423b3b9ceda7c77bb7a96869d2c1637f413f280f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf95b0aeb33d7c20943d6a552d40ef441de14123c39727d838750d70a404a6b79a13c01725c8169b4dbddf86273a0f0670a1b3e37db0dc348db843bd9c6e8468
|
7
|
+
data.tar.gz: 5d1f6776c38ea889b645a0b8265a57f37dfd429a690bc97875a7bc7e5e73c8d96ac71520a79711614429e8cdc0a0700cd4a9ebe153bdc95bee1010bffbb95b1d
|
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
zendesk_api (1.2.
|
10
|
+
zendesk_api (1.2.8)
|
11
11
|
faraday (~> 0.8.0)
|
12
12
|
faraday_middleware (~> 0.8.7)
|
13
13
|
hashie (>= 1.2)
|
@@ -56,7 +56,7 @@ GEM
|
|
56
56
|
fssm (0.2.10)
|
57
57
|
haml (4.0.3)
|
58
58
|
tilt
|
59
|
-
hashie (2.
|
59
|
+
hashie (2.1.1)
|
60
60
|
i18n (0.6.1)
|
61
61
|
inflection (1.0.0)
|
62
62
|
jruby-openssl (0.8.8)
|
@@ -38,6 +38,7 @@ module ZendeskAPI
|
|
38
38
|
else
|
39
39
|
if defined?(ActionDispatch) && file.is_a?(ActionDispatch::Http::UploadedFile)
|
40
40
|
path = file.tempfile.path
|
41
|
+
mime_type = file.content_type
|
41
42
|
else
|
42
43
|
warn "WARNING: Passed invalid filename #{file} of type #{file.class} to upload"
|
43
44
|
end
|
@@ -49,7 +50,7 @@ module ZendeskAPI
|
|
49
50
|
hash = hash[key]
|
50
51
|
end
|
51
52
|
|
52
|
-
mime_type
|
53
|
+
mime_type ||= MIME::Types.type_for(path).first || "application/octet-stream"
|
53
54
|
|
54
55
|
hash[:filename] ||= if file.respond_to?(:original_filename)
|
55
56
|
file.original_filename
|
data/lib/zendesk_api/version.rb
CHANGED
@@ -10,7 +10,7 @@ describe ZendeskAPI::Middleware::Request::Upload do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should handle body with no file" do
|
13
|
-
subject.call(:body => {})[:body].should == {}
|
13
|
+
subject.call(:body => {})[:body].should == {}
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should handle invalid types" do
|
@@ -58,7 +58,7 @@ describe ZendeskAPI::Middleware::Request::Upload do
|
|
58
58
|
|
59
59
|
context "with an ActionDispatch::Http::UploadedFile" do
|
60
60
|
before(:each) do
|
61
|
-
@upload = ActionDispatch::Http::UploadedFile.new(:filename => "hello", :tempfile => Tempfile.new(File.basename(filename)))
|
61
|
+
@upload = ActionDispatch::Http::UploadedFile.new(:filename => "hello.jpg", :tempfile => Tempfile.new(File.basename(filename)))
|
62
62
|
@env = subject.call(:body => { :file => @upload })
|
63
63
|
end
|
64
64
|
|
@@ -73,6 +73,14 @@ describe ZendeskAPI::Middleware::Request::Upload do
|
|
73
73
|
it "should add filename if none exist" do
|
74
74
|
@env[:body][:filename].should == "hello"
|
75
75
|
end
|
76
|
+
|
77
|
+
context "when path does not resolve a mime_type" do
|
78
|
+
it "should use the content_type of ActionDispatch::Http::UploadedFile " do
|
79
|
+
@upload.tempfile.path = "XXX"
|
80
|
+
@env = subject.call(:body => { :file => @upload })
|
81
|
+
@env[:body][:uploaded_data][:content_type].should == "image/jpeg"
|
82
|
+
end
|
83
|
+
end
|
76
84
|
end
|
77
85
|
end
|
78
86
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Davidovitz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bump
|