zendesk_api 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +4 -4
- data/lib/zendesk_api/resources.rb +22 -0
- data/lib/zendesk_api/version.rb +1 -1
- data/spec/live/macro_spec.rb +37 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
zendesk_api (0.3.
|
10
|
+
zendesk_api (0.3.6)
|
11
11
|
faraday (>= 0.8.0)
|
12
12
|
faraday_middleware (>= 0.8.7)
|
13
13
|
hashie (>= 1.2)
|
@@ -55,13 +55,13 @@ GEM
|
|
55
55
|
fssm (0.2.10)
|
56
56
|
haml (4.0.1)
|
57
57
|
tilt
|
58
|
-
hashie (2.0.
|
58
|
+
hashie (2.0.4)
|
59
59
|
i18n (0.6.1)
|
60
60
|
inflection (1.0.0)
|
61
61
|
jruby-openssl (0.8.7)
|
62
62
|
bouncy-castle-java (>= 1.5.0147)
|
63
|
-
json (1.
|
64
|
-
mime-types (1.
|
63
|
+
json (1.8.0)
|
64
|
+
mime-types (1.23)
|
65
65
|
mongoid (3.1.2)
|
66
66
|
activemodel (~> 3.2)
|
67
67
|
moped (~> 1.4.2)
|
@@ -308,6 +308,28 @@ module ZendeskAPI
|
|
308
308
|
|
309
309
|
class Macro < Resource
|
310
310
|
has :execution, :class => RuleExecution
|
311
|
+
|
312
|
+
# Returns the update to a ticket that happens when a macro will be applied.
|
313
|
+
# @param [Ticket] ticket Optional {Ticket} to apply this macro to.
|
314
|
+
# @raise [Faraday::Error::ClientError] Raised for any non-200 response.
|
315
|
+
def apply!(ticket = nil)
|
316
|
+
path = "#{self.path}/apply"
|
317
|
+
|
318
|
+
if ticket
|
319
|
+
path = "#{ticket.path}/#{path}"
|
320
|
+
end
|
321
|
+
|
322
|
+
response = @client.connection.get(path)
|
323
|
+
Hashie::Mash.new(response.body.fetch("result", {}))
|
324
|
+
end
|
325
|
+
|
326
|
+
# Returns the update to a ticket that happens when a macro will be applied.
|
327
|
+
# @param [Ticket] ticket Optional {Ticket} to apply this macro to
|
328
|
+
def apply(ticket = nil)
|
329
|
+
apply!(ticket)
|
330
|
+
rescue Faraday::Error::ClientError => e
|
331
|
+
{}
|
332
|
+
end
|
311
333
|
end
|
312
334
|
|
313
335
|
class GroupMembership < Resource
|
data/lib/zendesk_api/version.rb
CHANGED
data/spec/live/macro_spec.rb
CHANGED
@@ -1,6 +1,42 @@
|
|
1
1
|
require 'core/spec_helper'
|
2
2
|
|
3
|
-
describe ZendeskAPI::Macro do
|
3
|
+
describe ZendeskAPI::Macro, :delete_after do
|
4
|
+
def valid_attributes
|
5
|
+
{ :title => "my test macro", :actions => [{ :field => "status", :value => "solved" }] }
|
6
|
+
end
|
7
|
+
|
4
8
|
it_should_be_readable :macros
|
5
9
|
it_should_be_readable :macros, :active
|
10
|
+
|
11
|
+
it_should_be_creatable
|
12
|
+
it_should_be_updatable :actions, [{ "field" => "priority", "value" => "low" }]
|
13
|
+
it_should_be_deletable
|
14
|
+
|
15
|
+
describe "application", :vcr do
|
16
|
+
subject do
|
17
|
+
VCR.use_cassette("#{described_class.to_s}_application_create") do
|
18
|
+
described_class.create(client, valid_attributes.merge(default_options))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
after :all do
|
23
|
+
VCR.use_cassette("#{described_class.to_s}_application_delete") do
|
24
|
+
subject.destroy
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "to a ticket" do
|
29
|
+
it "should return a hash" do
|
30
|
+
result = subject.apply(ticket)
|
31
|
+
result.should be_instance_of(Hashie::Mash)
|
32
|
+
result.ticket.should_not be_nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be appliable" do
|
37
|
+
result = subject.apply
|
38
|
+
result.should be_instance_of(Hashie::Mash)
|
39
|
+
result.ticket.should_not be_nil
|
40
|
+
end
|
41
|
+
end
|
6
42
|
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: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-05-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bump
|