taskmapper-zendesk 0.5.1 → 0.6.0
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.
- data/VERSION +1 -1
- data/lib/provider/project.rb +1 -1
- data/lib/provider/ticket.rb +8 -0
- data/lib/zendesk/zendesk-api.rb +0 -2
- data/spec/tickets_spec.rb +27 -12
- data/taskmapper-zendesk.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/lib/provider/project.rb
CHANGED
data/lib/provider/ticket.rb
CHANGED
@@ -53,6 +53,10 @@ module TaskMapper::Provider
|
|
53
53
|
search_by_attribute(self.search(project_id), attributes)
|
54
54
|
end
|
55
55
|
|
56
|
+
def create(options)
|
57
|
+
super translate options, {:title => :description}
|
58
|
+
end
|
59
|
+
|
56
60
|
private
|
57
61
|
def requestor(ticket)
|
58
62
|
USER_API.find(ticket.requester_id).email
|
@@ -65,6 +69,10 @@ module TaskMapper::Provider
|
|
65
69
|
def zendesk_ticket(ticket_id)
|
66
70
|
API.find ticket_id
|
67
71
|
end
|
72
|
+
|
73
|
+
def translate(hash, mapping)
|
74
|
+
Hash[hash.map { |k, v| [mapping[k] ||= k, v]}]
|
75
|
+
end
|
68
76
|
end
|
69
77
|
end
|
70
78
|
end
|
data/lib/zendesk/zendesk-api.rb
CHANGED
@@ -30,7 +30,6 @@ module ZendeskAPI
|
|
30
30
|
end
|
31
31
|
|
32
32
|
class Search < Base
|
33
|
-
|
34
33
|
def self.collection_path(prefix_options = {}, query_options = nil)
|
35
34
|
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
36
35
|
"#{prefix(prefix_options)}search.#{format.extension}#{query_string(query_options)}"
|
@@ -40,7 +39,6 @@ module ZendeskAPI
|
|
40
39
|
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
41
40
|
"#{prefix(prefix_options)}search.#{format.extension}#{query_string(query_options)}"
|
42
41
|
end
|
43
|
-
|
44
42
|
end
|
45
43
|
|
46
44
|
class Ticket < Base
|
data/spec/tickets_spec.rb
CHANGED
@@ -7,6 +7,7 @@ describe TaskMapper::Provider::Zendesk::Ticket do
|
|
7
7
|
let(:ticket_class) { TaskMapper::Provider::Zendesk::Ticket }
|
8
8
|
let(:project) { tm.project(project_id) }
|
9
9
|
let(:headers) { {'Authorization' => 'Basic cmFmYWVsQGh5YnJpZGdyb3VwLmNvbToxMjM0NTY=','Accept' => 'application/json'} }
|
10
|
+
let(:post_headers) { {'Authorization' => 'Basic cmFmYWVsQGh5YnJpZGdyb3VwLmNvbToxMjM0NTY=','Content-Type' => 'application/json'} }
|
10
11
|
|
11
12
|
describe "Retrieving tickets" do
|
12
13
|
before(:each) do
|
@@ -17,7 +18,7 @@ describe TaskMapper::Provider::Zendesk::Ticket do
|
|
17
18
|
mock.get '/api/v1/users/26220353.json', headers, fixture_for('users/55030073'), 200
|
18
19
|
end
|
19
20
|
end
|
20
|
-
|
21
|
+
|
21
22
|
context "when calling #tickets" do
|
22
23
|
subject { project.tickets }
|
23
24
|
it { should be_an_instance_of Array }
|
@@ -37,17 +38,31 @@ describe TaskMapper::Provider::Zendesk::Ticket do
|
|
37
38
|
end
|
38
39
|
|
39
40
|
describe "Retrieving a single ticket" do
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
41
|
+
context "when calling #ticket to a project instance" do
|
42
|
+
subject { project.ticket 1 }
|
43
|
+
it { should be_an_instance_of ticket_class }
|
44
|
+
it { subject.title.should == "Testing" }
|
45
|
+
end
|
46
|
+
|
47
|
+
context "when calling #ticket with a hash attribute" do
|
48
|
+
subject { project.ticket :id => 1 }
|
49
|
+
it { should be_an_instance_of ticket_class }
|
50
|
+
it { subject.title.should == "Testing" }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "Create and update" do
|
56
|
+
before(:each) do
|
57
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
58
|
+
mock.post '/api/v1/tickets.json', post_headers, fixture_for('ticket'), 201
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context "when #calling #ticket! to a project instance" do
|
63
|
+
subject { project.ticket! :title => 'Testing' }
|
64
|
+
it { should be_an_instance_of ticket_class }
|
65
|
+
it { subject.title.should == 'Testing' }
|
51
66
|
end
|
52
67
|
end
|
53
68
|
end
|
data/taskmapper-zendesk.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "taskmapper-zendesk"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rafael George"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-24"
|
13
13
|
s.description = "Allows taskmapper to interact with Your System."
|
14
14
|
s.email = "rafael@hybridgroup.com"
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taskmapper-zendesk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: taskmapper
|
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
segments:
|
166
166
|
- 0
|
167
|
-
hash: -
|
167
|
+
hash: -1035016497
|
168
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
169
|
none: false
|
170
170
|
requirements:
|