zendesk_api 1.3.4 → 1.3.5
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/resources.rb +34 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/live/topic_comment_spec.rb +16 -0
- data/spec/live/topic_spec.rb +18 -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: a38c30bb79c695637d397682d18f4bcad759e04a
|
4
|
+
data.tar.gz: 7a9c3754599b4326995b7b7567561f57b1ff3cce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6599cae801cf71f177e2b6110d6200a8dc623eae347bcea7341c0afdc1fd5c4e6686311645aeabe15ecffc6dc7ae0ee1503941571ef70321da5a4f7c69dc387
|
7
|
+
data.tar.gz: 63d41052bf169196d521f833295e5b6fd46a2f5253e53fa314133bc65e4502ff29ce7c2534854a92928f89acf2b5e6877953825fdd3ce545e2f81adca60aebee
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zendesk_api (1.3.
|
4
|
+
zendesk_api (1.3.5)
|
5
5
|
faraday (~> 0.9)
|
6
6
|
hashie (>= 1.2)
|
7
7
|
inflection
|
@@ -45,7 +45,7 @@ GEM
|
|
45
45
|
fssm (0.2.10)
|
46
46
|
haml (4.0.5)
|
47
47
|
tilt
|
48
|
-
hashie (2.0
|
48
|
+
hashie (2.1.0)
|
49
49
|
i18n (0.6.9)
|
50
50
|
inflection (1.0.0)
|
51
51
|
json (1.8.1)
|
@@ -153,6 +153,18 @@ module ZendeskAPI
|
|
153
153
|
include Create
|
154
154
|
include Update
|
155
155
|
include Destroy
|
156
|
+
|
157
|
+
def self.import!(client, attributes)
|
158
|
+
new(client, attributes).tap do |comment|
|
159
|
+
comment.save!(:path => 'import/' + comment.path)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
def self.import(client, attributes)
|
164
|
+
comment = new(client, attributes)
|
165
|
+
return unless comment.save(:path => 'import/' + comment.path)
|
166
|
+
comment
|
167
|
+
end
|
156
168
|
end
|
157
169
|
|
158
170
|
class TopicVote < SingularResource
|
@@ -178,6 +190,18 @@ module ZendeskAPI
|
|
178
190
|
association = ZendeskAPI::Association.new(:class => TopicVote, :parent => self, :path => 'votes')
|
179
191
|
@votes = ZendeskAPI::Collection.new(@client, TopicVote, opts.merge(:association => association))
|
180
192
|
end
|
193
|
+
|
194
|
+
def self.import!(client, attributes)
|
195
|
+
new(client, attributes).tap do |topic|
|
196
|
+
topic.save!(:path => "import/topics")
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def self.import(client, attributes)
|
201
|
+
topic = new(client, attributes)
|
202
|
+
return unless topic.save(:path => "import/topics")
|
203
|
+
topic
|
204
|
+
end
|
181
205
|
end
|
182
206
|
|
183
207
|
class Activity < Resource
|
@@ -336,6 +360,16 @@ module ZendeskAPI
|
|
336
360
|
ZendeskAPI::Collection.new(client, self, :path => "exports/tickets?start_time=#{start_time.to_i}")
|
337
361
|
end
|
338
362
|
|
363
|
+
# Imports a ticket through the imports/tickets endpoint using save!
|
364
|
+
# @param [Client] client The {Client} object to be used
|
365
|
+
# @param [Hash] attributes The attributes to create.
|
366
|
+
# @return [Ticket] Created object or nil
|
367
|
+
def self.import!(client, attributes)
|
368
|
+
new(client, attributes).tap do |ticket|
|
369
|
+
ticket.save!(:path => "imports/tickets")
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
339
373
|
# Imports a ticket through the imports/tickets endpoint
|
340
374
|
# @param [Client] client The {Client} object to be used
|
341
375
|
# @param [Hash] attributes The attributes to create.
|
data/lib/zendesk_api/version.rb
CHANGED
@@ -11,6 +11,22 @@ describe ZendeskAPI::Topic::TopicComment do
|
|
11
11
|
it_should_be_deletable
|
12
12
|
it_should_be_readable topic, :comments
|
13
13
|
end
|
14
|
+
|
15
|
+
describe ".import" do
|
16
|
+
it "can import" do
|
17
|
+
VCR.use_cassette("topic_comment_import_can_import") do
|
18
|
+
old = Time.now - 4*365*24*60*60
|
19
|
+
comment = ZendeskAPI::Topic::TopicComment.import(client, valid_attributes.merge(:created_at => old, :topic_id => topic.id))
|
20
|
+
ZendeskAPI::Topic::TopicComment.find(client, comment).created_at.year.should == old.year
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns nothing if import fails" do
|
25
|
+
VCR.use_cassette("topic_comment_import_cannot_import") do
|
26
|
+
silence_logger { ZendeskAPI::Topic::TopicComment.import(client, {}).should == nil }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
14
30
|
end
|
15
31
|
|
16
32
|
describe ZendeskAPI::User::TopicComment do
|
data/spec/live/topic_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'core/spec_helper'
|
|
2
2
|
|
3
3
|
describe ZendeskAPI::Topic do
|
4
4
|
def valid_attributes
|
5
|
-
{
|
5
|
+
{
|
6
6
|
:forum_id => forum.id, :title => "My Topic",
|
7
7
|
:body => "The mayan calendar ends December 31st. Coincidence? I think not."
|
8
8
|
}
|
@@ -14,5 +14,21 @@ describe ZendeskAPI::Topic do
|
|
14
14
|
it_should_be_readable :topics
|
15
15
|
it_should_be_readable current_user, :topics
|
16
16
|
it_should_be_readable forum, :topics
|
17
|
-
#it_should_be_readable :topics, :show_many, :verb => :post, :ids =>
|
17
|
+
#it_should_be_readable :topics, :show_many, :verb => :post, :ids =>
|
18
|
+
|
19
|
+
describe ".import" do
|
20
|
+
it "can import" do
|
21
|
+
VCR.use_cassette("topic_import_can_import") do
|
22
|
+
old = Time.now - 5*365*24*60*60
|
23
|
+
topic = ZendeskAPI::Topic.import(client, valid_attributes.merge(:created_at => old))
|
24
|
+
ZendeskAPI::Topic.find(client, topic).created_at.year.should == old.year
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns nothing if import fails" do
|
29
|
+
VCR.use_cassette("topic_import_cannot_import") do
|
30
|
+
silence_logger { ZendeskAPI::Topic.import(client, {}).should == nil }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
18
34
|
end
|
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.5
|
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-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bump
|