ticketmaster-zendesk 0.0.1
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/.DS_Store +0 -0
- data/LICENSE +22 -0
- data/README.md +67 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/lib/.DS_Store +0 -0
- data/lib/provider/comment.rb +70 -0
- data/lib/provider/project.rb +64 -0
- data/lib/provider/ticket.rb +101 -0
- data/lib/provider/zendesk.rb +36 -0
- data/lib/ticketmaster-zendesk.rb +6 -0
- data/lib/zendesk/zendesk-api.rb +49 -0
- data/spec/.DS_Store +0 -0
- data/spec/comments_spec.rb +53 -0
- data/spec/fixtures/.DS_Store +0 -0
- data/spec/fixtures/ticket.json +1 -0
- data/spec/fixtures/tickets.json +1 -0
- data/spec/fixtures/tickets.xml +145 -0
- data/spec/fixtures/tickets/2.xml +52 -0
- data/spec/fixtures/tickets/5.xml +78 -0
- data/spec/fixtures/tickets/create.xml +24 -0
- data/spec/projects_spec.rb +29 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/ticketmaster-zendesk_spec.rb +11 -0
- data/spec/tickets_spec.rb +57 -0
- metadata +190 -0
data/.DS_Store
ADDED
Binary file
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2010 YOU
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
NONE
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# ticketmaster-redmine
|
2
|
+
|
3
|
+
This is a provider for [ticketmaster](http://ticketrb.com). It provides interoperability with [Zendesk](http://www.zendesk.com) and it's issue tracking system through the ticketmaster gem.
|
4
|
+
|
5
|
+
Right now this provider only supports reading operations.
|
6
|
+
|
7
|
+
# Usage and Examples
|
8
|
+
|
9
|
+
First we have to instantiate a new ticketmaster instance:
|
10
|
+
|
11
|
+
zendesk = TicketMaster.new(:zendesk, {:account => 'hybridgroup', :username => "foo", :password => "bar"})
|
12
|
+
|
13
|
+
If you do not pass in account, username and password, you won't get any information.
|
14
|
+
|
15
|
+
## Finding Projects
|
16
|
+
|
17
|
+
You can find your own projects by doing:
|
18
|
+
|
19
|
+
projects = zendesk.projects # Will return all your repositories
|
20
|
+
projects = zendesk.projects(['your_repo1']) # You must use your projects identifier
|
21
|
+
project = zendesk.project('your_repo') # Also use project identifier in here
|
22
|
+
|
23
|
+
Note: Zendesk dosen't support a projects which means this is a ticketmaster place holder object, you will always get the same project name as follows: 'accountname-project'.
|
24
|
+
|
25
|
+
|
26
|
+
## Finding Tickets
|
27
|
+
|
28
|
+
tickets = project.tickets # All open issues
|
29
|
+
tickets = project.tickets([1,2]) # An array of tickets with the specified id's
|
30
|
+
ticket = project.ticket(<issue_number>)
|
31
|
+
|
32
|
+
## Finding Comments
|
33
|
+
|
34
|
+
comments = tickets.comments
|
35
|
+
comments = tickets.comments([1,2]) # An array of comments with the specified id's
|
36
|
+
|
37
|
+
|
38
|
+
## Requirements
|
39
|
+
|
40
|
+
* rubygems (obviously)
|
41
|
+
* ticketmaster gem (latest version preferred)
|
42
|
+
* jeweler gem (only if you want to repackage and develop)
|
43
|
+
|
44
|
+
The ticketmaster gem should automatically be installed during the installation of this gem if it is not already installed.
|
45
|
+
|
46
|
+
## Other Notes
|
47
|
+
|
48
|
+
Since this and the ticketmaster gem is still primarily a work-in-progress, minor changes may be incompatible with previous versions. Please be careful about using and updating this gem in production.
|
49
|
+
|
50
|
+
If you see or find any issues, feel free to open up an issue report.
|
51
|
+
|
52
|
+
|
53
|
+
## Note on Patches/Pull Requests
|
54
|
+
|
55
|
+
* Fork the project.
|
56
|
+
* Make your feature addition or bug fix.
|
57
|
+
* Add tests for it. This is important so we don't break it in a
|
58
|
+
future version unintentionally.
|
59
|
+
* Commit, do not mess with rakefile, version, or history.
|
60
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself so we can ignore when I pull)
|
61
|
+
* Send us a pull request. Bonus points for topic branches.
|
62
|
+
|
63
|
+
## Copyright
|
64
|
+
|
65
|
+
Copyright (c) 2010 The Hybrid Group. See LICENSE for details.
|
66
|
+
|
67
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "ticketmaster-zendesk"
|
8
|
+
gem.summary = %Q{Ticketmaster Provider for Zendesk}
|
9
|
+
gem.description = %Q{Allows ticketmaster to interact with Your System.}
|
10
|
+
gem.email = "george.rafael@gmail.com"
|
11
|
+
gem.homepage = "http://bandw.tumblr.com"
|
12
|
+
gem.authors = ["Rafael George"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
gem.add_dependency "ticketmaster", ">= 0.1.0"
|
15
|
+
gem.add_dependency "activesupport", ">= 2.3.2"
|
16
|
+
gem.add_dependency "activeresource", ">= 2.3.2"
|
17
|
+
gem.add_dependency "addressable", ">= 2.1.2"
|
18
|
+
gem.add_dependency "i18n"
|
19
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
|
+
end
|
21
|
+
Jeweler::GemcutterTasks.new
|
22
|
+
rescue LoadError
|
23
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'spec/rake/spectask'
|
27
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
30
|
+
end
|
31
|
+
|
32
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
33
|
+
spec.libs << 'lib' << 'spec'
|
34
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
35
|
+
spec.rcov = true
|
36
|
+
end
|
37
|
+
|
38
|
+
task :spec => :check_dependencies
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "ticketmaster-yourprovider #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Zendesk
|
3
|
+
# The comment class for ticketmaster-zendesk
|
4
|
+
#
|
5
|
+
# Do any mapping between Ticketmaster and your system's comment model here
|
6
|
+
# versions of the ticket.
|
7
|
+
#
|
8
|
+
class Comment < TicketMaster::Provider::Base::Comment
|
9
|
+
# declare needed overloaded methods here
|
10
|
+
|
11
|
+
def initialize(*object)
|
12
|
+
if object.first
|
13
|
+
object = object.first
|
14
|
+
ticket_id = object.shift
|
15
|
+
project_id = object.shift
|
16
|
+
comment_id = object.shift
|
17
|
+
object = object.shift
|
18
|
+
@system_data = {:client => object}
|
19
|
+
unless object.is_a? Hash
|
20
|
+
hash = {:author => object.author_id,
|
21
|
+
:body => object.value,
|
22
|
+
:id => comment_id,
|
23
|
+
:created_at => object.created_at,
|
24
|
+
:updated_at => object.created_at,
|
25
|
+
:ticket_id => ticket_id,
|
26
|
+
:project_id => project_id}
|
27
|
+
else
|
28
|
+
hash = object
|
29
|
+
end
|
30
|
+
super hash
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def created_at
|
35
|
+
Time.parse(self[:created_at])
|
36
|
+
end
|
37
|
+
|
38
|
+
def updated_at
|
39
|
+
Time.parse(self[:updated_at])
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.find_all(*options)
|
43
|
+
project_id = options.shift
|
44
|
+
ticket_id = options.shift
|
45
|
+
comment_id = 0
|
46
|
+
ZendeskAPI::Ticket.find(ticket_id).comments.collect do |comment|
|
47
|
+
comment_id += 1
|
48
|
+
Comment.new [ticket_id, project_id, comment_id, comment]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.find_by_attributes(project_id, ticket_id, attributes = {})
|
53
|
+
self.find_all(project_id, ticket_id).select do |comment|
|
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
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Zendesk
|
3
|
+
# Project class for ticketmaster-zendesk
|
4
|
+
#
|
5
|
+
#
|
6
|
+
class Project < TicketMaster::Provider::Base::Project
|
7
|
+
attr_accessor :prefix_options
|
8
|
+
#API = ZendeskAPI::Organization
|
9
|
+
# declare needed overloaded methods here
|
10
|
+
|
11
|
+
def initialize(*object)
|
12
|
+
if object.first
|
13
|
+
object = object.first
|
14
|
+
unless object.is_a? Hash
|
15
|
+
@system_data = {:client => object}
|
16
|
+
hash = {:repository => object.account,
|
17
|
+
:user => object.username,
|
18
|
+
:name => object.name}
|
19
|
+
else
|
20
|
+
hash = object
|
21
|
+
end
|
22
|
+
super hash
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# copy from this.copy(that) copies that into this
|
27
|
+
def copy(project)
|
28
|
+
project.tickets.each do |ticket|
|
29
|
+
copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
|
30
|
+
ticket.comments.each do |comment|
|
31
|
+
copy_ticket.comment!(:body => comment.body)
|
32
|
+
sleep 1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def tickets(*options)
|
38
|
+
if options.empty?
|
39
|
+
Ticket.find_all(self.name).collect { |ticket| Ticket.new [ticket, 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
|
45
|
+
end
|
46
|
+
|
47
|
+
def ticket(*options)
|
48
|
+
if options.first.is_a? Fixnum
|
49
|
+
ticket_id = options.first
|
50
|
+
Ticket.find_by_id(ticket_id)
|
51
|
+
elsif options.first.is_a? Hash
|
52
|
+
Ticket.find_by_attributes(self.name, options.first).first
|
53
|
+
else
|
54
|
+
TicketMaster::Provider::Zendesk::Ticket
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def ticket!(*options)
|
59
|
+
Ticket.new [ZendeskAPI::Ticket.create(options.first), self.name]
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
|
2
|
+
module TicketMaster::Provider
|
3
|
+
module Zendesk
|
4
|
+
|
5
|
+
class Ticket < TicketMaster::Provider::Base::Ticket
|
6
|
+
# declare needed overloaded methods here
|
7
|
+
|
8
|
+
SEARCH_API = ZendeskAPI::Search
|
9
|
+
API = ZendeskAPI::Ticket
|
10
|
+
|
11
|
+
def initialize(*object)
|
12
|
+
if object.first
|
13
|
+
args = object.first
|
14
|
+
object = args.shift
|
15
|
+
project_id = args.shift
|
16
|
+
@system_data = {:client => object}
|
17
|
+
unless object.is_a? Hash
|
18
|
+
hash = {:id => object.nice_id,
|
19
|
+
:status => object.status_id,
|
20
|
+
:title => object.subject,
|
21
|
+
:created_at => object.created_at,
|
22
|
+
:updated_at => object.updated_at,
|
23
|
+
:description => object.description,
|
24
|
+
:assignee => object.assignee_id,
|
25
|
+
:requestor => object.requester_id,
|
26
|
+
:priority => object.priority_id,
|
27
|
+
:project_id => project_id}
|
28
|
+
else
|
29
|
+
hash = object
|
30
|
+
end
|
31
|
+
super hash
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def created_at
|
36
|
+
Time.parse(self[:created_at])
|
37
|
+
end
|
38
|
+
|
39
|
+
def updated_at
|
40
|
+
Time.parse(self[:updated_at])
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.find_all(*options)
|
44
|
+
project_id = options.first
|
45
|
+
SEARCH_API.find(:all, :params => {:query => "status:open"}).collect { |ticket| self.new [ticket, project_id]}
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.find_by_id(*options)
|
49
|
+
id = options.shift
|
50
|
+
project_id = options.shift
|
51
|
+
self.new [API.find(id), project_id]
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.find_by_attributes(project_id, attributes = {})
|
55
|
+
self.find_all(project_id).select do |ticket|
|
56
|
+
attributes.inject(true) do |memo, kv|
|
57
|
+
break unless memo
|
58
|
+
key, value = kv
|
59
|
+
begin
|
60
|
+
memo &= ticket.send(key) == value
|
61
|
+
rescue NoMethodError
|
62
|
+
memo = false
|
63
|
+
end
|
64
|
+
memo
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def comments(*options)
|
70
|
+
if options.first.is_a? Array
|
71
|
+
ticket_comments.select do |comment|
|
72
|
+
comment if options.first.any? { |comment_id| comment_id == comment.id }
|
73
|
+
end
|
74
|
+
elsif options.first.is_a? Hash
|
75
|
+
comments_find_by_attributes(options.first)
|
76
|
+
else
|
77
|
+
ticket_comments
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def comment(*options)
|
82
|
+
unless options.first.is_a? Hash
|
83
|
+
ticket_comments.select { |comment| comment.id == options.first }.first
|
84
|
+
else
|
85
|
+
comments_find_by_attributes(options.first).first
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
def ticket_comments
|
91
|
+
Comment.find_all(self[:project_id], self[:id])
|
92
|
+
end
|
93
|
+
|
94
|
+
def comments_find_by_attributes(attributes)
|
95
|
+
Comment.find_by_attributes(self[:project_id], self[:id], attributes)
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'ticketmaster'
|
2
|
+
module TicketMaster::Provider
|
3
|
+
# This is the Zendesk Provider for ticketmaster
|
4
|
+
module Zendesk
|
5
|
+
include TicketMaster::Provider::Base
|
6
|
+
#PROJECT_API = ZendeskAPI::Organization
|
7
|
+
|
8
|
+
# This is for cases when you want to instantiate using TicketMaster::Provider::Yoursystem.new(auth)
|
9
|
+
def self.new(auth = {})
|
10
|
+
TicketMaster.new(:zendesk, auth)
|
11
|
+
end
|
12
|
+
|
13
|
+
# The authorize and initializer for this provider
|
14
|
+
def authorize(auth = {})
|
15
|
+
@authentication ||= TicketMaster::Authenticator.new(auth)
|
16
|
+
auth = @authentication
|
17
|
+
if (auth.account.nil? and auth.username.nil? and auth.password.nil?)
|
18
|
+
raise "Please provide at least an url (subdomain), username and password)"
|
19
|
+
end
|
20
|
+
ZendeskAPI.authenticate(auth.account, auth.username, auth.password)
|
21
|
+
end
|
22
|
+
|
23
|
+
def projects(*options)
|
24
|
+
[Project.new({:account => @authentication.account, :username => @authentication.username, :name => "#{@authentication.account}-project"})]
|
25
|
+
end
|
26
|
+
|
27
|
+
def project(*options)
|
28
|
+
unless options.empty?
|
29
|
+
Project.new({:account => @authentication.account, :username => @authentication.username, :name => "#{@authentication.account}-project"})
|
30
|
+
else
|
31
|
+
TicketMaster::Provider::Zendesk::Project
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_resource'
|
4
|
+
|
5
|
+
module ZendeskAPI
|
6
|
+
class Error < StandardError; end
|
7
|
+
|
8
|
+
class << self
|
9
|
+
|
10
|
+
def authenticate(account, username, password)
|
11
|
+
@username = username
|
12
|
+
@password = password
|
13
|
+
self::Base.user = username
|
14
|
+
self::Base.password = password
|
15
|
+
self::Base.site = "http://#{account}.zendesk.com"
|
16
|
+
end
|
17
|
+
|
18
|
+
def resources
|
19
|
+
@resources ||= []
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
class Base < ActiveResource::Base
|
25
|
+
self.format = :json
|
26
|
+
def self.inherited(base)
|
27
|
+
ZendeskAPI.resources << base
|
28
|
+
super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Search < Base
|
33
|
+
|
34
|
+
def self.collection_path(prefix_options = {}, query_options = nil)
|
35
|
+
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
36
|
+
"#{prefix(prefix_options)}search.#{format.extension}#{query_string(query_options)}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.element_path(id, prefix_options = {}, query_options = nil)
|
40
|
+
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
41
|
+
"#{prefix(prefix_options)}search.#{format.extension}#{query_string(query_options)}"
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
class Ticket < Base
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
data/spec/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Zendesk::Comment" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@project_id = 'hybridgroup-project'
|
7
|
+
@ticket_id = 1
|
8
|
+
headers = {'Authorization' => 'Basic cmFmYWVsQGh5YnJpZGdyb3VwLmNvbToxMjM0NTY=','Accept' => 'application/json'}
|
9
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
10
|
+
mock.get '/tickets/1.json', headers, fixture_for('ticket','json'), 200
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
@ticketmaster = TicketMaster.new(:zendesk, :account => 'hybridgroup', :username => 'rafael@hybridgroup.com', :password => '123456')
|
16
|
+
project = @ticketmaster.project(@project_id)
|
17
|
+
@ticket = project.ticket(@ticket_id)
|
18
|
+
@klass = TicketMaster::Provider::Zendesk::Comment
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be able to load all comments" do
|
22
|
+
comments = @ticket.comments
|
23
|
+
comments.should be_an_instance_of(Array)
|
24
|
+
comments.first.should be_an_instance_of(@klass)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should be able to load all comments based on an array of id's" do
|
28
|
+
comments = @ticket.comments([1])
|
29
|
+
comments.should be_an_instance_of(Array)
|
30
|
+
comments.first.should be_an_instance_of(@klass)
|
31
|
+
comments.first.id.should == 1
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to load all comments based on attributes" do
|
35
|
+
comments = @ticket.comments(:ticket_id => @ticket.id)
|
36
|
+
comments.should be_an_instance_of(Array)
|
37
|
+
comments.first.should be_an_instance_of(@klass)
|
38
|
+
comments.first.id.should == 1
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should be able to load a comment based on id" do
|
42
|
+
comment = @ticket.comment(1)
|
43
|
+
comment.should be_an_instance_of(@klass)
|
44
|
+
comment.id.should == 1
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should be able to load a ticket based on attributes" do
|
48
|
+
comment = @ticket.comment(:ticket_id => 1)
|
49
|
+
comment.should be_an_instance_of(@klass)
|
50
|
+
comment.id.should == 1
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
{"nice_id":1,"initially_assigned_at":"2011/01/31 14:09:12 -0400","entry_id":null,"created_at":"2011/01/31 14:09:12 -0400","resolution_time":null,"priority_id":1,"current_tags":null,"assignee_id":26218414,"channel":null,"updated_at":"2011/01/31 14:09:12 -0400","ticket_type_id":3,"status_updated_at":"2011/01/31 14:09:12 -0400","solved_at":null,"original_recipient_address":null,"external_id":null,"assigned_at":"2011/01/31 14:09:12 -0400","via_id":0,"subject":"Testing","recipient":null,"group_id":121752,"comments":[{"created_at":"2011/01/31 14:09:12 -0400","via_id":0,"value":"Testing","type":"Comment","is_public":true,"author_id":26218414,"attachments":[]}],"linkings":[],"submitter_id":26218414,"base_score":18,"latest_recipients":null,"due_date":null,"current_collaborators":null,"status_id":1,"description":"Testing","ticket_field_entries":[],"problem_id":null,"score":18,"organization_id":457249,"updated_by_type_id":0,"requester_id":26218414}
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"nice_id":1,"initially_assigned_at":"2011/01/31 14:09:12 -0400","entry_id":null,"created_at":"2011/01/31 14:09:12 -0400","resolution_time":null,"priority_id":1,"current_tags":null,"assignee_id":26218414,"channel":null,"updated_at":"2011/01/31 14:09:12 -0400","ticket_type_id":3,"status_updated_at":"2011/01/31 14:09:12 -0400","solved_at":null,"original_recipient_address":null,"external_id":null,"assigned_at":"2011/01/31 14:09:12 -0400","via_id":0,"subject":"Testing","recipient":null,"group_id":121752,"comments":[{"created_at":"2011/01/31 14:09:12 -0400","via_id":0,"value":"Testing","type":"Comment","is_public":true,"author_id":26218414,"attachments":[]}],"linkings":[],"submitter_id":26218414,"base_score":18,"latest_recipients":null,"due_date":null,"current_collaborators":null,"status_id":1,"description":"Testing","ticket_field_entries":[],"problem_id":null,"score":18,"organization_id":457249,"updated_by_type_id":0,"requester_id":26218414},{"nice_id":2,"initially_assigned_at":"2011/01/31 14:30:31 -0400","entry_id":null,"created_at":"2011/01/31 14:30:31 -0400","resolution_time":null,"priority_id":0,"current_tags":null,"assignee_id":26218414,"channel":null,"updated_at":"2011/01/31 14:30:31 -0400","ticket_type_id":0,"status_updated_at":"2011/01/31 14:30:31 -0400","solved_at":null,"original_recipient_address":null,"external_id":null,"assigned_at":"2011/01/31 14:30:31 -0400","via_id":4,"subject":"Welcome to Zendesk, You've Got a Ticket!","recipient":"support@hybridgroup.zendesk.com","group_id":121752,"comments":[{"created_at":"2011/01/31 14:30:31 -0400","via_id":4,"value":"You've got a new ticket!\n\nTo help you get started learning how your zendesk simplifies ticket workflow, I emailed you at support@hybridgroup.zendesk.com and this ticket was created in your zendesk. Neat!\n\nYou can answer this ticket in one of two ways:\n\nBy Email: If you are looking at this in your email inbox, simply hit \"Reply\"\n\nBy Zendesk: If you are looking at this ticket in your zendesk:\n\n* Enter a comment (e.g. \"How am I doing?\")\n* Change status from Open to Pending (now, you’re waiting for me to get back to you!)\n* Click submit\n\nEither way, both your reply and follow-ups will be added to the ticket history and organized in your zendesk.\n\nYou’re eligible for 24-hour support throughout your trial. Please don’t hesitate to call or email our customer advocate team:\n\n*(e) support@zendesk.com\n*(p) +1 415.418.7506\n\nThank you for using Zendesk,\n\nKelly\nCustomer Advocate at Zendesk","type":"Comment","is_public":true,"author_id":26220353,"attachments":[]}],"linkings":[],"submitter_id":26220353,"base_score":108,"latest_recipients":null,"due_date":null,"current_collaborators":null,"status_id":1,"description":"You've got a new ticket!\n\nTo help you get started learning how your zendesk simplifies ticket workflow, I emailed you at support@hybridgroup.zendesk.com and this ticket was created in your zendesk. Neat!\n\nYou can answer this ticket in one of two ways:\n\nBy Email: If you are looking at this in your email inbox, simply hit \"Reply\"\n\nBy Zendesk: If you are looking at this ticket in your zendesk:\n\n* Enter a comment (e.g. \"How am I doing?\")\n* Change status from Open to Pending (now, you’re waiting for me to get back to you!)\n* Click submit\n\nEither way, both your reply and follow-ups will be added to the ticket history and organized in your zendesk.\n\nYou’re eligible for 24-hour support throughout your trial. Please don’t hesitate to call or email our customer advocate team:\n\n*(e) support@zendesk.com\n*(p) +1 415.418.7506\n\nThank you for using Zendesk,\n\nKelly\nCustomer Advocate at Zendesk","ticket_field_entries":[],"problem_id":null,"score":108,"organization_id":null,"updated_by_type_id":1,"requester_id":26220353}]
|
@@ -0,0 +1,145 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<records type="array" count="2">
|
3
|
+
<record>
|
4
|
+
<assigned-at type="datetime">2011-01-31T14:09:12-04:00</assigned-at>
|
5
|
+
<assignee-id type="integer">26218414</assignee-id>
|
6
|
+
<base-score type="integer">12</base-score>
|
7
|
+
<created-at type="datetime">2011-01-31T14:09:12-04:00</created-at>
|
8
|
+
<current-collaborators nil="true"></current-collaborators>
|
9
|
+
<current-tags nil="true"></current-tags>
|
10
|
+
<description>Testing</description>
|
11
|
+
<due-date type="datetime" nil="true"></due-date>
|
12
|
+
<entry-id type="integer" nil="true"></entry-id>
|
13
|
+
<external-id nil="true"></external-id>
|
14
|
+
<group-id type="integer">121752</group-id>
|
15
|
+
<initially-assigned-at type="datetime">2011-01-31T14:09:12-04:00</initially-assigned-at>
|
16
|
+
<latest-recipients nil="true"></latest-recipients>
|
17
|
+
<nice-id type="integer">1</nice-id>
|
18
|
+
<organization-id type="integer">457249</organization-id>
|
19
|
+
<original-recipient-address nil="true"></original-recipient-address>
|
20
|
+
<priority-id type="integer">1</priority-id>
|
21
|
+
<recipient nil="true"></recipient>
|
22
|
+
<requester-id type="integer">26218414</requester-id>
|
23
|
+
<resolution-time type="integer" nil="true"></resolution-time>
|
24
|
+
<solved-at type="datetime" nil="true"></solved-at>
|
25
|
+
<status-id type="integer">1</status-id>
|
26
|
+
<status-updated-at type="datetime">2011-01-31T14:09:12-04:00</status-updated-at>
|
27
|
+
<subject>Testing</subject>
|
28
|
+
<submitter-id type="integer">26218414</submitter-id>
|
29
|
+
<ticket-type-id type="integer">3</ticket-type-id>
|
30
|
+
<updated-at type="datetime">2011-01-31T14:09:12-04:00</updated-at>
|
31
|
+
<updated-by-type-id type="integer">0</updated-by-type-id>
|
32
|
+
<via-id type="integer">0</via-id>
|
33
|
+
<score type="integer">12</score>
|
34
|
+
<problem-id nil="true"></problem-id>
|
35
|
+
<comments type="array">
|
36
|
+
<comment>
|
37
|
+
<author-id type="integer">26218414</author-id>
|
38
|
+
<created-at type="datetime">2011-01-31T14:09:12-04:00</created-at>
|
39
|
+
<is-public type="boolean">true</is-public>
|
40
|
+
<type>Comment</type>
|
41
|
+
<value>Testing</value>
|
42
|
+
<via-id type="integer">0</via-id>
|
43
|
+
<attachments type="array"/>
|
44
|
+
</comment>
|
45
|
+
</comments>
|
46
|
+
<linkings type="array"/>
|
47
|
+
<ticket-field-entries type="array"/>
|
48
|
+
<channel nil="true"></channel>
|
49
|
+
</record>
|
50
|
+
<record>
|
51
|
+
<assigned-at type="datetime">2011-01-31T14:30:31-04:00</assigned-at>
|
52
|
+
<assignee-id type="integer">26218414</assignee-id>
|
53
|
+
<base-score type="integer">72</base-score>
|
54
|
+
<created-at type="datetime">2011-01-31T14:30:31-04:00</created-at>
|
55
|
+
<current-collaborators nil="true"></current-collaborators>
|
56
|
+
<current-tags nil="true"></current-tags>
|
57
|
+
<description>You've got a new ticket!
|
58
|
+
|
59
|
+
To help you get started learning how your zendesk simplifies ticket workflow, I emailed you at support@hybridgroup.zendesk.com and this ticket was created in your zendesk. Neat!
|
60
|
+
|
61
|
+
You can answer this ticket in one of two ways:
|
62
|
+
|
63
|
+
By Email: If you are looking at this in your email inbox, simply hit "Reply"
|
64
|
+
|
65
|
+
By Zendesk: If you are looking at this ticket in your zendesk:
|
66
|
+
|
67
|
+
* Enter a comment (e.g. "How am I doing?")
|
68
|
+
* Change status from Open to Pending (now, you’re waiting for me to get back to you!)
|
69
|
+
* Click submit
|
70
|
+
|
71
|
+
Either way, both your reply and follow-ups will be added to the ticket history and organized in your zendesk.
|
72
|
+
|
73
|
+
You’re eligible for 24-hour support throughout your trial. Please don’t hesitate to call or email our customer advocate team:
|
74
|
+
|
75
|
+
*(e) support@zendesk.com
|
76
|
+
*(p) +1 415.418.7506
|
77
|
+
|
78
|
+
Thank you for using Zendesk,
|
79
|
+
|
80
|
+
Kelly
|
81
|
+
Customer Advocate at Zendesk</description>
|
82
|
+
<due-date type="datetime" nil="true"></due-date>
|
83
|
+
<entry-id type="integer" nil="true"></entry-id>
|
84
|
+
<external-id nil="true"></external-id>
|
85
|
+
<group-id type="integer">121752</group-id>
|
86
|
+
<initially-assigned-at type="datetime">2011-01-31T14:30:31-04:00</initially-assigned-at>
|
87
|
+
<latest-recipients nil="true"></latest-recipients>
|
88
|
+
<nice-id type="integer">2</nice-id>
|
89
|
+
<organization-id type="integer" nil="true"></organization-id>
|
90
|
+
<original-recipient-address nil="true"></original-recipient-address>
|
91
|
+
<priority-id type="integer">0</priority-id>
|
92
|
+
<recipient>support@hybridgroup.zendesk.com</recipient>
|
93
|
+
<requester-id type="integer">26220353</requester-id>
|
94
|
+
<resolution-time type="integer" nil="true"></resolution-time>
|
95
|
+
<solved-at type="datetime" nil="true"></solved-at>
|
96
|
+
<status-id type="integer">1</status-id>
|
97
|
+
<status-updated-at type="datetime">2011-01-31T14:30:31-04:00</status-updated-at>
|
98
|
+
<subject>Welcome to Zendesk, You've Got a Ticket!</subject>
|
99
|
+
<submitter-id type="integer">26220353</submitter-id>
|
100
|
+
<ticket-type-id type="integer">0</ticket-type-id>
|
101
|
+
<updated-at type="datetime">2011-01-31T14:30:31-04:00</updated-at>
|
102
|
+
<updated-by-type-id type="integer">1</updated-by-type-id>
|
103
|
+
<via-id type="integer">4</via-id>
|
104
|
+
<score type="integer">72</score>
|
105
|
+
<problem-id nil="true"></problem-id>
|
106
|
+
<comments type="array">
|
107
|
+
<comment>
|
108
|
+
<author-id type="integer">26220353</author-id>
|
109
|
+
<created-at type="datetime">2011-01-31T14:30:31-04:00</created-at>
|
110
|
+
<is-public type="boolean">true</is-public>
|
111
|
+
<type>Comment</type>
|
112
|
+
<value>You've got a new ticket!
|
113
|
+
|
114
|
+
To help you get started learning how your zendesk simplifies ticket workflow, I emailed you at support@hybridgroup.zendesk.com and this ticket was created in your zendesk. Neat!
|
115
|
+
|
116
|
+
You can answer this ticket in one of two ways:
|
117
|
+
|
118
|
+
By Email: If you are looking at this in your email inbox, simply hit "Reply"
|
119
|
+
|
120
|
+
By Zendesk: If you are looking at this ticket in your zendesk:
|
121
|
+
|
122
|
+
* Enter a comment (e.g. "How am I doing?")
|
123
|
+
* Change status from Open to Pending (now, you’re waiting for me to get back to you!)
|
124
|
+
* Click submit
|
125
|
+
|
126
|
+
Either way, both your reply and follow-ups will be added to the ticket history and organized in your zendesk.
|
127
|
+
|
128
|
+
You’re eligible for 24-hour support throughout your trial. Please don’t hesitate to call or email our customer advocate team:
|
129
|
+
|
130
|
+
*(e) support@zendesk.com
|
131
|
+
*(p) +1 415.418.7506
|
132
|
+
|
133
|
+
Thank you for using Zendesk,
|
134
|
+
|
135
|
+
Kelly
|
136
|
+
Customer Advocate at Zendesk</value>
|
137
|
+
<via-id type="integer">4</via-id>
|
138
|
+
<attachments type="array"/>
|
139
|
+
</comment>
|
140
|
+
</comments>
|
141
|
+
<linkings type="array"/>
|
142
|
+
<ticket-field-entries type="array"/>
|
143
|
+
<channel nil="true"></channel>
|
144
|
+
</record>
|
145
|
+
</records>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ticket>
|
3
|
+
<assigned-at>2007-06-03T22:15:44Z</assigned-at>
|
4
|
+
<assignee-id>4</assignee-id>
|
5
|
+
<assignee-updated-at/>
|
6
|
+
<created-at>2007-06-03T20:15:44Z</created-at>
|
7
|
+
<subject></subject>
|
8
|
+
<description>My printer is not working</description>
|
9
|
+
<external-id/>
|
10
|
+
<group-id>2</group-id>
|
11
|
+
<id>2</id>
|
12
|
+
<linked-id/>
|
13
|
+
<priority-id>3</priority-id>
|
14
|
+
<submitter-id>3</submitter-id>
|
15
|
+
<status-id>1</status-id>
|
16
|
+
<status-updated-at>2007-06-03T22:15:44Z</status-updated-at>
|
17
|
+
<requester-id>3</requester-id>
|
18
|
+
<requester-updated-at>2007-06-03T22:15:44Z</requester-updated-at>
|
19
|
+
<ticket-type-id>2</ticket-type-id>
|
20
|
+
<updated-at>2007-06-03T20:15:45Z</updated-at>
|
21
|
+
<via-id>0</via-id>
|
22
|
+
<current-tags>printer hp</current-tags>
|
23
|
+
<score>28</score>
|
24
|
+
<comments type="array">
|
25
|
+
<comment>
|
26
|
+
<author-id>3</author-id>
|
27
|
+
<created-at>2007-06-03T20:15:45Z</created-at>
|
28
|
+
<is-public>true</is-public>
|
29
|
+
<value>This is a comment</value>
|
30
|
+
<via-id>0</via-id>
|
31
|
+
<via-reference-id/>
|
32
|
+
</comment>
|
33
|
+
<comment>
|
34
|
+
<author-id>5</author-id>
|
35
|
+
<created-at>2007-06-04T10:07:02Z</created-at>
|
36
|
+
<is-public>true</is-public>
|
37
|
+
<value>Make sure it is plugged in</value>
|
38
|
+
<via-id>0</via-id>
|
39
|
+
<via-reference-id/>
|
40
|
+
</comment>
|
41
|
+
</comments>
|
42
|
+
<ticket-field-entries type="array">
|
43
|
+
<ticket-field-entry>
|
44
|
+
<ticket-field-id>139</ticket-field-id>
|
45
|
+
<value>Please contact me by phone during work hours</value>
|
46
|
+
</ticket-field-entry>
|
47
|
+
<ticket-field-entry>
|
48
|
+
<ticket-field-id>141</ticket-field-id>
|
49
|
+
<value>true</value>
|
50
|
+
</ticket-field-entry>
|
51
|
+
</ticket-field-entries>
|
52
|
+
</ticket>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ticket>
|
3
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
4
|
+
<attachments-count type="integer">0</attachments-count>
|
5
|
+
<closed type="boolean">false</closed>
|
6
|
+
<created-at type="datetime">2010-07-03T05:01:48Z</created-at>
|
7
|
+
<creator-id type="integer">67916</creator-id>
|
8
|
+
<milestone-due-on type="datetime" nil="true"></milestone-due-on>
|
9
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
10
|
+
<number type="integer">5</number>
|
11
|
+
<permalink>tehantuehn</permalink>
|
12
|
+
<priority type="integer">3</priority>
|
13
|
+
<project-id type="integer">54448</project-id>
|
14
|
+
<raw-data type="binary" encoding="base64" nil="true"></raw-data>
|
15
|
+
<state>new</state>
|
16
|
+
<tag nil="true"></tag>
|
17
|
+
<title>tehantuehn</title>
|
18
|
+
<updated-at type="datetime">2010-07-08T02:11:21Z</updated-at>
|
19
|
+
<user-id type="integer">67916</user-id>
|
20
|
+
<user-name>Kia Kroas</user-name>
|
21
|
+
<creator-name>Kia Kroas</creator-name>
|
22
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/5</url>
|
23
|
+
<original-body>cheuasoht atesuhn</original-body>
|
24
|
+
<latest-body>cheuasoht atesuhn</latest-body>
|
25
|
+
<original-body-html><div><p>cheuasoht atesuhn</p></div></original-body-html>
|
26
|
+
<versions type="array">
|
27
|
+
<version type="Ticket::Version">
|
28
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
29
|
+
<attachments-count type="integer">0</attachments-count>
|
30
|
+
<body>cheuasoht atesuhn</body>
|
31
|
+
<body-html><div><p>cheuasoht atesuhn</p></div></body-html>
|
32
|
+
<closed type="boolean">false</closed>
|
33
|
+
<created-at type="datetime">2010-07-03T05:01:48Z</created-at>
|
34
|
+
<creator-id type="integer">67916</creator-id>
|
35
|
+
<diffable-attributes type="yaml">--- {}
|
36
|
+
|
37
|
+
</diffable-attributes>
|
38
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
39
|
+
<number type="integer">5</number>
|
40
|
+
<permalink>tehantuehn</permalink>
|
41
|
+
<priority type="integer">3</priority>
|
42
|
+
<project-id type="integer">54448</project-id>
|
43
|
+
<state>new</state>
|
44
|
+
<tag nil="true"></tag>
|
45
|
+
<title>tehantuehn</title>
|
46
|
+
<updated-at type="datetime">2010-07-03T05:01:51Z</updated-at>
|
47
|
+
<user-id type="integer">67916</user-id>
|
48
|
+
<user-name>Kia Kroas</user-name>
|
49
|
+
<creator-name>Kia Kroas</creator-name>
|
50
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/5</url>
|
51
|
+
</version>
|
52
|
+
<version type="Ticket::Version">
|
53
|
+
<assigned-user-id type="integer" nil="true"></assigned-user-id>
|
54
|
+
<attachments-count type="integer">0</attachments-count>
|
55
|
+
<body>New Body</body>
|
56
|
+
<body-html><div><p>New Body</p></div></body-html>
|
57
|
+
<closed type="boolean">false</closed>
|
58
|
+
<created-at type="datetime">2010-07-08T02:11:17Z</created-at>
|
59
|
+
<creator-id type="integer">67916</creator-id>
|
60
|
+
<diffable-attributes type="yaml">--- {}
|
61
|
+
|
62
|
+
</diffable-attributes>
|
63
|
+
<milestone-id type="integer" nil="true"></milestone-id>
|
64
|
+
<number type="integer">5</number>
|
65
|
+
<permalink>tehantuehn</permalink>
|
66
|
+
<priority type="integer">3</priority>
|
67
|
+
<project-id type="integer">54448</project-id>
|
68
|
+
<state>new</state>
|
69
|
+
<tag nil="true"></tag>
|
70
|
+
<title>tehantuehn</title>
|
71
|
+
<updated-at type="datetime">2010-07-08T02:11:21Z</updated-at>
|
72
|
+
<user-id type="integer">67916</user-id>
|
73
|
+
<user-name>Kia Kroas</user-name>
|
74
|
+
<creator-name>Kia Kroas</creator-name>
|
75
|
+
<url>http://ticketmaster.lighthouseapp.com/projects/54448/tickets/5</url>
|
76
|
+
</version>
|
77
|
+
</versions>
|
78
|
+
</ticket>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ticket>
|
3
|
+
<assigned-at>2007-06-03T22:15:44Z</assigned-at>
|
4
|
+
<assignee-id>4</assignee-id>
|
5
|
+
<assignee-updated-at/>
|
6
|
+
<created-at>2007-06-03T20:15:44Z</created-at>
|
7
|
+
<subject></subject>
|
8
|
+
<description>My printer is not working</description>
|
9
|
+
<external-id/>
|
10
|
+
<group-id>2</group-id>
|
11
|
+
<id>2</id>
|
12
|
+
<linked-id/>
|
13
|
+
<priority-id>3</priority-id>
|
14
|
+
<submitter-id>3</submitter-id>
|
15
|
+
<status-id>1</status-id>
|
16
|
+
<status-updated-at>2007-06-03T22:15:44Z</status-updated-at>
|
17
|
+
<requester-id>3</requester-id>
|
18
|
+
<requester-updated-at>2007-06-03T22:15:44Z</requester-updated-at>
|
19
|
+
<ticket-type-id>2</ticket-type-id>
|
20
|
+
<updated-at>2007-06-03T20:15:45Z</updated-at>
|
21
|
+
<via-id>0</via-id>
|
22
|
+
<current-tags>printer hp</current-tags>
|
23
|
+
<score>28</score>
|
24
|
+
</ticket>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Zendesk::Project" do
|
4
|
+
before(:all) do
|
5
|
+
@project_id = 'foobar-project'
|
6
|
+
end
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@ticketmaster = TicketMaster.new(:zendesk, {:account => 'hybridgroup', :username => 'foobar', :password => '123456'})
|
10
|
+
@klass = TicketMaster::Provider::Zendesk::Project
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should be able to load all projects" do
|
14
|
+
@ticketmaster.projects.should be_an_instance_of(Array)
|
15
|
+
@ticketmaster.projects.first.should be_an_instance_of(@klass)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be able to load all projects from an array of id's" do
|
19
|
+
@projects = @ticketmaster.projects([@project_id])
|
20
|
+
@projects.should be_an_instance_of(Array)
|
21
|
+
@projects.first.should be_an_instance_of(@klass)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be able to load a single project by id" do
|
25
|
+
@project = @ticketmaster.project(@project_id)
|
26
|
+
@project.should be_an_instance_of(@klass)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ticketmaster'
|
5
|
+
require 'ticketmaster-zendesk'
|
6
|
+
require 'spec'
|
7
|
+
require 'spec/autorun'
|
8
|
+
|
9
|
+
|
10
|
+
Spec::Runner.configure do |config|
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def fixture_for(name, format = 'xml')
|
15
|
+
File.read(File.dirname(__FILE__) + '/fixtures/' + name + ".#{format}")
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Zendesk" do
|
4
|
+
|
5
|
+
it "should be able to instantiate a new instance" do
|
6
|
+
@ticketmaster = TicketMaster.new(:zendesk, {:account => 'ticketmaster', :username => 'foo', :password => '000000'})
|
7
|
+
@ticketmaster.should be_an_instance_of(TicketMaster)
|
8
|
+
@ticketmaster.should be_a_kind_of(TicketMaster::Provider::Zendesk)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Zendesk::Ticket" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@project_id = "hybridgroup-project"
|
7
|
+
|
8
|
+
headers = {'Authorization' => 'Basic cmFmYWVsQGh5YnJpZGdyb3VwLmNvbToxMjM0NTY=','Accept' => 'application/json'}
|
9
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
10
|
+
mock.get '/search.json?query=status%3Aopen', headers, fixture_for('tickets', 'json'), 200
|
11
|
+
mock.get '/tickets/1.json', headers, fixture_for('ticket', 'json'), 200
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
@ticketmaster = TicketMaster.new(:zendesk, :account => 'hybridgroup', :username => 'rafael@hybridgroup.com', :password => '123456')
|
17
|
+
@klass = TicketMaster::Provider::Zendesk::Ticket
|
18
|
+
@project = @ticketmaster.project(@project_id)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be able to load all tickets" do
|
22
|
+
@project.tickets.should be_an_instance_of(Array)
|
23
|
+
@project.tickets.first.should be_an_instance_of(@klass)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be able to load all tickets based on an array of id's" do
|
27
|
+
tickets = @project.tickets([1])
|
28
|
+
tickets.should be_an_instance_of(Array)
|
29
|
+
tickets.first.should be_an_instance_of(@klass)
|
30
|
+
tickets.size.should == 1
|
31
|
+
tickets.first.title.should == "Testing"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to load all tickets based on attributes" do
|
35
|
+
tickets = @project.tickets(:id => 1)
|
36
|
+
tickets.should be_an_instance_of(Array)
|
37
|
+
tickets.first.should be_an_instance_of(@klass)
|
38
|
+
tickets.first.title.should == "Testing"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should be able to load a single ticket" do
|
42
|
+
ticket = @project.ticket(1)
|
43
|
+
ticket.should be_an_instance_of(@klass)
|
44
|
+
ticket.title.should == "Testing"
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should be able to find a ticket by attributes" do
|
48
|
+
ticket = @project.ticket(:id => 1)
|
49
|
+
ticket.should be_an_instance_of(@klass)
|
50
|
+
ticket.title.should == "Testing"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return the ticket class without parameter in the ticket method" do
|
54
|
+
@project.ticket.should == @klass
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
metadata
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ticketmaster-zendesk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Rafael George
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-07 00:00:00 +00:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
- 9
|
34
|
+
version: 1.2.9
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: ticketmaster
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 27
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 1
|
49
|
+
- 0
|
50
|
+
version: 0.1.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: activesupport
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 7
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 3
|
65
|
+
- 2
|
66
|
+
version: 2.3.2
|
67
|
+
type: :runtime
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activeresource
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 7
|
78
|
+
segments:
|
79
|
+
- 2
|
80
|
+
- 3
|
81
|
+
- 2
|
82
|
+
version: 2.3.2
|
83
|
+
type: :runtime
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: addressable
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 15
|
94
|
+
segments:
|
95
|
+
- 2
|
96
|
+
- 1
|
97
|
+
- 2
|
98
|
+
version: 2.1.2
|
99
|
+
type: :runtime
|
100
|
+
version_requirements: *id005
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: i18n
|
103
|
+
prerelease: false
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
version: "0"
|
113
|
+
type: :runtime
|
114
|
+
version_requirements: *id006
|
115
|
+
description: Allows ticketmaster to interact with Your System.
|
116
|
+
email: george.rafael@gmail.com
|
117
|
+
executables: []
|
118
|
+
|
119
|
+
extensions: []
|
120
|
+
|
121
|
+
extra_rdoc_files:
|
122
|
+
- LICENSE
|
123
|
+
- README.md
|
124
|
+
files:
|
125
|
+
- .DS_Store
|
126
|
+
- LICENSE
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- VERSION
|
130
|
+
- lib/.DS_Store
|
131
|
+
- lib/provider/comment.rb
|
132
|
+
- lib/provider/project.rb
|
133
|
+
- lib/provider/ticket.rb
|
134
|
+
- lib/provider/zendesk.rb
|
135
|
+
- lib/ticketmaster-zendesk.rb
|
136
|
+
- lib/zendesk/zendesk-api.rb
|
137
|
+
- spec/.DS_Store
|
138
|
+
- spec/comments_spec.rb
|
139
|
+
- spec/fixtures/.DS_Store
|
140
|
+
- spec/fixtures/ticket.json
|
141
|
+
- spec/fixtures/tickets.json
|
142
|
+
- spec/fixtures/tickets.xml
|
143
|
+
- spec/fixtures/tickets/2.xml
|
144
|
+
- spec/fixtures/tickets/5.xml
|
145
|
+
- spec/fixtures/tickets/create.xml
|
146
|
+
- spec/projects_spec.rb
|
147
|
+
- spec/spec.opts
|
148
|
+
- spec/spec_helper.rb
|
149
|
+
- spec/ticketmaster-zendesk_spec.rb
|
150
|
+
- spec/tickets_spec.rb
|
151
|
+
has_rdoc: true
|
152
|
+
homepage: http://bandw.tumblr.com
|
153
|
+
licenses: []
|
154
|
+
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
hash: 3
|
166
|
+
segments:
|
167
|
+
- 0
|
168
|
+
version: "0"
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
hash: 3
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
version: "0"
|
178
|
+
requirements: []
|
179
|
+
|
180
|
+
rubyforge_project:
|
181
|
+
rubygems_version: 1.3.7
|
182
|
+
signing_key:
|
183
|
+
specification_version: 3
|
184
|
+
summary: Ticketmaster Provider for Zendesk
|
185
|
+
test_files:
|
186
|
+
- spec/comments_spec.rb
|
187
|
+
- spec/projects_spec.rb
|
188
|
+
- spec/spec_helper.rb
|
189
|
+
- spec/ticketmaster-zendesk_spec.rb
|
190
|
+
- spec/tickets_spec.rb
|