ticketmaster-zendesk 0.0.2 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/provider/comment.rb +16 -15
- data/lib/provider/project.rb +1 -7
- data/lib/provider/ticket.rb +17 -34
- data/ticketmaster-zendesk.gemspec +3 -3
- metadata +5 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.2
|
data/lib/provider/comment.rb
CHANGED
@@ -9,6 +9,7 @@ module TicketMaster::Provider
|
|
9
9
|
# declare needed overloaded methods here
|
10
10
|
|
11
11
|
def initialize(*object)
|
12
|
+
return super(object.first) if object.first.is_a? Hash
|
12
13
|
if object.first
|
13
14
|
object = object.first
|
14
15
|
ticket_id = object.shift
|
@@ -39,9 +40,20 @@ module TicketMaster::Provider
|
|
39
40
|
Time.parse(self[:updated_at])
|
40
41
|
end
|
41
42
|
|
42
|
-
def self.
|
43
|
-
|
44
|
-
|
43
|
+
def self.find(project_id, ticket_id, *options)
|
44
|
+
ticket_comments = self.find_all(project_id, ticket_id)
|
45
|
+
if options[0].first.is_a? Array
|
46
|
+
ticket_comments.select do |comment|
|
47
|
+
comment if options[0].first.any? { |comment_id| comment_id == comment.id }
|
48
|
+
end
|
49
|
+
elsif options[0].first.is_a? Hash
|
50
|
+
self.find_by_attributes(project_id, ticket_id, options[0].first)
|
51
|
+
else
|
52
|
+
ticket_comments
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.find_all(project_id, ticket_id)
|
45
57
|
comment_id = 0
|
46
58
|
ZendeskAPI::Ticket.find(ticket_id).comments.collect do |comment|
|
47
59
|
comment_id += 1
|
@@ -50,18 +62,7 @@ module TicketMaster::Provider
|
|
50
62
|
end
|
51
63
|
|
52
64
|
def self.find_by_attributes(project_id, ticket_id, attributes = {})
|
53
|
-
|
54
|
-
attributes.inject(true) do |memo, kv|
|
55
|
-
break unless memo
|
56
|
-
key, value = kv
|
57
|
-
begin
|
58
|
-
memo &= comment.send(key) == value
|
59
|
-
rescue NoMethodError
|
60
|
-
memo = false
|
61
|
-
end
|
62
|
-
memo
|
63
|
-
end
|
64
|
-
end
|
65
|
+
search_by_attribute(self.find_all(project_id, ticket_id), attributes)
|
65
66
|
end
|
66
67
|
|
67
68
|
end
|
data/lib/provider/project.rb
CHANGED
@@ -35,13 +35,7 @@ module TicketMaster::Provider
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def tickets(*options)
|
38
|
-
|
39
|
-
Ticket.find_all(self.name)
|
40
|
-
elsif options.first.is_a? Array
|
41
|
-
Ticket.find_all(self.name).select { |ticket| ticket if options.first.any? { |ticket_id| ticket_id == ticket.id }}
|
42
|
-
elsif options.first.is_a? Hash
|
43
|
-
Ticket.find_by_attributes(self.name, options.first)
|
44
|
-
end
|
38
|
+
Ticket.find(self.name, options)
|
45
39
|
end
|
46
40
|
|
47
41
|
def ticket(*options)
|
data/lib/provider/ticket.rb
CHANGED
@@ -41,6 +41,17 @@ module TicketMaster::Provider
|
|
41
41
|
Time.parse(self[:updated_at])
|
42
42
|
end
|
43
43
|
|
44
|
+
def self.find(project_id, *options)
|
45
|
+
tickets = self.find_all(project_id)
|
46
|
+
if options[0].first.is_a? Array
|
47
|
+
Ticket.find_all(self.name).select { |ticket| ticket if options[0].first.any? { |ticket_id| ticket_id == ticket.id }}
|
48
|
+
elsif options[0].first.is_a? Hash
|
49
|
+
Ticket.find_by_attributes(self.name, options[0].first)
|
50
|
+
else
|
51
|
+
tickets
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
44
55
|
def self.find_all(*options)
|
45
56
|
project_id = options.first
|
46
57
|
SEARCH_API.find(:all, :params => {:query => "status:open"}).collect { |ticket| self.new([ticket, project_id])}
|
@@ -51,49 +62,21 @@ module TicketMaster::Provider
|
|
51
62
|
end
|
52
63
|
|
53
64
|
def self.find_by_attributes(project_id, attributes = {})
|
54
|
-
self.find_all(project_id)
|
55
|
-
attributes.inject(true) do |memo, kv|
|
56
|
-
break unless memo
|
57
|
-
key, value = kv
|
58
|
-
begin
|
59
|
-
memo &= ticket.send(key) == value
|
60
|
-
rescue NoMethodError
|
61
|
-
memo = false
|
62
|
-
end
|
63
|
-
memo
|
64
|
-
end
|
65
|
-
end
|
65
|
+
search_by_attribute(self.find_all(project_id), attributes)
|
66
66
|
end
|
67
67
|
|
68
68
|
def comments(*options)
|
69
|
-
|
70
|
-
ticket_comments.select do |comment|
|
71
|
-
comment if options.first.any? { |comment_id| comment_id == comment.id }
|
72
|
-
end
|
73
|
-
elsif options.first.is_a? Hash
|
74
|
-
comments_find_by_attributes(options.first)
|
75
|
-
else
|
76
|
-
ticket_comments
|
77
|
-
end
|
69
|
+
Comment.find(project_id, id, options)
|
78
70
|
end
|
79
71
|
|
80
72
|
def comment(*options)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
73
|
+
if options.first.is_a? Fixnum
|
74
|
+
Comment.find(project_id, id, [options.first]).first
|
75
|
+
elsif options.first.is_a? Hash
|
76
|
+
Comment.find_by_attributes(project_id, id, options.first).first
|
85
77
|
end
|
86
78
|
end
|
87
79
|
|
88
|
-
private
|
89
|
-
def ticket_comments
|
90
|
-
Comment.find_all(self[:project_id], self[:id])
|
91
|
-
end
|
92
|
-
|
93
|
-
def comments_find_by_attributes(attributes)
|
94
|
-
Comment.find_by_attributes(self[:project_id], self[:id], attributes)
|
95
|
-
end
|
96
|
-
|
97
80
|
end
|
98
81
|
|
99
82
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ticketmaster-zendesk}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.1.2"
|
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 = %q{2011-04-
|
12
|
+
s.date = %q{2011-04-27}
|
13
13
|
s.description = %q{Allows ticketmaster to interact with Your System.}
|
14
14
|
s.email = %q{george.rafael@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
|
|
48
48
|
]
|
49
49
|
s.homepage = %q{http://bandw.tumblr.com}
|
50
50
|
s.require_paths = ["lib"]
|
51
|
-
s.rubygems_version = %q{1.6.
|
51
|
+
s.rubygems_version = %q{1.6.0}
|
52
52
|
s.summary = %q{Ticketmaster Provider for Zendesk}
|
53
53
|
s.test_files = [
|
54
54
|
"spec/comments_spec.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ticketmaster-zendesk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 1
|
9
9
|
- 2
|
10
|
-
version: 0.
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rafael George
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-27 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
180
|
requirements: []
|
181
181
|
|
182
182
|
rubyforge_project:
|
183
|
-
rubygems_version: 1.6.
|
183
|
+
rubygems_version: 1.6.0
|
184
184
|
signing_key:
|
185
185
|
specification_version: 3
|
186
186
|
summary: Ticketmaster Provider for Zendesk
|