zendesk_api 1.2.7 → 1.2.8

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
  SHA1:
3
- metadata.gz: b708ede7536d57bf478b3996a2fe60e120467cdf
4
- data.tar.gz: 41b1c164d771677c0fce17aa20ed777b171876a8
3
+ metadata.gz: e146239de70d0901e0639c008355d837f8bc03d6
4
+ data.tar.gz: 423b3b9ceda7c77bb7a96869d2c1637f413f280f
5
5
  SHA512:
6
- metadata.gz: 39907df667359d40f0cb235a24893997795858f927fb70418142eb4834cafa2ba76dffad2ec128fab7a31f943232b92a181c83303b7550320d3676041a6e5e9c
7
- data.tar.gz: 36b3afeeee9c2688016f15188d2a414c5915c3dc38fe60a01728718890c673981deeb4f93dfa4a51ba9f7bb72713314f3fffa3a6877d2dda738df804c3eba299
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.7)
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.0.5)
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 = MIME::Types.type_for(path).first || "application/octet-stream"
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
@@ -1,3 +1,3 @@
1
1
  module ZendeskAPI
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
@@ -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.7
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-03-28 00:00:00.000000000 Z
12
+ date: 2014-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bump