ticketmaster-bugherd 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +51 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/lib/bugherd/bugherd-api.rb +39 -0
- data/lib/provider/bugherd.rb +37 -0
- data/lib/provider/comment.rb +14 -0
- data/lib/provider/project.rb +26 -0
- data/lib/provider/ticket.rb +44 -0
- data/lib/ticketmaster-bugherd.rb +5 -0
- data/request.xml +4 -0
- data/spec/comments_spec.rb +7 -0
- data/spec/fixtures/projects.xml +8 -0
- data/spec/fixtures/projects/1458.xml +14 -0
- data/spec/fixtures/tasks.xml +17 -0
- data/spec/fixtures/tasks/4950.xml +16 -0
- data/spec/fixtures/users.xml +9 -0
- data/spec/projects_spec.rb +58 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/ticketmaster-bugherd_spec.rb +34 -0
- data/spec/tickets_spec.rb +66 -0
- data/ticketmaster-bugherd.gemspec +84 -0
- metadata +203 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.8.7@ticketmaster-bugherd --create
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem "ticketmaster", "~> 0.6.0"
|
7
|
+
gem "activesupport", "~> 3.0.0"
|
8
|
+
gem "activeresource", "~> 3.0.0"
|
9
|
+
# Add dependencies to develop your gem here.
|
10
|
+
# Include everything needed to run rake, tests, features, etc.
|
11
|
+
group :development do
|
12
|
+
gem "rspec", "~> 2.3.0"
|
13
|
+
gem "bundler", "~> 1.0.0"
|
14
|
+
gem "jeweler", "~> 1.6.4"
|
15
|
+
gem "rcov", ">= 0"
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (3.0.9)
|
5
|
+
activesupport (= 3.0.9)
|
6
|
+
builder (~> 2.1.2)
|
7
|
+
i18n (~> 0.5.0)
|
8
|
+
activeresource (3.0.9)
|
9
|
+
activemodel (= 3.0.9)
|
10
|
+
activesupport (= 3.0.9)
|
11
|
+
activesupport (3.0.9)
|
12
|
+
builder (2.1.2)
|
13
|
+
diff-lcs (1.1.2)
|
14
|
+
git (1.2.5)
|
15
|
+
hashie (1.0.0)
|
16
|
+
i18n (0.5.0)
|
17
|
+
jeweler (1.6.4)
|
18
|
+
bundler (~> 1.0)
|
19
|
+
git (>= 1.2.5)
|
20
|
+
rake
|
21
|
+
rake (0.9.2)
|
22
|
+
rcov (0.9.10)
|
23
|
+
rspec (2.3.0)
|
24
|
+
rspec-core (~> 2.3.0)
|
25
|
+
rspec-expectations (~> 2.3.0)
|
26
|
+
rspec-mocks (~> 2.3.0)
|
27
|
+
rspec-core (2.3.1)
|
28
|
+
rspec-expectations (2.3.0)
|
29
|
+
diff-lcs (~> 1.1.2)
|
30
|
+
rspec-mocks (2.3.0)
|
31
|
+
ticketmaster (0.6.6)
|
32
|
+
activeresource
|
33
|
+
activeresource (>= 2.3.2)
|
34
|
+
activesupport
|
35
|
+
activesupport (>= 2.3.2)
|
36
|
+
hashie (= 1.0.0)
|
37
|
+
hashie
|
38
|
+
jeweler
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
x86-mingw32
|
43
|
+
|
44
|
+
DEPENDENCIES
|
45
|
+
activeresource (~> 3.0.0)
|
46
|
+
activesupport (~> 3.0.0)
|
47
|
+
bundler (~> 1.0.0)
|
48
|
+
jeweler (~> 1.6.4)
|
49
|
+
rcov
|
50
|
+
rspec (~> 2.3.0)
|
51
|
+
ticketmaster (~> 0.6.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Rafael George
|
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
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= ticketmaster-bugherd
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to ticketmaster-bugherd
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Rafael George. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "ticketmaster-bugherd"
|
18
|
+
gem.homepage = "http://github.com/cored/ticketmaster-bugherd"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Ticketmaster provider for Bugherd}
|
21
|
+
gem.description = %Q{Ticketmaster provider for Bugherd}
|
22
|
+
gem.email = "george.rafael@gmail.com"
|
23
|
+
gem.authors = ["Rafael George"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "ticketmaster-bugherd #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_resource'
|
4
|
+
|
5
|
+
module BugherdAPI
|
6
|
+
class Error < StandardError; end
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def authenticate(email, password)
|
10
|
+
@email = email
|
11
|
+
@password = password
|
12
|
+
self::Base.user = email
|
13
|
+
self::Base.password = password
|
14
|
+
end
|
15
|
+
|
16
|
+
def resources
|
17
|
+
@resources ||= []
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Base < ActiveResource::Base
|
22
|
+
self.format = :xml
|
23
|
+
self.site = 'http://www.bugherd.com/api_v1/'
|
24
|
+
def self.inherited(base)
|
25
|
+
BugherdAPI.resources << base
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class User < Base
|
31
|
+
end
|
32
|
+
|
33
|
+
class Project < Base
|
34
|
+
end
|
35
|
+
|
36
|
+
class Task < Base
|
37
|
+
self.site += 'projects/:project_id/'
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
# This is the Bugherd Provider for ticketmaster
|
3
|
+
module Bugherd
|
4
|
+
include TicketMaster::Provider::Base
|
5
|
+
#TICKET_API = Bugherd::Ticket # The class to access the api's tickets
|
6
|
+
PROJECT_API = BugherdAPI::Project # The class to access the api's projects
|
7
|
+
|
8
|
+
# This is for cases when you want to instantiate using TicketMaster::Provider::Bugherd.new(auth)
|
9
|
+
def self.new(auth = {})
|
10
|
+
TicketMaster.new(:bugherd, auth)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Providers must define an authorize method. This is used to initialize and set authentication
|
14
|
+
# parameters to access the API
|
15
|
+
def authorize(auth = {})
|
16
|
+
@authentication ||= TicketMaster::Authenticator.new(auth)
|
17
|
+
auth = @authentication
|
18
|
+
if (auth.email.empty? || auth.password.empty?)
|
19
|
+
raise "You must provide email and password for authentication"
|
20
|
+
end
|
21
|
+
BugherdAPI.authenticate(auth.email, auth.password)
|
22
|
+
# Set authentication parameters for whatever you're using to access the API
|
23
|
+
end
|
24
|
+
|
25
|
+
# declare needed overloaded methods here
|
26
|
+
def valid?
|
27
|
+
begin
|
28
|
+
!BugherdAPI::User.find(:first).nil?
|
29
|
+
rescue
|
30
|
+
false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Bugherd
|
3
|
+
# The comment class for ticketmaster-bugherd
|
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
|
+
#API = Bugherd::Comment # The class to access the api's comments
|
10
|
+
# declare needed overloaded methods here
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Bugherd
|
3
|
+
# Project class for ticketmaster-bugherd
|
4
|
+
#
|
5
|
+
#
|
6
|
+
class Project < TicketMaster::Provider::Base::Project
|
7
|
+
API = BugherdAPI::Project # The class to access the api's projects
|
8
|
+
# declare needed overloaded methods here
|
9
|
+
|
10
|
+
|
11
|
+
# copy from this.copy(that) copies that into this
|
12
|
+
def copy(project)
|
13
|
+
project.tickets.each do |ticket|
|
14
|
+
copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
|
15
|
+
ticket.comments.each do |comment|
|
16
|
+
copy_ticket.comment!(:body => comment.body)
|
17
|
+
sleep 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Bugherd
|
3
|
+
# Ticket class for ticketmaster-bugherd
|
4
|
+
#
|
5
|
+
|
6
|
+
class Ticket < TicketMaster::Provider::Base::Ticket
|
7
|
+
API = BugherdAPI::Task# The class to access the api's tickets
|
8
|
+
STATUS = %w{new todo active declined fixed closed}
|
9
|
+
PRIORITY = %w{- critical important normal minor}
|
10
|
+
# declare needed overloaded methods here
|
11
|
+
|
12
|
+
def status
|
13
|
+
STATUS[self[:status_id]]
|
14
|
+
end
|
15
|
+
|
16
|
+
def priority
|
17
|
+
PRIORITY[self[:priority_id]]
|
18
|
+
end
|
19
|
+
|
20
|
+
def assignee
|
21
|
+
user = BugherdAPI::User.find(:all).select do |user|
|
22
|
+
user.id == self[:assigned_to_id]
|
23
|
+
end.first
|
24
|
+
"#{user.name} #{user.surname}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def project_id
|
28
|
+
self.prefix_options[:project_id]
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.search(project_id, options = {}, limit = 1000)
|
32
|
+
API.find(:all, :params => {:project_id => project_id}).collect do |task|
|
33
|
+
self.new task
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def comments(*options)
|
38
|
+
warn "Bugherd API doesn't support comments"
|
39
|
+
[]
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/request.xml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project>
|
3
|
+
<id type="integer">1458</id>
|
4
|
+
<name>clutchapptest</name>
|
5
|
+
<devurl>http://clutchapptest.ticketmaster.com</devurl>
|
6
|
+
<users type="array">
|
7
|
+
<user>
|
8
|
+
<id type="integer">1798</id>
|
9
|
+
<email>george.rafael@gmail.com</email>
|
10
|
+
<name>Rafael</name>
|
11
|
+
<surname>George</surname>
|
12
|
+
</user>
|
13
|
+
</users>
|
14
|
+
</project>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<tasks type="array">
|
3
|
+
<task>
|
4
|
+
<id type="integer">4950</id>
|
5
|
+
<description>Now this one should be green not red</description>
|
6
|
+
<status-id type="integer">2</status-id>
|
7
|
+
<priority-id type="integer" nil="true"></priority-id>
|
8
|
+
<assigned-to-id type="integer">1798</assigned-to-id>
|
9
|
+
</task>
|
10
|
+
<task>
|
11
|
+
<id type="integer">4949</id>
|
12
|
+
<description>This button should use another color</description>
|
13
|
+
<status-id type="integer">2</status-id>
|
14
|
+
<priority-id type="integer" nil="true"></priority-id>
|
15
|
+
<assigned-to-id type="integer">1798</assigned-to-id>
|
16
|
+
</task>
|
17
|
+
</tasks>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<task>
|
3
|
+
<id type="integer">4950</id>
|
4
|
+
<description>Now this one should be green not red</description>
|
5
|
+
<status-id type="integer">2</status-id>
|
6
|
+
<priority-id type="integer" nil="true">1</priority-id>
|
7
|
+
<assigned-to-id type="integer">1798</assigned-to-id>
|
8
|
+
<comments type="array">
|
9
|
+
<comment>
|
10
|
+
<id type="integer">9760</id>
|
11
|
+
<created-at type="datetime">2011-08-18T19:57:56Z</created-at>
|
12
|
+
<text>I'm working on this already</text>
|
13
|
+
<user-id type="integer">1798</user-id>
|
14
|
+
</comment>
|
15
|
+
</comments>
|
16
|
+
</task>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "TicketMaster::Provider::Bugherd::Project" do
|
4
|
+
before(:each) do
|
5
|
+
@tm = TicketMaster.new(:bugherd, :email => 'user@email.com',
|
6
|
+
:password => '0000')
|
7
|
+
@klass = TicketMaster::Provider::Bugherd::Project
|
8
|
+
headers = {'Authorization' => 'Basic dXNlckBlbWFpbC5jb206MDAwMA==', 'Accept' => 'application/xml'}
|
9
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
10
|
+
mock.get '/api_v1/projects.xml', headers, fixture_for('projects', 'xml'), 200
|
11
|
+
mock.get '/api_v1/projects/1458.xml', headers, fixture_for('/projects/1458', 'xml'), 200
|
12
|
+
end
|
13
|
+
@project_id = 1458
|
14
|
+
end
|
15
|
+
|
16
|
+
context "Loading all projects" do
|
17
|
+
it "should be able to retrieve all projects" do
|
18
|
+
projects = @tm.projects
|
19
|
+
projects.should be_an_instance_of(Array)
|
20
|
+
projects.first.should be_an_instance_of(@klass)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to retrieve all projects based on an array of id's" do
|
24
|
+
projects = @tm.projects([@project_id])
|
25
|
+
projects.should be_an_instance_of(Array)
|
26
|
+
projects.first.should be_an_instance_of(@klass)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be able to retrieve all projects using attributes" do
|
30
|
+
projects = @tm.projects(:id => @project_id)
|
31
|
+
projects.should be_an_instance_of(Array)
|
32
|
+
projects.first.should be_an_instance_of(@klass)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "Loading a single project" do
|
37
|
+
it "should be able to retrieve a single project based on id" do
|
38
|
+
project = @tm.project(@project_id)
|
39
|
+
project.should be_an_instance_of(@klass)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be able to retrieve a single project based on attributes" do
|
43
|
+
project = @tm.project(:id => @project_id)
|
44
|
+
project.should be_an_instance_of(@klass)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "Project creation and update" do
|
49
|
+
it "should be able to create a project"
|
50
|
+
it "should be able to update a project"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should contain all mandatory fields for projects" do
|
54
|
+
project = @tm.project(@project_id)
|
55
|
+
project.id.should == 1458
|
56
|
+
project.name.should == 'clutchapptest'
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'ticketmaster'
|
4
|
+
require 'rspec'
|
5
|
+
require 'ticketmaster-bugherd'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def fixture_for(name, format = 'xml')
|
16
|
+
File.read(File.dirname(__FILE__) + "/fixtures/#{name}.#{format}")
|
17
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "TicketmasterBugherd" do
|
4
|
+
before(:each) do
|
5
|
+
@tm = TicketMaster.new(:bugherd, :email => 'user@bugherd.com', :password => '123456')
|
6
|
+
headers = {'Authorization' => 'Basic dXNlckBidWdoZXJkLmNvbToxMjM0NTY=', 'Accept' => 'application/xml'}
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/api_v1/users.xml', headers, fixture_for('users', 'xml'), 200
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context "Initialization and validation" do
|
13
|
+
it "should be able to initialize a ticketmaster object" do
|
14
|
+
@tm.should be_an_instance_of(TicketMaster)
|
15
|
+
@tm.should be_a_kind_of(TicketMaster::Provider::Bugherd)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should validate the ticketmaster instance" do
|
19
|
+
@tm.valid?.should be_true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "Raise exceptions" do
|
24
|
+
it "should raise an exception without email or password" do
|
25
|
+
lambda { @tm = TicketMaster.new(:bugherd, :email => '', :password => '') }.should raise_error
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should raise an exception with an user message" do
|
29
|
+
lambda { @tm = TicketMaster.new(:bugherd, :email => '', :password => '')}.should raise_error("You must provide email and password for authentication")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "TicketMaster::Provider::Bugherd::Ticket" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
headers = { 'Authorization' => 'Basic Z2VvcmdlLnJhZmFlbEBnbWFpbC5jb206MTIzNDU2', 'Accept' => 'application/xml'}
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/api_v1/projects/1458.xml', headers, fixture_for('/projects/1458', 'xml'), 200
|
9
|
+
mock.get '/api_v1/projects/1458/tasks.xml', headers, fixture_for('tasks', 'xml'), 200
|
10
|
+
mock.get '/api_v1/projects/1458/tasks/4950.xml', headers, fixture_for('/tasks/4950', 'xml'), 200
|
11
|
+
mock.get '/api_v1/projects/1458/tasks/4949.xml', headers, fixture_for('/tasks/4950', 'xml'), 200
|
12
|
+
mock.get '/api_v1/users.xml', headers, fixture_for('users', 'xml'), 200
|
13
|
+
end
|
14
|
+
@tm = TicketMaster.new(:bugherd, :email => 'george.rafael@gmail.com', :password => '123456')
|
15
|
+
@project = @tm.project(1458)
|
16
|
+
@klass = TicketMaster::Provider::Bugherd::Ticket
|
17
|
+
end
|
18
|
+
|
19
|
+
context "Loading all tickets" do
|
20
|
+
it "should be able to load all tickets" do
|
21
|
+
tickets = @project.tickets
|
22
|
+
tickets.should be_an_instance_of(Array)
|
23
|
+
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([4950])
|
28
|
+
tickets.should be_an_instance_of(Array)
|
29
|
+
tickets.first.should be_an_instance_of(@klass)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should be able to load all tickets based on attributes" do
|
33
|
+
tickets = @project.tickets(:id => 4950)
|
34
|
+
tickets.should be_an_instance_of(Array)
|
35
|
+
tickets.first.should be_an_instance_of(@klass)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "Loading a single ticket" do
|
40
|
+
it "should be able to load a single ticket based on id" do
|
41
|
+
ticket = @project.ticket(4950)
|
42
|
+
ticket.should be_an_instance_of(@klass)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should be able to load a single ticket based on attributes" do
|
46
|
+
ticket = @project.ticket(:id => 4950)
|
47
|
+
ticket.should be_an_instance_of(@klass)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
it "should contain all fields for tickets" do
|
53
|
+
ticket = @project.ticket(4950)
|
54
|
+
ticket.id.should == 4950
|
55
|
+
ticket.status.should == 'active'
|
56
|
+
ticket.priority.should == 'critical'
|
57
|
+
ticket.title.should be_nil
|
58
|
+
ticket.resolution.should be_nil
|
59
|
+
ticket.created_at.should be_nil
|
60
|
+
ticket.updated_at.should be_nil
|
61
|
+
ticket.description.should == 'Now this one should be green not red'
|
62
|
+
ticket.assignee.should == 'Rafael George'
|
63
|
+
ticket.requestor.should be_nil
|
64
|
+
ticket.project_id.should == 1458
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,84 @@
|
|
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-bugherd}
|
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-08-22}
|
13
|
+
s.description = %q{Ticketmaster provider for Bugherd}
|
14
|
+
s.email = %q{george.rafael@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
".rvmrc",
|
23
|
+
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/bugherd/bugherd-api.rb",
|
30
|
+
"lib/provider/bugherd.rb",
|
31
|
+
"lib/provider/comment.rb",
|
32
|
+
"lib/provider/project.rb",
|
33
|
+
"lib/provider/ticket.rb",
|
34
|
+
"lib/ticketmaster-bugherd.rb",
|
35
|
+
"request.xml",
|
36
|
+
"spec/comments_spec.rb",
|
37
|
+
"spec/fixtures/projects.xml",
|
38
|
+
"spec/fixtures/projects/1458.xml",
|
39
|
+
"spec/fixtures/tasks.xml",
|
40
|
+
"spec/fixtures/tasks/4950.xml",
|
41
|
+
"spec/fixtures/users.xml",
|
42
|
+
"spec/projects_spec.rb",
|
43
|
+
"spec/spec_helper.rb",
|
44
|
+
"spec/ticketmaster-bugherd_spec.rb",
|
45
|
+
"spec/tickets_spec.rb",
|
46
|
+
"ticketmaster-bugherd.gemspec"
|
47
|
+
]
|
48
|
+
s.homepage = %q{http://github.com/cored/ticketmaster-bugherd}
|
49
|
+
s.licenses = ["MIT"]
|
50
|
+
s.require_paths = ["lib"]
|
51
|
+
s.rubygems_version = %q{1.6.1}
|
52
|
+
s.summary = %q{Ticketmaster provider for Bugherd}
|
53
|
+
|
54
|
+
if s.respond_to? :specification_version then
|
55
|
+
s.specification_version = 3
|
56
|
+
|
57
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
|
+
s.add_runtime_dependency(%q<ticketmaster>, ["~> 0.6.0"])
|
59
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0"])
|
60
|
+
s.add_runtime_dependency(%q<activeresource>, ["~> 3.0.0"])
|
61
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
62
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
64
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
65
|
+
else
|
66
|
+
s.add_dependency(%q<ticketmaster>, ["~> 0.6.0"])
|
67
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
|
68
|
+
s.add_dependency(%q<activeresource>, ["~> 3.0.0"])
|
69
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
70
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
72
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
73
|
+
end
|
74
|
+
else
|
75
|
+
s.add_dependency(%q<ticketmaster>, ["~> 0.6.0"])
|
76
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
|
77
|
+
s.add_dependency(%q<activeresource>, ["~> 3.0.0"])
|
78
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
79
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
80
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
81
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
metadata
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ticketmaster-bugherd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
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-08-22 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 7
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 6
|
32
|
+
- 0
|
33
|
+
version: 0.6.0
|
34
|
+
version_requirements: *id001
|
35
|
+
name: ticketmaster
|
36
|
+
prerelease: false
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :runtime
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 7
|
45
|
+
segments:
|
46
|
+
- 3
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
version: 3.0.0
|
50
|
+
version_requirements: *id002
|
51
|
+
name: activesupport
|
52
|
+
prerelease: false
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
type: :runtime
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 7
|
61
|
+
segments:
|
62
|
+
- 3
|
63
|
+
- 0
|
64
|
+
- 0
|
65
|
+
version: 3.0.0
|
66
|
+
version_requirements: *id003
|
67
|
+
name: activeresource
|
68
|
+
prerelease: false
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
type: :development
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 2
|
79
|
+
- 3
|
80
|
+
- 0
|
81
|
+
version: 2.3.0
|
82
|
+
version_requirements: *id004
|
83
|
+
name: rspec
|
84
|
+
prerelease: false
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
type: :development
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 23
|
93
|
+
segments:
|
94
|
+
- 1
|
95
|
+
- 0
|
96
|
+
- 0
|
97
|
+
version: 1.0.0
|
98
|
+
version_requirements: *id005
|
99
|
+
name: bundler
|
100
|
+
prerelease: false
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
type: :development
|
103
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ~>
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
hash: 7
|
109
|
+
segments:
|
110
|
+
- 1
|
111
|
+
- 6
|
112
|
+
- 4
|
113
|
+
version: 1.6.4
|
114
|
+
version_requirements: *id006
|
115
|
+
name: jeweler
|
116
|
+
prerelease: false
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
type: :development
|
119
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
hash: 3
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
version: "0"
|
128
|
+
version_requirements: *id007
|
129
|
+
name: rcov
|
130
|
+
prerelease: false
|
131
|
+
description: Ticketmaster provider for Bugherd
|
132
|
+
email: george.rafael@gmail.com
|
133
|
+
executables: []
|
134
|
+
|
135
|
+
extensions: []
|
136
|
+
|
137
|
+
extra_rdoc_files:
|
138
|
+
- LICENSE.txt
|
139
|
+
- README.rdoc
|
140
|
+
files:
|
141
|
+
- .document
|
142
|
+
- .rspec
|
143
|
+
- .rvmrc
|
144
|
+
- Gemfile
|
145
|
+
- Gemfile.lock
|
146
|
+
- LICENSE.txt
|
147
|
+
- README.rdoc
|
148
|
+
- Rakefile
|
149
|
+
- VERSION
|
150
|
+
- lib/bugherd/bugherd-api.rb
|
151
|
+
- lib/provider/bugherd.rb
|
152
|
+
- lib/provider/comment.rb
|
153
|
+
- lib/provider/project.rb
|
154
|
+
- lib/provider/ticket.rb
|
155
|
+
- lib/ticketmaster-bugherd.rb
|
156
|
+
- request.xml
|
157
|
+
- spec/comments_spec.rb
|
158
|
+
- spec/fixtures/projects.xml
|
159
|
+
- spec/fixtures/projects/1458.xml
|
160
|
+
- spec/fixtures/tasks.xml
|
161
|
+
- spec/fixtures/tasks/4950.xml
|
162
|
+
- spec/fixtures/users.xml
|
163
|
+
- spec/projects_spec.rb
|
164
|
+
- spec/spec_helper.rb
|
165
|
+
- spec/ticketmaster-bugherd_spec.rb
|
166
|
+
- spec/tickets_spec.rb
|
167
|
+
- ticketmaster-bugherd.gemspec
|
168
|
+
has_rdoc: true
|
169
|
+
homepage: http://github.com/cored/ticketmaster-bugherd
|
170
|
+
licenses:
|
171
|
+
- MIT
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
|
175
|
+
require_paths:
|
176
|
+
- lib
|
177
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
hash: 3
|
183
|
+
segments:
|
184
|
+
- 0
|
185
|
+
version: "0"
|
186
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
+
none: false
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
hash: 3
|
192
|
+
segments:
|
193
|
+
- 0
|
194
|
+
version: "0"
|
195
|
+
requirements: []
|
196
|
+
|
197
|
+
rubyforge_project:
|
198
|
+
rubygems_version: 1.6.1
|
199
|
+
signing_key:
|
200
|
+
specification_version: 3
|
201
|
+
summary: Ticketmaster provider for Bugherd
|
202
|
+
test_files: []
|
203
|
+
|