ticketmaster-bugzilla 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.md +80 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/lib/provider/bugzilla.rb +46 -0
- data/lib/provider/comment.rb +65 -0
- data/lib/provider/project.rb +82 -0
- data/lib/provider/ticket.rb +95 -0
- data/lib/ticketmaster-bugzilla.rb +35 -0
- data/spec/comments_spec.rb +32 -0
- data/spec/projects_spec.rb +53 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/ticketmaster-bugzilla_spec.rb +11 -0
- data/spec/tickets_spec.rb +52 -0
- data/ticketmaster-bugzilla.gemspec +78 -0
- data/ticketmaster-yourprovder.gemspec +76 -0
- metadata +181 -0
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,80 @@
|
|
1
|
+
# ticketmaster-bugzilla
|
2
|
+
|
3
|
+
This is a provider for [ticketmaster](http://ticketrb.com). It provides interoperability with [Bugzilla](http://bugzilla.org) and it's issue tracking system through the ticketmaster gem.
|
4
|
+
|
5
|
+
# Usage and Examples
|
6
|
+
|
7
|
+
First we have to instantiate a new ticketmaster instance, your bugzilla installation should have api access enable:
|
8
|
+
bugzilla = TicketMaster.new(:bugzilla, {:username=> 'foo', :password => "bar", :url => "https://bugzilla.mozilla.org"})
|
9
|
+
|
10
|
+
If you do not pass in the url, username and password, you won't get any information.
|
11
|
+
|
12
|
+
## Finding Projects(Products)
|
13
|
+
|
14
|
+
projects = ticketmaster.projects # All projects
|
15
|
+
projects = ticketmaster.projects([1,2,3]) # A list of projects based on id
|
16
|
+
project = ticketmaster.project(1) # Single project
|
17
|
+
project = ticketmaster.project(:id => 1) # Single project based on attributes
|
18
|
+
|
19
|
+
## Finding Tickets(Bugs)
|
20
|
+
|
21
|
+
tickets = project.tickets # All tickets
|
22
|
+
tickets = project.tickets([1,2,3]) # List of tickets based on id's
|
23
|
+
ticket = project.ticket(1) # Single ticket by id
|
24
|
+
|
25
|
+
## Open Tickets
|
26
|
+
|
27
|
+
ticket = project.ticket!({:summary => "New ticket", :description=> "Body for the very new ticket", :component => "Canvas", :op_sys =>"Linux", :platform => "x86", ... }) # You can add all the attributes for a valid ticket, but the one in th example are the mandatory ones. Here is the list of valid attributes
|
28
|
+
product_id
|
29
|
+
id
|
30
|
+
component_id
|
31
|
+
summary
|
32
|
+
title
|
33
|
+
version
|
34
|
+
op_sys
|
35
|
+
platform
|
36
|
+
priority
|
37
|
+
description
|
38
|
+
alias
|
39
|
+
qa_contact
|
40
|
+
assignee
|
41
|
+
status
|
42
|
+
target_milestone
|
43
|
+
severity
|
44
|
+
|
45
|
+
## Finding comments
|
46
|
+
|
47
|
+
comments = project.tickets.first.comments # All the tickets facility for searchs are available for comments as well
|
48
|
+
comments = project.ticket(1).comments([1,2,3]) # List of comments based on id's
|
49
|
+
|
50
|
+
|
51
|
+
## Requirements
|
52
|
+
|
53
|
+
* rubygems (obviously)
|
54
|
+
* ticketmaster gem (latest version preferred)
|
55
|
+
* jeweler gem (only if you want to repackage and develop)
|
56
|
+
* guitsaru-rubyzilla
|
57
|
+
|
58
|
+
The ticketmaster gem should automatically be installed during the installation of this gem if it is not already installed.
|
59
|
+
|
60
|
+
## Other Notes
|
61
|
+
|
62
|
+
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.
|
63
|
+
|
64
|
+
If you see or find any issues, feel free to open up an issue report.
|
65
|
+
|
66
|
+
|
67
|
+
## Note on Patches/Pull Requests
|
68
|
+
|
69
|
+
* Fork the project.
|
70
|
+
* Make your feature addition or bug fix.
|
71
|
+
* Add tests for it. This is important so we don't break it in a
|
72
|
+
future version unintentionally.
|
73
|
+
* Commit, do not mess with rakefile, version, or history.
|
74
|
+
(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)
|
75
|
+
* Send us a pull request. Bonus points for topic branches.
|
76
|
+
|
77
|
+
## Copyright
|
78
|
+
|
79
|
+
Copyright (c) 2010 The Hybrid Group. See LICENSE for details.
|
80
|
+
|
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-bugzilla"
|
8
|
+
gem.summary = %Q{Ticketmaster Provider for Bugzilla}
|
9
|
+
gem.description = %Q{Allows ticketmaster to interact with Bugzilla.}
|
10
|
+
gem.email = "rafael@hybridgroup.com"
|
11
|
+
gem.homepage = "http://github.com/hybridgroup/ticketmaster-bugzilla"
|
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 "rubyzilla"
|
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-bugzilla#{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
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
# This is the Yoursystem Provider for ticketmaster
|
3
|
+
module Bugzilla
|
4
|
+
include TicketMaster::Provider::Base
|
5
|
+
PROJECT_API = Rubyzilla::Product
|
6
|
+
|
7
|
+
# This is for cases when you want to instantiate using TicketMaster::Provider::Yoursystem.new(auth)
|
8
|
+
def self.new(auth = {})
|
9
|
+
TicketMaster.new(:bugzilla, auth)
|
10
|
+
end
|
11
|
+
|
12
|
+
# declare needed overloaded methods here
|
13
|
+
def authorize(auth = {})
|
14
|
+
@authentication ||= TicketMaster::Authenticator.new(auth)
|
15
|
+
auth = @authentication
|
16
|
+
if (auth.username.nil? || auth.url.nil? || auth.password.nil?)
|
17
|
+
raise "Please provide username, password and url"
|
18
|
+
end
|
19
|
+
url = auth.url.gsub(/\/$/,'')
|
20
|
+
unless url.split('/').last == 'xmlrpc.cgi'
|
21
|
+
auth.url = url+'/xmlrpc.cgi'
|
22
|
+
end
|
23
|
+
@bugzilla = Rubyzilla::Bugzilla.new(auth.url)
|
24
|
+
@bugzilla.login(auth.username,auth.password)
|
25
|
+
end
|
26
|
+
|
27
|
+
def projects(*options)
|
28
|
+
if options.empty?
|
29
|
+
PROJECT_API.list.collect { |product| Project.new product }
|
30
|
+
elsif options.first.is_a? Array
|
31
|
+
options.first.collect { |id| Project.find(id) }
|
32
|
+
elsif options.first.is_a? Hash
|
33
|
+
Project.find_by_attributes(options)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def project(*options)
|
38
|
+
unless options.empty?
|
39
|
+
Project.find(options.first)
|
40
|
+
else
|
41
|
+
super
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Bugzilla
|
3
|
+
# The comment class for ticketmaster-bugzilla
|
4
|
+
#
|
5
|
+
# Do any mapping between Ticketmaster and your system's comment model here
|
6
|
+
# versions of the ticket.
|
7
|
+
#
|
8
|
+
COMMENT_API = Rubyzilla::Bug
|
9
|
+
class Comment < TicketMaster::Provider::Base::Comment
|
10
|
+
# declare needed overloaded methods here
|
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 = {:id => object.id,
|
17
|
+
:ticket_id => object.bug_id,
|
18
|
+
:body => object.text,
|
19
|
+
:author => object.creator,
|
20
|
+
:created_at => object.time,
|
21
|
+
:updated_at => object.time}
|
22
|
+
|
23
|
+
else
|
24
|
+
hash = object
|
25
|
+
end
|
26
|
+
super hash
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def created_at
|
31
|
+
begin
|
32
|
+
normalize_datetime(self[:time])
|
33
|
+
rescue
|
34
|
+
self[:created_at]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def updated_at
|
39
|
+
begin
|
40
|
+
normalize_datetime(self[:time])
|
41
|
+
rescue
|
42
|
+
self[:updated_at]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.find_by_id(ticket_id, id)
|
47
|
+
self.new COMMENT_API.new(ticket_id).comments(:comment_ids => [id]).first
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.find(ticket_id, *options)
|
51
|
+
if options.first.empty?
|
52
|
+
COMMENT_API.new(ticket_id).comments.collect { |comment| self.new comment }
|
53
|
+
elsif options[0].first.is_a? Array
|
54
|
+
COMMENT_API.new(ticket_id).comments(:comment_ids => options[0].first).collect { |comment| self.new comment }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
def normalize_datetime(datetime)
|
60
|
+
Time.mktime(datetime.year, datetime.month, datetime.day, datetime.hour, datetime.min, datetime.sec)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Bugzilla
|
3
|
+
# Project class for ticketmaster-bugzilla
|
4
|
+
#
|
5
|
+
class Project < TicketMaster::Provider::Base::Project
|
6
|
+
# declare needed overloaded methods here
|
7
|
+
PRODUCT_API = Rubyzilla::Product
|
8
|
+
|
9
|
+
# TODO: Add created_at and updated_at
|
10
|
+
def initialize(*object)
|
11
|
+
if object.first
|
12
|
+
object = object.first
|
13
|
+
unless object.is_a? Hash
|
14
|
+
@system_data = {:client => object}
|
15
|
+
hash = {:id => object.id,
|
16
|
+
:name => object.name,
|
17
|
+
:description => object.name,
|
18
|
+
:created_at => nil,
|
19
|
+
:updated_at => nil}
|
20
|
+
else
|
21
|
+
hash = object
|
22
|
+
end
|
23
|
+
super(hash)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# copy from this.copy(that) copies that into this
|
28
|
+
def copy(project)
|
29
|
+
project.tickets.each do |ticket|
|
30
|
+
copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
|
31
|
+
ticket.comments.each do |comment|
|
32
|
+
copy_ticket.comment!(:body => comment.body)
|
33
|
+
sleep 1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.find_by_id(id)
|
39
|
+
self.new PRODUCT_API.new id
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.find_by_attributes(*options)
|
43
|
+
options = options.first
|
44
|
+
if options.is_a? Hash
|
45
|
+
self.find_all.select do |project|
|
46
|
+
options.inject(true) do |memo, kv|
|
47
|
+
break unless memo
|
48
|
+
key, value = kv
|
49
|
+
begin
|
50
|
+
memo &= project.send(key) == value
|
51
|
+
rescue NoMethodError
|
52
|
+
memo = false
|
53
|
+
end
|
54
|
+
memo
|
55
|
+
end
|
56
|
+
end
|
57
|
+
else
|
58
|
+
self.find_all.select do |project|
|
59
|
+
options.any? { |id| project.id == id }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.find_all(*options)
|
65
|
+
PRODUCT_API.list.collect { |product| self.new product }
|
66
|
+
end
|
67
|
+
|
68
|
+
def tickets(*options)
|
69
|
+
TicketMaster::Provider::Bugzilla::Ticket.find(self.id, options)
|
70
|
+
end
|
71
|
+
|
72
|
+
def ticket(*options)
|
73
|
+
TicketMaster::Provider::Bugzilla::Ticket.find_by_id(options.first)
|
74
|
+
end
|
75
|
+
|
76
|
+
def ticket!(*options)
|
77
|
+
TicketMaster::Provider::Bugzilla::Ticket.create(self.id,*options)
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Bugzilla
|
3
|
+
# Ticket class for ticketmaster-bugzilla
|
4
|
+
#
|
5
|
+
|
6
|
+
class Ticket < TicketMaster::Provider::Base::Ticket
|
7
|
+
# declare needed overloaded methods here
|
8
|
+
TICKETS_API = Rubyzilla::Product
|
9
|
+
def initialize(*object)
|
10
|
+
object = object.first
|
11
|
+
@system_data = {:client => object}
|
12
|
+
unless object.is_a? Hash
|
13
|
+
hash = {:product_id => object.product_id,
|
14
|
+
:id => object.id,
|
15
|
+
:component_id => object.component_id,
|
16
|
+
:summary => object.summary,
|
17
|
+
:title => object.summary,
|
18
|
+
:version => object.version,
|
19
|
+
:op_sys => object.op_sys,
|
20
|
+
:platform => object.platform,
|
21
|
+
:priority => object.priority,
|
22
|
+
:description => object.description,
|
23
|
+
:alias => object.alias,
|
24
|
+
:qa_contact => object.qa_contact,
|
25
|
+
:assignee => object.qa_contact,
|
26
|
+
:status => object.status,
|
27
|
+
:target_milestone => object.target_milestone,
|
28
|
+
:severity => object.severity,
|
29
|
+
:created_at => nil,
|
30
|
+
:updated_at => nil}
|
31
|
+
else
|
32
|
+
hash = object
|
33
|
+
end
|
34
|
+
super hash
|
35
|
+
end
|
36
|
+
|
37
|
+
def created_at
|
38
|
+
begin
|
39
|
+
normalize_datetime(self[:last_change_time])
|
40
|
+
rescue
|
41
|
+
self[:created_at]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def updated_at
|
46
|
+
begin
|
47
|
+
normalize_datetime(self[:last_change_time])
|
48
|
+
rescue
|
49
|
+
self[:updated_at]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.find_by_id(id)
|
54
|
+
self.new Rubyzilla::Bug.new id
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.find(project_id, *options)
|
58
|
+
if options.first.empty?
|
59
|
+
TICKETS_API.new(project_id).bugs.collect { |bug| self.new bug }
|
60
|
+
elsif options.first.is_a? Array
|
61
|
+
TICKETS_API.new(project_id).bugs.collect { |bug| self.new bug }
|
62
|
+
elsif options[0].first.is_a? Hash
|
63
|
+
TICKETS_API.new(project_id).bugs(options[0].first).collect { |bug| self.new bug }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.create(project_id, *options)
|
68
|
+
begin
|
69
|
+
bug = Rubyzilla::Bug.new
|
70
|
+
bug.product = TICKETS_API.new project_id
|
71
|
+
options.first.each_pair do |k, v|
|
72
|
+
bug.send "#{k}=", v
|
73
|
+
end
|
74
|
+
self.new bug.create
|
75
|
+
rescue
|
76
|
+
self.find(project_id, []).last
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def comments(*options)
|
81
|
+
Comment.find(self.id, options)
|
82
|
+
end
|
83
|
+
|
84
|
+
def comment(*options)
|
85
|
+
Comment.find_by_id(self.id, options.first)
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
def normalize_datetime(datetime)
|
90
|
+
Time.mktime(datetime.year, datetime.month, datetime.day, datetime.hour, datetime.min, datetime.sec)
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubyzilla'
|
2
|
+
|
3
|
+
module Rubyzilla
|
4
|
+
class Product
|
5
|
+
def bugs(attributes = {})
|
6
|
+
if attributes.empty?
|
7
|
+
attributes.merge!(:last_change_time => Time.now-30*24*60*60)
|
8
|
+
end
|
9
|
+
attributes.merge!(:product => self.name, :limit => 100)
|
10
|
+
result = Bugzilla.server.call("Bug.search", attributes)
|
11
|
+
result["bugs"]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Bug
|
16
|
+
def comments(attributes = {})
|
17
|
+
if !attributes.has_key? :comment_ids
|
18
|
+
attributes.merge!({:ids => [self.id]})
|
19
|
+
end
|
20
|
+
comments = []
|
21
|
+
result = Bugzilla.server.call("Bug.comments", attributes)
|
22
|
+
if attributes.has_key? :ids
|
23
|
+
comments = result["bugs"]["#{self.id}"]["comments"]
|
24
|
+
else
|
25
|
+
attributes[:comment_ids].each { |comment_id| comments << result["comments"]["#{comment_id}"] }
|
26
|
+
end
|
27
|
+
comments
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
%w{ bugzilla ticket project comment }.each do |f|
|
33
|
+
require File.dirname(__FILE__) + '/provider/' + f + '.rb';
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Bugzilla::Comment" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@klass = TicketMaster::Provider::Bugzilla::Comment
|
7
|
+
end
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@ticketmaster = TicketMaster.new(:bugzilla, {:username => 'george.rafael@gmail.com', :password => '123456', :url => 'https://landfill.bugzilla.org/bugzilla-3.6-branch'})
|
11
|
+
@project = @ticketmaster.project(1)
|
12
|
+
@ticket = @project.ticket(7039)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be able to load all comments from a ticket" do
|
16
|
+
comments = @ticket.comments
|
17
|
+
comments.should be_an_instance_of(Array)
|
18
|
+
comments.first.should be_an_instance_of(@klass)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be able to load all comments based on array of id's" do
|
22
|
+
comments = @ticket.comments([18575])
|
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 a comment based on an id" do
|
28
|
+
comment = @ticket.comment(18575)
|
29
|
+
comment.should be_an_instance_of(@klass)
|
30
|
+
comment.id.should == 18575
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Bugzilla::Project" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@core = {:id => 1, :name => 'Core'}
|
7
|
+
@projects = [@core]
|
8
|
+
@klass = TicketMaster::Provider::Bugzilla::Project
|
9
|
+
end
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
@ticketmaster = TicketMaster.new(:bugzilla, {:username => 'george.rafael@gmail.com', :password => '123456', :url => 'https://landfill.bugzilla.org/bugzilla-3.6-branch'})
|
13
|
+
Rubyzilla::Product.stub!(:list).and_return(@projects)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should be able to load all projects" do
|
17
|
+
@ticketmaster.projects.should be_an_instance_of(Array)
|
18
|
+
@ticketmaster.projects.first.should be_an_instance_of(@klass)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should be able to load projects using an array of id's" do
|
22
|
+
projects = @ticketmaster.projects([1,2,3])
|
23
|
+
projects.should be_an_instance_of(Array)
|
24
|
+
projects.first.should be_an_instance_of(@klass)
|
25
|
+
projects.first.name.should == 'WorldControl'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be able to find a project by id" do
|
29
|
+
project = @ticketmaster.project(1)
|
30
|
+
project.should be_an_instance_of(@klass)
|
31
|
+
project.name.should == 'WorldControl'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to load project using the find method" do
|
35
|
+
project = @ticketmaster.project.find(1)
|
36
|
+
project.should be_an_instance_of(@klass)
|
37
|
+
project.name.should == 'WorldControl'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should be able to find by attributes" do
|
41
|
+
project = @ticketmaster.project.find(:first, {:name => 'Core'})
|
42
|
+
project.should be_an_instance_of(@klass)
|
43
|
+
project.name.should == 'Core'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be able to find by an array of id's" do
|
47
|
+
project = @ticketmaster.project.find(:all, [1,2])
|
48
|
+
project.should be_an_instance_of(Array)
|
49
|
+
project.first.should be_an_instance_of(@klass)
|
50
|
+
project.first.name.should == 'Core'
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
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-bugzilla'
|
6
|
+
require 'spec'
|
7
|
+
require 'spec/autorun'
|
8
|
+
|
9
|
+
Spec::Runner.configure do |config|
|
10
|
+
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Bugzilla" do
|
4
|
+
|
5
|
+
it "should be able to instantiate a new instance" do
|
6
|
+
@ticketmaster = TicketMaster.new(:bugzilla, {:username => 'george.rafael@gmail.com', :password => '123456', :url => 'https://landfill.bugzilla.org/bugzilla-3.6-branch'})
|
7
|
+
@ticketmaster.should be_an_instance_of(TicketMaster)
|
8
|
+
@ticketmaster.should be_a_kind_of(TicketMaster::Provider::Bugzilla)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Bugzilla::Ticket" do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@klass = TicketMaster::Provider::Bugzilla::Ticket
|
7
|
+
bug = {:id => 7039}
|
8
|
+
Rubyzilla::Product.stub!(:bugs).and_return([bug])
|
9
|
+
Rubyzilla::Bug.stub!(:create).and_return(bug)
|
10
|
+
end
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
@ticketmaster = TicketMaster.new(:bugzilla, {:username => 'george.rafael@gmail.com', :password => '123456', :url =>'https://landfill.bugzilla.org/bugzilla-3.6-branch'})
|
14
|
+
@project = @ticketmaster.project(1)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be able to load all tickets" do
|
18
|
+
tickets = @project.tickets
|
19
|
+
tickets.should be_an_instance_of(Array)
|
20
|
+
tickets.first.should be_an_instance_of(@klass)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to load all tickets from an array of id's" do
|
24
|
+
tickets = @project.tickets([7039])
|
25
|
+
tickets.should be_an_instance_of(Array)
|
26
|
+
tickets.first.should be_an_instance_of(@klass)
|
27
|
+
tickets.first.id.should == 1
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should be able to search tickets based on id attribute" do
|
31
|
+
tickets = @project.tickets(:id => 7039)
|
32
|
+
tickets.should be_an_instance_of(Array)
|
33
|
+
tickets.first.should be_an_instance_of(@klass)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to search a ticket by id" do
|
37
|
+
ticket = @project.ticket(7039)
|
38
|
+
ticket.should be_an_instance_of(@klass)
|
39
|
+
ticket.id.should == 7039
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be able to return a ticket by attributes" do
|
43
|
+
ticket = @project.ticket(:id => 7039)
|
44
|
+
ticket.should be_an_instance_of(@klass)
|
45
|
+
ticket.id.should == 7039
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be able to create a ticket" do
|
49
|
+
ticket = @project.ticket!(:summary => "The program crashes", :description => "It crashes", :component => "EconomicControl", :op_sys => "Linux", :platform => "x86")
|
50
|
+
ticket.should be_an_instance_of(@klass)
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ticketmaster-bugzilla}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Rafael George"]
|
12
|
+
s.date = %q{2011-01-26}
|
13
|
+
s.description = %q{Allows ticketmaster to interact with Bugzilla.}
|
14
|
+
s.email = %q{rafael@hybridgroup.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"LICENSE",
|
21
|
+
"README.md",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"lib/provider/bugzilla.rb",
|
25
|
+
"lib/provider/comment.rb",
|
26
|
+
"lib/provider/project.rb",
|
27
|
+
"lib/provider/ticket.rb",
|
28
|
+
"lib/ticketmaster-bugzilla.rb",
|
29
|
+
"spec/comments_spec.rb",
|
30
|
+
"spec/projects_spec.rb",
|
31
|
+
"spec/spec.opts",
|
32
|
+
"spec/spec_helper.rb",
|
33
|
+
"spec/ticketmaster-bugzilla_spec.rb",
|
34
|
+
"spec/tickets_spec.rb",
|
35
|
+
"ticketmaster-bugzilla.gemspec",
|
36
|
+
"ticketmaster-yourprovder.gemspec"
|
37
|
+
]
|
38
|
+
s.homepage = %q{http://github.com/hybridgroup/ticketmaster-bugzilla}
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = %q{1.3.7}
|
41
|
+
s.summary = %q{Ticketmaster Provider for Bugzilla}
|
42
|
+
s.test_files = [
|
43
|
+
"spec/comments_spec.rb",
|
44
|
+
"spec/projects_spec.rb",
|
45
|
+
"spec/spec_helper.rb",
|
46
|
+
"spec/ticketmaster-bugzilla_spec.rb",
|
47
|
+
"spec/tickets_spec.rb"
|
48
|
+
]
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
56
|
+
s.add_runtime_dependency(%q<ticketmaster>, [">= 0.1.0"])
|
57
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.2"])
|
58
|
+
s.add_runtime_dependency(%q<activeresource>, [">= 2.3.2"])
|
59
|
+
s.add_runtime_dependency(%q<addressable>, [">= 2.1.2"])
|
60
|
+
s.add_runtime_dependency(%q<rubyzilla>, [">= 0"])
|
61
|
+
else
|
62
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
63
|
+
s.add_dependency(%q<ticketmaster>, [">= 0.1.0"])
|
64
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.2"])
|
65
|
+
s.add_dependency(%q<activeresource>, [">= 2.3.2"])
|
66
|
+
s.add_dependency(%q<addressable>, [">= 2.1.2"])
|
67
|
+
s.add_dependency(%q<rubyzilla>, [">= 0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
71
|
+
s.add_dependency(%q<ticketmaster>, [">= 0.1.0"])
|
72
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.2"])
|
73
|
+
s.add_dependency(%q<activeresource>, [">= 2.3.2"])
|
74
|
+
s.add_dependency(%q<addressable>, [">= 2.1.2"])
|
75
|
+
s.add_dependency(%q<rubyzilla>, [">= 0"])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ticketmaster-yourprovder}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Rafael George"]
|
12
|
+
s.date = %q{2011-01-25}
|
13
|
+
s.description = %q{Allows ticketmaster to interact with Bugzilla.}
|
14
|
+
s.email = %q{george.rafael@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"LICENSE",
|
21
|
+
"README.md",
|
22
|
+
"Rakefile",
|
23
|
+
"VERSION",
|
24
|
+
"lib/provider/bugzilla.rb",
|
25
|
+
"lib/provider/comment.rb",
|
26
|
+
"lib/provider/project.rb",
|
27
|
+
"lib/provider/ticket.rb",
|
28
|
+
"lib/ticketmaster-bugzilla.rb",
|
29
|
+
"spec/comments_spec.rb",
|
30
|
+
"spec/projects_spec.rb",
|
31
|
+
"spec/spec.opts",
|
32
|
+
"spec/spec_helper.rb",
|
33
|
+
"spec/ticketmaster-bugzilla_spec.rb",
|
34
|
+
"spec/tickets_spec.rb"
|
35
|
+
]
|
36
|
+
s.homepage = %q{http://bandw.tumblr.com}
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.7}
|
39
|
+
s.summary = %q{Ticketmaster Provider for Bugzilla}
|
40
|
+
s.test_files = [
|
41
|
+
"spec/comments_spec.rb",
|
42
|
+
"spec/projects_spec.rb",
|
43
|
+
"spec/spec_helper.rb",
|
44
|
+
"spec/ticketmaster-bugzilla_spec.rb",
|
45
|
+
"spec/tickets_spec.rb"
|
46
|
+
]
|
47
|
+
|
48
|
+
if s.respond_to? :specification_version then
|
49
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
|
+
s.specification_version = 3
|
51
|
+
|
52
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
54
|
+
s.add_runtime_dependency(%q<ticketmaster>, [">= 0.1.0"])
|
55
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.2"])
|
56
|
+
s.add_runtime_dependency(%q<activeresource>, [">= 2.3.2"])
|
57
|
+
s.add_runtime_dependency(%q<addressable>, [">= 2.1.2"])
|
58
|
+
s.add_runtime_dependency(%q<guitsaru-rubyzilla>, [">= 0"])
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
61
|
+
s.add_dependency(%q<ticketmaster>, [">= 0.1.0"])
|
62
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.2"])
|
63
|
+
s.add_dependency(%q<activeresource>, [">= 2.3.2"])
|
64
|
+
s.add_dependency(%q<addressable>, [">= 2.1.2"])
|
65
|
+
s.add_dependency(%q<guitsaru-rubyzilla>, [">= 0"])
|
66
|
+
end
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
69
|
+
s.add_dependency(%q<ticketmaster>, [">= 0.1.0"])
|
70
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.2"])
|
71
|
+
s.add_dependency(%q<activeresource>, [">= 2.3.2"])
|
72
|
+
s.add_dependency(%q<addressable>, [">= 2.1.2"])
|
73
|
+
s.add_dependency(%q<guitsaru-rubyzilla>, [">= 0"])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ticketmaster-bugzilla
|
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-01-26 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: rubyzilla
|
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 Bugzilla.
|
116
|
+
email: rafael@hybridgroup.com
|
117
|
+
executables: []
|
118
|
+
|
119
|
+
extensions: []
|
120
|
+
|
121
|
+
extra_rdoc_files:
|
122
|
+
- LICENSE
|
123
|
+
- README.md
|
124
|
+
files:
|
125
|
+
- LICENSE
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- VERSION
|
129
|
+
- lib/provider/bugzilla.rb
|
130
|
+
- lib/provider/comment.rb
|
131
|
+
- lib/provider/project.rb
|
132
|
+
- lib/provider/ticket.rb
|
133
|
+
- lib/ticketmaster-bugzilla.rb
|
134
|
+
- spec/comments_spec.rb
|
135
|
+
- spec/projects_spec.rb
|
136
|
+
- spec/spec.opts
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
- spec/ticketmaster-bugzilla_spec.rb
|
139
|
+
- spec/tickets_spec.rb
|
140
|
+
- ticketmaster-bugzilla.gemspec
|
141
|
+
- ticketmaster-yourprovder.gemspec
|
142
|
+
has_rdoc: true
|
143
|
+
homepage: http://github.com/hybridgroup/ticketmaster-bugzilla
|
144
|
+
licenses: []
|
145
|
+
|
146
|
+
post_install_message:
|
147
|
+
rdoc_options: []
|
148
|
+
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
hash: 3
|
157
|
+
segments:
|
158
|
+
- 0
|
159
|
+
version: "0"
|
160
|
+
required_rubygems_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
|
+
requirements: []
|
170
|
+
|
171
|
+
rubyforge_project:
|
172
|
+
rubygems_version: 1.3.7
|
173
|
+
signing_key:
|
174
|
+
specification_version: 3
|
175
|
+
summary: Ticketmaster Provider for Bugzilla
|
176
|
+
test_files:
|
177
|
+
- spec/comments_spec.rb
|
178
|
+
- spec/projects_spec.rb
|
179
|
+
- spec/spec_helper.rb
|
180
|
+
- spec/ticketmaster-bugzilla_spec.rb
|
181
|
+
- spec/tickets_spec.rb
|