zendesk_api 1.3.0.rc2 → 1.3.0.rc3
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 +3 -3
- data/README.md +17 -9
- data/lib/zendesk_api/resources.rb +12 -3
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/live/app_spec.rb +31 -15
- data/zendesk_api.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0af96893eadf039d7ee2f55140c99a2ebb6493b
|
4
|
+
data.tar.gz: 3cece9eb1e9d0e1d6028741316148efd0d81aff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9a690f20225ad74dc19f0991786edef89b6fcfe721f81850897cca6d9b3b931f1d4c362c2baf26f81a9a21983db4f8479b239c7571999bc26e52cb0f2fc9b07
|
7
|
+
data.tar.gz: ca2b7c76939a390ae9d7ae464e8a5780e69a13afe42e219080444dc9f2f812d9db1b770832da1bc99869e01db02997c9029b6895448b29dcc5cfad1cd0b01831
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zendesk_api (1.3.0.
|
4
|
+
zendesk_api (1.3.0.rc3)
|
5
5
|
faraday (~> 0.9)
|
6
6
|
hashie (>= 1.2)
|
7
7
|
inflection
|
8
|
-
mime-types (~>
|
8
|
+
mime-types (~> 1.0)
|
9
9
|
multi_json
|
10
10
|
multipart-post (~> 2.0)
|
11
11
|
|
@@ -49,7 +49,7 @@ GEM
|
|
49
49
|
i18n (0.6.9)
|
50
50
|
inflection (1.0.0)
|
51
51
|
json (1.8.1)
|
52
|
-
mime-types (
|
52
|
+
mime-types (1.25.1)
|
53
53
|
mongoid (3.1.6)
|
54
54
|
activemodel (~> 3.2)
|
55
55
|
moped (~> 1.4)
|
data/README.md
CHANGED
@@ -204,7 +204,7 @@ Using side-loading, however, the user can be partially loaded in the same reques
|
|
204
204
|
|
205
205
|
```ruby
|
206
206
|
tickets = client.tickets.include(:users)
|
207
|
-
# Or client.tickets(include
|
207
|
+
# Or client.tickets(:include => :users)
|
208
208
|
# Does *NOT* make a request to the server since it is already loaded
|
209
209
|
tickets.first.requester # => #<ZendeskAPI::User id=...>
|
210
210
|
```
|
@@ -277,11 +277,11 @@ v1.1.0 introduces support for the Zendesk [Apps API](http://developer.zendesk.co
|
|
277
277
|
|
278
278
|
```ruby
|
279
279
|
upload = client.apps.uploads.create!(:file => "path/to/app.zip")
|
280
|
-
client.apps.create!(:name => "test", :
|
280
|
+
client.apps.create!(:name => "test", :upload_id => upload.id)
|
281
281
|
|
282
282
|
# Or
|
283
283
|
|
284
|
-
app = ZendeskAPI::App.new(client, :name => "test"
|
284
|
+
app = ZendeskAPI::App.new(client, :name => "test")
|
285
285
|
app.upload = "path/to/app.zip"
|
286
286
|
app.save!
|
287
287
|
|
@@ -291,12 +291,12 @@ upload = ZendeskAPI::App::Upload.new(client, :file => "path/to/app.zip")
|
|
291
291
|
upload.save!
|
292
292
|
|
293
293
|
app = ZendeskAPI::App.new(client, :name => "test")
|
294
|
-
app.short_description = "My test app"
|
295
294
|
app.upload_id = upload.id
|
296
295
|
app.save!
|
297
296
|
|
298
|
-
#
|
299
|
-
|
297
|
+
# Or
|
298
|
+
|
299
|
+
client.apps.create!(:name => "test", :upload => "app.zip")
|
300
300
|
```
|
301
301
|
|
302
302
|
*Note: job statuses are currently not supported, so you must manually poll the job status API for app creation.*
|
@@ -313,12 +313,20 @@ end
|
|
313
313
|
#### Updating Apps
|
314
314
|
|
315
315
|
```ruby
|
316
|
-
client.apps.
|
316
|
+
upload = client.apps.uploads.create!(:file => "NewApp.zip")
|
317
|
+
|
318
|
+
# Then
|
319
|
+
|
320
|
+
client.apps.update!(:id => 123, :upload_id => upload.id)
|
317
321
|
|
318
|
-
|
322
|
+
# Or
|
323
|
+
|
324
|
+
app = ZendeskAPI::App.new(client, :id => 123, :upload_id => upload.id)
|
319
325
|
app.save!
|
320
326
|
|
321
|
-
|
327
|
+
# Or
|
328
|
+
|
329
|
+
ZendeskAPI::App.update!(client, :id => 123, :upload_id => upload.id)
|
322
330
|
```
|
323
331
|
|
324
332
|
#### Deleting Apps
|
@@ -31,6 +31,7 @@ module ZendeskAPI
|
|
31
31
|
include Destroy
|
32
32
|
|
33
33
|
alias :name :id
|
34
|
+
alias :to_param :id
|
34
35
|
|
35
36
|
def path(opts = {})
|
36
37
|
raise "tags must have parent resource" unless association.options.parent
|
@@ -113,7 +114,7 @@ module ZendeskAPI
|
|
113
114
|
|
114
115
|
has_many Ticket
|
115
116
|
has_many User
|
116
|
-
has_many Tag, :extend => Tag::Update
|
117
|
+
has_many Tag, :extend => Tag::Update, :inline => :create
|
117
118
|
end
|
118
119
|
|
119
120
|
class ForumSubscription < Resource
|
@@ -169,7 +170,7 @@ module ZendeskAPI
|
|
169
170
|
has_many :comments, :class => TopicComment
|
170
171
|
has_many :subscriptions, :class => TopicSubscription
|
171
172
|
has :vote, :class => TopicVote
|
172
|
-
has_many Tag, :extend => Tag::Update
|
173
|
+
has_many Tag, :extend => Tag::Update, :inline => :create
|
173
174
|
|
174
175
|
def votes(opts = {})
|
175
176
|
return @votes if @votes && !opts[:reload]
|
@@ -322,7 +323,7 @@ module ZendeskAPI
|
|
322
323
|
has :last_comment, :class => Comment, :inline => true
|
323
324
|
has_many :last_comments, :class => Comment, :inline => true
|
324
325
|
|
325
|
-
has_many Tag, :extend => Tag::Update
|
326
|
+
has_many Tag, :extend => Tag::Update, :inline => :create
|
326
327
|
|
327
328
|
has_many :incidents, :class => Ticket
|
328
329
|
|
@@ -593,6 +594,14 @@ module ZendeskAPI
|
|
593
594
|
super
|
594
595
|
end
|
595
596
|
|
597
|
+
def self.create!(client, attributes = {}, &block)
|
598
|
+
if file_path = attributes.delete(:upload)
|
599
|
+
attributes[:upload_id] = client.apps.uploads.create!(:file => file_path).id
|
600
|
+
end
|
601
|
+
|
602
|
+
super
|
603
|
+
end
|
604
|
+
|
596
605
|
class Upload < Data
|
597
606
|
class << self
|
598
607
|
def resource_path
|
data/lib/zendesk_api/version.rb
CHANGED
data/spec/live/app_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'core/spec_helper'
|
2
2
|
|
3
3
|
describe ZendeskAPI::App do
|
4
|
-
it "should work
|
4
|
+
it "should work" do
|
5
5
|
upload = VCR.use_cassette("app_upload_create") do
|
6
6
|
ZendeskAPI::App::Upload.new(client, :id => "spec/fixtures/sample_app.zip").tap(&:save!)
|
7
7
|
end
|
@@ -12,20 +12,7 @@ describe ZendeskAPI::App do
|
|
12
12
|
|
13
13
|
VCR.use_cassette("app_create") { app.save! }
|
14
14
|
|
15
|
-
body =
|
16
|
-
|
17
|
-
VCR.use_cassette("app_create_job_status") do
|
18
|
-
until %w{failed completed}.include?(body["status"])
|
19
|
-
response = client.connection.get(app.response.headers["Location"])
|
20
|
-
body = response.body
|
21
|
-
|
22
|
-
sleep(3)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
if body["status"] == "failed"
|
27
|
-
fail "Could not create app: #{body.inspect}"
|
28
|
-
end
|
15
|
+
body = check_job(app)
|
29
16
|
|
30
17
|
app.id = body["app_id"]
|
31
18
|
app.author_name = "Mr. Sprinkles"
|
@@ -37,4 +24,33 @@ describe ZendeskAPI::App do
|
|
37
24
|
|
38
25
|
VCR.use_cassette("app_destroy") { app.destroy! }
|
39
26
|
end
|
27
|
+
|
28
|
+
it "should be able to handle the simplest creation api call" do
|
29
|
+
VCR.use_cassette("app_simple_create") do
|
30
|
+
app = ZendeskAPI::App.create!(client, { :name => "Testing App Creation", :upload => "spec/fixtures/sample_app.zip" })
|
31
|
+
|
32
|
+
check_job(app)
|
33
|
+
|
34
|
+
VCR.use_cassette("app_destroy") { app.destroy! }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def check_job(app)
|
40
|
+
body = {}
|
41
|
+
|
42
|
+
VCR.use_cassette("app_create_job_status") do
|
43
|
+
until %w{failed completed}.include?(body["status"])
|
44
|
+
response = client.connection.get(app.response.headers["Location"])
|
45
|
+
body = response.body
|
46
|
+
|
47
|
+
sleep(3)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
if body["status"] == "failed"
|
52
|
+
fail "Could not create app: #{body.inspect}"
|
53
|
+
end
|
54
|
+
|
55
|
+
body
|
40
56
|
end
|
data/zendesk_api.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_runtime_dependency "hashie", ">= 1.2"
|
33
33
|
s.add_runtime_dependency "inflection"
|
34
34
|
s.add_runtime_dependency "multi_json"
|
35
|
-
s.add_runtime_dependency "mime-types", "~>
|
35
|
+
s.add_runtime_dependency "mime-types", "~> 1.0"
|
36
36
|
s.add_runtime_dependency "multipart-post", "~> 2.0"
|
37
37
|
|
38
38
|
s.files = `git ls-files -x Gemfile.lock`.split("\n") rescue ''
|
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.0.
|
4
|
+
version: 1.3.0.rc3
|
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-02-
|
12
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bump
|
@@ -157,14 +157,14 @@ dependencies:
|
|
157
157
|
requirements:
|
158
158
|
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: '
|
160
|
+
version: '1.0'
|
161
161
|
type: :runtime
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: '
|
167
|
+
version: '1.0'
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: multipart-post
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|