zendesk_api 1.3.2 → 1.3.4
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 +6 -6
- data/lib/zendesk_api/middleware/request/upload.rb +2 -1
- data/lib/zendesk_api/resources.rb +8 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/core/client_spec.rb +3 -1
- data/spec/core/middleware/request/upload_spec.rb +10 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f96cd9aa680347c9634cc608bc65f7affac55544
|
4
|
+
data.tar.gz: 0e5fafac15dbfe359c94b57ee2f124ae6795dd39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0140e3e10c944a83b1edd18c2b11283d80dbbc23f6e45be3697d0cf480fd8bf8349b79e4394873091ae44e742436954817bba12c3ef41768d8b28a0c1371413
|
7
|
+
data.tar.gz: 9c32f20050b1d1d2b1531abb11cd52d9f197be15bd6a17c97598bd38721bbbce97faac675fa66cb233373ee6c672d4faea0a9fe19576f9655619ecb06025b4f9
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -344,12 +344,12 @@ ZendeskAPI::App.destroy!(client, :id => 123)
|
|
344
344
|
#### Installing an App
|
345
345
|
|
346
346
|
```ruby
|
347
|
-
install = ZendeskAPI::
|
347
|
+
install = ZendeskAPI::AppInstallation.new(client, :app_id => 123)
|
348
348
|
install.save!
|
349
349
|
|
350
350
|
client.apps.installations.create!(:app_id => 123)
|
351
351
|
|
352
|
-
ZendeskAPI::
|
352
|
+
ZendeskAPI::AppInstallation.create!(client, :app_id => 123)
|
353
353
|
```
|
354
354
|
|
355
355
|
#### List Installations
|
@@ -364,11 +364,11 @@ apps.fetch!
|
|
364
364
|
```ruby
|
365
365
|
client.app.installations.update!(:id => 123, :settings => { :title => "My New Name" })
|
366
366
|
|
367
|
-
install = ZendeskAPI::
|
367
|
+
install = ZendeskAPI::AppInstallation.new(client, :id => 123)
|
368
368
|
install.settings = { :title => "My New Name" }
|
369
369
|
install.save!
|
370
370
|
|
371
|
-
ZendeskAPI::
|
371
|
+
ZendeskAPI::AppInstallation.update!(client, :id => 123, :settings => { :title => "My New Name" })
|
372
372
|
```
|
373
373
|
|
374
374
|
#### Delete Installation
|
@@ -376,10 +376,10 @@ ZendeskAPI::App::Installation.update!(client, :id => 123, :settings => { :title
|
|
376
376
|
```ruby
|
377
377
|
client.app.installations.destroy!(:id => 123)
|
378
378
|
|
379
|
-
install = ZendeskAPI::
|
379
|
+
install = ZendeskAPI::AppInstallation.new(client, :id => 123)
|
380
380
|
install.destroy!
|
381
381
|
|
382
|
-
ZendeskAPI::
|
382
|
+
ZendeskAPI::AppInstallation.destroy!(client, :id => 123)
|
383
383
|
```
|
384
384
|
|
385
385
|
|
@@ -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
|
@@ -543,6 +543,14 @@ module ZendeskAPI
|
|
543
543
|
class PhoneNumber < Resource
|
544
544
|
namespace "channels/voice"
|
545
545
|
end
|
546
|
+
|
547
|
+
class Greeting < Resource
|
548
|
+
namespace "channels/voice"
|
549
|
+
end
|
550
|
+
|
551
|
+
class GreetingCategory < Resource
|
552
|
+
namespace "channels/voice"
|
553
|
+
end
|
546
554
|
end
|
547
555
|
|
548
556
|
class TicketForm < Resource
|
data/lib/zendesk_api/version.rb
CHANGED
data/spec/core/client_spec.rb
CHANGED
@@ -240,7 +240,9 @@ describe ZendeskAPI::Client do
|
|
240
240
|
end
|
241
241
|
|
242
242
|
it "manages namespace correctly" do
|
243
|
-
|
243
|
+
client.phone_numbers.path.should match(/channels\/voice\/phone_numbers/)
|
244
|
+
client.greetings.path.should match(/channels\/voice\/greetings/)
|
245
|
+
client.greeting_categories.path.should match(/channels\/voice\/greeting_categories/)
|
244
246
|
end
|
245
247
|
end
|
246
248
|
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.3.
|
4
|
+
version: 1.3.4
|
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-
|
12
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bump
|
@@ -511,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
511
511
|
version: 1.3.6
|
512
512
|
requirements: []
|
513
513
|
rubyforge_project:
|
514
|
-
rubygems_version: 2.2.
|
514
|
+
rubygems_version: 2.2.2
|
515
515
|
signing_key:
|
516
516
|
specification_version: 4
|
517
517
|
summary: Zendesk REST API Client
|