ticketmaster-bugshelf 0.0.2
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/.gitignore +6 -0
- data/.hgignore +25 -0
- data/Gemfile +1 -0
- data/Rakefile +2 -0
- data/lib/bugshelf/bugshelf-api.rb +55 -0
- data/lib/provider/bugshelf.rb +36 -0
- data/lib/provider/comment.rb +14 -0
- data/lib/provider/project.rb +28 -0
- data/lib/provider/ticket.rb +39 -0
- data/lib/ticketmaster-bugshelf/version.rb +5 -0
- data/lib/ticketmaster-bugshelf.rb +5 -0
- data/ticketmaster-bugshelf.gemspec +21 -0
- metadata +79 -0
data/.gitignore
ADDED
data/.hgignore
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
syntax: glob
|
|
2
|
+
build
|
|
3
|
+
*.swp
|
|
4
|
+
|
|
5
|
+
*.mode1
|
|
6
|
+
*.mode1v3
|
|
7
|
+
*.mode2
|
|
8
|
+
*.mode2v3
|
|
9
|
+
*.pbxuser
|
|
10
|
+
*.perspective
|
|
11
|
+
*.perspectivev3
|
|
12
|
+
xcuserdata
|
|
13
|
+
|
|
14
|
+
*~.nib
|
|
15
|
+
|
|
16
|
+
.DS_Store
|
|
17
|
+
|
|
18
|
+
testit.rb
|
|
19
|
+
test-*
|
|
20
|
+
|
|
21
|
+
*.gem
|
|
22
|
+
.bundle
|
|
23
|
+
Gemfile.lock
|
|
24
|
+
pkg/*
|
|
25
|
+
.rvmrc
|
data/Gemfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gem 'ticketmaster'
|
data/Rakefile
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'active_support'
|
|
2
|
+
require 'active_resource'
|
|
3
|
+
|
|
4
|
+
module BugshelfAPI
|
|
5
|
+
class Error < StandardError; end
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
|
|
9
|
+
# Sets up basic authentication credentials for all the resources.
|
|
10
|
+
def authenticate(subdomain, api_key)
|
|
11
|
+
@subdomain = subdomain
|
|
12
|
+
|
|
13
|
+
tld = ENV['RAILS_ENV'] == 'development' ? 'dev' : 'com'
|
|
14
|
+
schema = ENV['RAILS_ENV'] == 'development' ? 'http' : 'https'
|
|
15
|
+
|
|
16
|
+
self::Base.site = "#{schema}://#{api_key}:***@#{subdomain}.bugshelf.#{tld}/"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def resources
|
|
20
|
+
@resources ||= []
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class Base < ActiveResource::Base
|
|
25
|
+
self.format = :xml
|
|
26
|
+
if ENV['http_proxy']
|
|
27
|
+
self.proxy = ENV['http_proxy']
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.inherited(base)
|
|
31
|
+
BugshelfAPI.resources << base
|
|
32
|
+
super
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.build_subclass
|
|
36
|
+
Class.new(self).tap do |c|
|
|
37
|
+
c.element_name = self.element_name
|
|
38
|
+
c.collection_name = self.collection_name
|
|
39
|
+
c.primary_key = self.primary_key
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class Project < Base
|
|
45
|
+
def issues
|
|
46
|
+
Issue.build_subclass.tap do |issue|
|
|
47
|
+
issue.prefix = "/projects/#{self.project_key}/"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class Issue < Base
|
|
53
|
+
self.prefix = "/projects/:project_id/"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module TicketMaster::Provider
|
|
2
|
+
# This is the Bugshelf Provider for ticketmaster
|
|
3
|
+
module Bugshelf
|
|
4
|
+
include TicketMaster::Provider::Base
|
|
5
|
+
TICKET_API = Bugshelf::Ticket # The class to access the api's tickets
|
|
6
|
+
PROJECT_API = Bugshelf::Project # The class to access the api's projects
|
|
7
|
+
|
|
8
|
+
# This is for cases when you want to instantiate using TicketMaster::Provider::Bugshelf.new(auth)
|
|
9
|
+
def self.new(auth = {})
|
|
10
|
+
TicketMaster.new(:bugshelf, auth)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Authorize with subdomain and api_key, eg.: Bugshelf::authorize(:subdomain => 'subforcompany', :api_key => 'szgduztad7asdtuzagdgkasdgf)
|
|
14
|
+
def authorize(auth = {})
|
|
15
|
+
@authentication ||= TicketMaster::Authenticator.new(auth)
|
|
16
|
+
auth = @authentication
|
|
17
|
+
|
|
18
|
+
if auth.subdomain.blank? or auth.api_key.blank?
|
|
19
|
+
raise "Please provide at least a set of subdomain and api_key)"
|
|
20
|
+
end
|
|
21
|
+
::BugshelfAPI.authenticate(auth.subdomain, auth.api_key)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def valid?
|
|
25
|
+
begin
|
|
26
|
+
PROJECT_API.find(:first).nil?
|
|
27
|
+
true
|
|
28
|
+
rescue
|
|
29
|
+
false
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module TicketMaster::Provider
|
|
2
|
+
module Bugshelf
|
|
3
|
+
# The comment class for ticketmaster-bugshelf
|
|
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 = Bugshelf::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,28 @@
|
|
|
1
|
+
module TicketMaster::Provider
|
|
2
|
+
module Bugshelf
|
|
3
|
+
# Project class for ticketmaster-bugshelf
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
class Project < TicketMaster::Provider::Base::Project
|
|
7
|
+
API = BugshelfAPI::Project # The class to access the api's projects
|
|
8
|
+
|
|
9
|
+
def id
|
|
10
|
+
self[:project_key]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# copy from this.copy(that) copies that into this
|
|
14
|
+
def copy(project)
|
|
15
|
+
project.tickets.each do |ticket|
|
|
16
|
+
copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
|
|
17
|
+
ticket.comments.each do |comment|
|
|
18
|
+
copy_ticket.comment!(:body => comment.body)
|
|
19
|
+
sleep 1
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module TicketMaster::Provider
|
|
2
|
+
module Bugshelf
|
|
3
|
+
# Ticket class for ticketmaster-bugshelf
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
class Ticket < TicketMaster::Provider::Base::Ticket
|
|
7
|
+
API = BugshelfAPI::Issue # The class to access the api's tickets
|
|
8
|
+
|
|
9
|
+
def self.search(project_id, options = {}, limit = 1000)
|
|
10
|
+
tickets = API.find(:all, :params => {:project_id => project_id, :per_page => limit})
|
|
11
|
+
search_by_attribute(tickets, options, limit)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.create(*options)
|
|
15
|
+
if options.first.is_a? Hash
|
|
16
|
+
options.first.merge!(
|
|
17
|
+
:details => options.first.delete(:description)
|
|
18
|
+
)
|
|
19
|
+
task = API.new(options.first)
|
|
20
|
+
ticket = self.new task
|
|
21
|
+
task.save
|
|
22
|
+
ticket
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def destroy(*options)
|
|
27
|
+
@system_data[:client].destroy.is_a?(Net::HTTPOK)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def id
|
|
31
|
+
@system_data[:client].string_id
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def description
|
|
35
|
+
self.details
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "ticketmaster-bugshelf/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "ticketmaster-bugshelf"
|
|
7
|
+
s.version = Ticketmaster::Bugshelf::VERSION
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = ["Thomas Steinhausen"]
|
|
10
|
+
s.email = ["ts@image-addicts.de"]
|
|
11
|
+
s.homepage = ""
|
|
12
|
+
s.summary = %q{A tickemaster provider for bugshelf.}
|
|
13
|
+
s.description = %q{A tickemaster provider to make bugshelf api usable with ticketmaster.}
|
|
14
|
+
|
|
15
|
+
s.rubyforge_project = "ticketmaster-bugshelf"
|
|
16
|
+
|
|
17
|
+
s.files = `hg manifest`.split("\n")
|
|
18
|
+
s.test_files = []
|
|
19
|
+
s.executables = []
|
|
20
|
+
s.require_paths = ["lib"]
|
|
21
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ticketmaster-bugshelf
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 27
|
|
5
|
+
prerelease:
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.0.2
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Thomas Steinhausen
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2011-06-28 00:00:00 +02:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies: []
|
|
21
|
+
|
|
22
|
+
description: A tickemaster provider to make bugshelf api usable with ticketmaster.
|
|
23
|
+
email:
|
|
24
|
+
- ts@image-addicts.de
|
|
25
|
+
executables: []
|
|
26
|
+
|
|
27
|
+
extensions: []
|
|
28
|
+
|
|
29
|
+
extra_rdoc_files: []
|
|
30
|
+
|
|
31
|
+
files:
|
|
32
|
+
- .gitignore
|
|
33
|
+
- .hgignore
|
|
34
|
+
- Gemfile
|
|
35
|
+
- Rakefile
|
|
36
|
+
- lib/bugshelf/bugshelf-api.rb
|
|
37
|
+
- lib/provider/bugshelf.rb
|
|
38
|
+
- lib/provider/comment.rb
|
|
39
|
+
- lib/provider/project.rb
|
|
40
|
+
- lib/provider/ticket.rb
|
|
41
|
+
- lib/ticketmaster-bugshelf.rb
|
|
42
|
+
- lib/ticketmaster-bugshelf/version.rb
|
|
43
|
+
- ticketmaster-bugshelf.gemspec
|
|
44
|
+
has_rdoc: true
|
|
45
|
+
homepage: ""
|
|
46
|
+
licenses: []
|
|
47
|
+
|
|
48
|
+
post_install_message:
|
|
49
|
+
rdoc_options: []
|
|
50
|
+
|
|
51
|
+
require_paths:
|
|
52
|
+
- lib
|
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
|
+
none: false
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
hash: 3
|
|
59
|
+
segments:
|
|
60
|
+
- 0
|
|
61
|
+
version: "0"
|
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
|
+
none: false
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
hash: 3
|
|
68
|
+
segments:
|
|
69
|
+
- 0
|
|
70
|
+
version: "0"
|
|
71
|
+
requirements: []
|
|
72
|
+
|
|
73
|
+
rubyforge_project: ticketmaster-bugshelf
|
|
74
|
+
rubygems_version: 1.6.0
|
|
75
|
+
signing_key:
|
|
76
|
+
specification_version: 3
|
|
77
|
+
summary: A tickemaster provider for bugshelf.
|
|
78
|
+
test_files: []
|
|
79
|
+
|