ticketmaster 0.3.10 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +51 -22
- data/VERSION +1 -1
- data/lib/ticketmaster/cli/commands/generate.rb +104 -0
- data/lib/ticketmaster/cli/commands/generate/provider.rb +5 -0
- data/lib/ticketmaster/cli/commands/generate/provider/comment.rb +13 -0
- data/lib/ticketmaster/cli/commands/generate/provider/project.rb +25 -0
- data/lib/ticketmaster/cli/commands/generate/provider/provider.rb +16 -0
- data/lib/ticketmaster/cli/commands/generate/provider/ticket.rb +11 -0
- data/lib/ticketmaster/cli/commands/help/generate +19 -0
- data/lib/ticketmaster/cli/init.rb +4 -1
- data/ticketmaster.gemspec +9 -2
- metadata +12 -5
data/README.md
CHANGED
@@ -18,52 +18,52 @@ ticketmaster by itself won't do too much. You may want to install a provider, to
|
|
18
18
|
|
19
19
|
gem search ticketmaster
|
20
20
|
|
21
|
-
You could then install for instance ticketmaster-
|
21
|
+
You could then install for instance ticketmaster-pivotal:
|
22
22
|
|
23
|
-
gem install ticketmaster-
|
23
|
+
gem install ticketmaster-pivotal
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
27
|
**Note:** The API may change, and the following may not be the final. Please keep yourself updated before you upgrade.
|
28
28
|
|
29
|
-
First, we instance a new class with the right set of options. In this example, we are authenticating with
|
29
|
+
First, we instance a new class with the right set of options. In this example, we are authenticating with Pivotal Tracker.
|
30
30
|
|
31
|
-
|
31
|
+
pivotal = TicketMaster.new(:pivotal, {:username => "john", :password => "seekrit"})
|
32
32
|
|
33
33
|
### Grabbing a project
|
34
34
|
|
35
35
|
Now that we've got out ticketmaster instance, let's go ahead and grab "testproject":
|
36
36
|
|
37
|
-
project =
|
37
|
+
project = pivotal.project["testproject"]
|
38
38
|
#=> TicketMaster::Project<#name="testproject"..>
|
39
39
|
|
40
40
|
*Project#[]* is an alias to *Project#find*:
|
41
41
|
|
42
|
-
project =
|
42
|
+
project = pivotal.project.find "testproject"
|
43
43
|
#=> TicketMaster::Project<#name="testproject"..>
|
44
44
|
|
45
45
|
Which translates into:
|
46
46
|
|
47
|
-
project =
|
47
|
+
project = pivotal.project.find :name => "testproject"
|
48
48
|
#=> TicketMaster::Project<#name="testproject"..>
|
49
49
|
|
50
50
|
That means you can actually look up a project by something else than the title, like the owner:
|
51
51
|
|
52
|
-
project =
|
52
|
+
project = pivotal.project.find :owner => "Sirupsen"
|
53
53
|
#=> TicketMaster::Project<#owner="sirupsen"..>
|
54
54
|
|
55
55
|
To retrieve all projects, simply pass no argument to find:
|
56
56
|
|
57
|
-
project =
|
57
|
+
project = pivotal.project.find
|
58
58
|
#=> [TicketMaster::Project<#..>,TicketMaster::Project<#..>,..]
|
59
59
|
|
60
60
|
### Creating a ticket
|
61
61
|
|
62
62
|
Now that we grabbed the right project. Let's go ahead and create a ticket at this project:
|
63
63
|
|
64
|
-
project.ticket.create(:
|
64
|
+
project.ticket.create(:summary => "Test", :description => "Hello World")
|
65
65
|
|
66
|
-
We create our ticket with three properties
|
66
|
+
We create our ticket with three properties.
|
67
67
|
|
68
68
|
### Finding tickets
|
69
69
|
|
@@ -111,7 +111,33 @@ However, as closing a ticket with a resolution is such a common task, the other
|
|
111
111
|
|
112
112
|
Currently ticketmaster supports the following systems:
|
113
113
|
|
114
|
-
###
|
114
|
+
### Pivotal Tracker
|
115
|
+
|
116
|
+
To use Pivotal Tracker with ticketmaster, install it:
|
117
|
+
gem install ticketmaster-pivotal
|
118
|
+
|
119
|
+
Then simply require it, and you are good to use Pivotal Tracker with ticketmaster!
|
120
|
+
|
121
|
+
require 'ticketmaster'
|
122
|
+
require 'ticketmaster-pivotal'
|
123
|
+
unfuddle = TicketMaster.new(:pivotal, {:username => "..", :password => ".."})
|
124
|
+
|
125
|
+
The source code is located at [ticketmaster-pivotal](http://github.com/hybridgroup/ticketmaster-pivotal)
|
126
|
+
|
127
|
+
### Lighthouse
|
128
|
+
|
129
|
+
To use Lighthouse with ticketmaster, install it:
|
130
|
+
gem install ticketmaster-lighthouse
|
131
|
+
|
132
|
+
Then simply require it, and you are all set to use Lighthouse with ticketmaster!
|
133
|
+
|
134
|
+
require 'ticketmaster'
|
135
|
+
require 'ticketmaster-lighthouse'
|
136
|
+
lighthouse = TicketMaster.new(:lighthouse, {:username => "..", :password => ".."})
|
137
|
+
|
138
|
+
The source code is located at [ticketmaster-lighthouse](http://github.com/hybridgroup/ticketmaster-lighthouse)
|
139
|
+
|
140
|
+
### Unfuddle (Alpha, needs compatibility update)
|
115
141
|
|
116
142
|
To use Unfuddle with ticketmaster, install it:
|
117
143
|
gem install ticketmaster-unfuddle
|
@@ -122,23 +148,26 @@ Then simply require it, and you are good to use Unfuddle with ticketmaster!
|
|
122
148
|
require 'ticketmaster-unfuddle'
|
123
149
|
unfuddle = TicketMaster.new(:unfuddle, {:username => "..", :password => "..", :subdomain => ".."})
|
124
150
|
|
151
|
+
The source code is located at [ticketmaster-unfuddle](http://github.com/hybridgroup/ticketmaster-unfuddle)
|
152
|
+
|
125
153
|
## Creating a provider
|
126
|
-
Creating a provider consists of
|
154
|
+
Creating a provider consists of three steps:
|
127
155
|
|
128
|
-
* Create the ticketmaster provider (a.k.a. the remap)
|
156
|
+
* Create the ticketmaster provider (a.k.a. the remap) using the skeleton located at http://github.com/hybridgroup/ticketmaster-provider-skeleton
|
157
|
+
* Implement whatever is needed to connect to your desired backend
|
129
158
|
* Release it to RubyGems
|
130
159
|
|
131
160
|
### Create the ticketmaster provider
|
132
161
|
Almost all APIs are different. And so are their Ruby providers. ticketmaster attempts to create an universal API for ticket and project management systems, and thus, we need to map the functionality to the ticketmaster API. This is the providers job. The provider is the glue between ticketmaster, and the ticket management system's API.
|
133
|
-
Usually, your provider would rely on another library for the raw HTTP interaction. For instance, [ticketmaster-
|
162
|
+
Usually, your provider would rely on another library for the raw HTTP interaction. For instance, [ticketmaster-lighthouse](http://github.com/hybridgroup/ticketmaster-lighthouse) relies on ActiveResource in order to interact with the Lighthouse API. Look at it like this:
|
134
163
|
|
135
164
|
**ticketmaster** -> **Provider** -> *(Ruby library)* -> **Site's API**
|
136
165
|
|
137
|
-
Provider being the *glue* between the site's API and ticketmaster. The Ruby library is "optional" (though
|
166
|
+
Provider being the *glue* between the site's API and ticketmaster. The Ruby library is "optional" (though highly recommended as mentioned), therefore it is in parantheses.
|
138
167
|
|
139
|
-
An example of a provider could be [ticketmaster-
|
168
|
+
An example of a provider could be [ticketmaster-lighthouse](http://github.com/hybridgroup/ticketmaster-lighthouse), an example of a Ruby library could be ActiveResource.
|
140
169
|
|
141
|
-
For now, look at [ticketmaster-
|
170
|
+
For now, look at [ticketmaster-lighthouse](http://github.com/hybridgroup/ticketmaster-lighthouse) as an example on how to create a provider. More detailed documentation will be available soon.
|
142
171
|
|
143
172
|
### Release it
|
144
173
|
Simply release it to RubyGems.org, the name of the provider Gem should follow this simple naming rule:
|
@@ -159,12 +188,12 @@ They should be presented with a nice list of all available providers.
|
|
159
188
|
|
160
189
|
* Fork the project.
|
161
190
|
* Make your feature addition or bug fix.
|
162
|
-
* Add tests for it. This is important so
|
191
|
+
* Add tests for it. This is important so we don't break it in a
|
163
192
|
future version unintentionally.
|
164
193
|
* Commit, do not mess with rakefile, version, or history.
|
165
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself
|
166
|
-
* Send
|
194
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself so we can ignore when we pull)
|
195
|
+
* Send us a pull request. Bonus points for feature branches.
|
167
196
|
|
168
197
|
## Copyright
|
169
198
|
|
170
|
-
Copyright (c) 2010 [Hybrid Group](http://hybridgroup.com). See LICENSE for details.
|
199
|
+
Copyright (c) 2010 [The Hybrid Group](http://hybridgroup.com). See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# The generate command
|
2
|
+
def generate(options)
|
3
|
+
if ARGV.length == 0
|
4
|
+
ARGV << '--help'
|
5
|
+
else
|
6
|
+
options[:provider] = ARGV.shift
|
7
|
+
if options[:provider].first == '_'
|
8
|
+
options[:provider][0] = ''
|
9
|
+
options[:provider_dir] = options[:provider]
|
10
|
+
else
|
11
|
+
options[:provider_dir] = 'ticketmaster-' + options[:provider]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
options[:mkdir] = true
|
15
|
+
begin
|
16
|
+
OptionParser.new do |opts|
|
17
|
+
opts.banner = 'Usage: tm generate PROVIDER_NAME [--lib-directory DIR] [--jeweler [jeweler_options]]'
|
18
|
+
opts.separator ''
|
19
|
+
opts.separator 'Options:'
|
20
|
+
|
21
|
+
opts.on('-J', '--jeweler [JEWELER_OPTIONS]', 'Sets the working ticket') do |option|
|
22
|
+
options[:jeweler] = [option] + ARGV
|
23
|
+
options[:mkdir] = false
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('-L', '--lib-directory DIR', 'Put the skeleton files inside this directory', ' * This assumes the directory already exists') do |dir|
|
27
|
+
options[:lib] = dir
|
28
|
+
options[:mkdir] = false
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.separator ''
|
32
|
+
opts.separator 'Other options:'
|
33
|
+
|
34
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
35
|
+
puts opts
|
36
|
+
exit
|
37
|
+
end
|
38
|
+
opts.separator ''
|
39
|
+
opts.separator 'NOTE: ticketmaster- will be prepended to your provider name'
|
40
|
+
opts.separator 'unless you set the first character as _ (it will be removed)'
|
41
|
+
end.order!
|
42
|
+
rescue OptionParser::MissingArgument => exception
|
43
|
+
puts "tm #{options[:original_argv].join(' ')}\n\n"
|
44
|
+
puts "Error: An option was called that requires an argument, but was not given one"
|
45
|
+
puts exception.message
|
46
|
+
end
|
47
|
+
options[:lib] ||= options[:provider_dir] + '/lib/'
|
48
|
+
create_directories(options)
|
49
|
+
copy_skeleton(options)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Copy over the skeleton files
|
53
|
+
def copy_skeleton(options)
|
54
|
+
skeleton_path = File.dirname(__FILE__) + '/generate/'
|
55
|
+
provider = File.read(skeleton_path + 'provider.rb').gsub('yoursystem', options[:provider].downcase)
|
56
|
+
create_file(options, options[:provider_dir] + '.rb', provider)
|
57
|
+
skeleton_path << 'provider/'
|
58
|
+
provider = File.read(skeleton_path + 'provider.rb').gsub('Yoursystem', options[:provider].capitalize).gsub('yoursystem', options[:provider].downcase)
|
59
|
+
create_file(options, 'provider/' + options[:provider].downcase + '.rb', provider)
|
60
|
+
%w(project.rb ticket.rb comment.rb).each do |p|
|
61
|
+
provider = File.read(skeleton_path + p).gsub('Yoursystem', options[:provider].capitalize).gsub('yoursystem', options[:provider].downcase)
|
62
|
+
create_file(options, 'provider/' + p, provider)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Create the directories so copy_skeleton can do its job
|
67
|
+
def create_directories(options)
|
68
|
+
if options[:jeweler]
|
69
|
+
puts "Running jeweler #{options[:provider_dir]} #{options[:jeweler].join(' ')}"
|
70
|
+
puts `jeweler #{options[:provider_dir]} #{options[:jeweler].join(' ')}`
|
71
|
+
elsif options[:mkdir]
|
72
|
+
begin
|
73
|
+
Dir.mkdir(options[:provider_dir])
|
74
|
+
puts "\tcreate\t#{options[:provider_dir]}"
|
75
|
+
rescue Exception => e
|
76
|
+
puts "\t#{e.message}"
|
77
|
+
end
|
78
|
+
begin
|
79
|
+
Dir.mkdir(options[:lib])
|
80
|
+
puts "\tcreate\t#{options[:lib]}"
|
81
|
+
rescue Exception => e
|
82
|
+
puts "\t#{e.message}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
begin
|
86
|
+
Dir.mkdir(options[:lib] + '/provider')
|
87
|
+
puts "\tcreate\t#{options[:lib] + 'provider'}"
|
88
|
+
rescue Exception => e
|
89
|
+
puts "\t#{e.message}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Create files
|
94
|
+
def create_file(options, filename, data)
|
95
|
+
file_path = options[:lib] + '/' + filename
|
96
|
+
if File.exist?(file_path) and File.size(file_path) > 0
|
97
|
+
puts "\texists with content...skipping\t#{filename}"
|
98
|
+
return false;
|
99
|
+
end
|
100
|
+
puts "\tcreate\t#{filename}"
|
101
|
+
f = File.open(file_path, 'a+')
|
102
|
+
f.write data
|
103
|
+
f.close
|
104
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Yoursystem
|
3
|
+
# The comment class for ticketmaster-yoursystem
|
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
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
module Yoursystem
|
3
|
+
# Project class for ticketmaster-yoursystem
|
4
|
+
#
|
5
|
+
#
|
6
|
+
class Project < TicketMaster::Provider::Base::Project
|
7
|
+
# declare needed overloaded methods here
|
8
|
+
|
9
|
+
|
10
|
+
# copy from this.copy(that) copies that into this
|
11
|
+
def copy(project)
|
12
|
+
project.tickets.each do |ticket|
|
13
|
+
copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
|
14
|
+
ticket.comments.each do |comment|
|
15
|
+
copy_ticket.comment!(:body => comment.body)
|
16
|
+
sleep 1
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module TicketMaster::Provider
|
2
|
+
# This is the Yoursystem Provider for ticketmaster
|
3
|
+
module Yoursystem
|
4
|
+
include TicketMaster::Provider::Base
|
5
|
+
|
6
|
+
# This is for cases when you want to instantiate using TicketMaster::Provider::Yoursystem.new(auth)
|
7
|
+
def self.new(auth = {})
|
8
|
+
TicketMaster.new(:yoursystem, auth)
|
9
|
+
end
|
10
|
+
|
11
|
+
# declare needed overloaded methods here
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
This command is used to generate a new provider.
|
2
|
+
|
3
|
+
It generates some basic files to get you started on creating your own provider.
|
4
|
+
|
5
|
+
NOTE: This command, in an attempt to keep provider names consistent, will prepend 'ticketmaster-' to the given provider name. You can cancel this by prepending a _ before your provider name, which will be removed if found.
|
6
|
+
|
7
|
+
If you have not created a gem directory or skeleton and want to use Jeweler (http://github.com/technicalpickles/jeweler) you can execute:
|
8
|
+
|
9
|
+
$ tm generate myprovider --jeweler [JEWELER ARGS]
|
10
|
+
|
11
|
+
And it will create your whole directory and skeleton using jeweler.
|
12
|
+
|
13
|
+
If you like the old "classic" gem creation process or are using some other gem processor, you can create the directory to store your files, cd into it and run this command to put the skeleton files inside the directory's lib/.
|
14
|
+
|
15
|
+
Example:
|
16
|
+
mkdir myprovider myprovider/lib
|
17
|
+
cd myprovider
|
18
|
+
[...]
|
19
|
+
tm generate myprovider
|
@@ -10,11 +10,14 @@ commands ={ 'help' => 'Get the help text for a particular command',
|
|
10
10
|
'config' => 'Setup and configure a ticketmaster.yml file',
|
11
11
|
'ticket' => 'Work with tickets (create, edit, delete, etc)',
|
12
12
|
'project' => 'Work with projects (create, edit, delete, etc)',
|
13
|
+
'generate' => 'Generate skeleton library files for a new provider',
|
13
14
|
}
|
14
15
|
|
16
|
+
|
17
|
+
|
15
18
|
helptext = lambda {
|
16
19
|
helpmsg = "\nAvailable commands:\n"
|
17
|
-
commands.sort.inject(helpmsg) { |mem, cmd| mem << "\t#{cmd.join("\t
|
20
|
+
commands.sort.inject(helpmsg) { |mem, cmd| mem << "\t#{cmd.join(" \t")}\n" }
|
18
21
|
helpmsg << "\nSee 'tm help COMMAND' for more information on a specific command."
|
19
22
|
}
|
20
23
|
|
data/ticketmaster.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ticketmaster}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["kiafaldorius", "Sirupsen", "deadprogrammer"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-16}
|
13
13
|
s.default_executable = %q{tm}
|
14
14
|
s.description = %q{Ticketmaster provides a universal API to ticket tracking and project management systems.}
|
15
15
|
s.email = %q{info@hybridgroup.com}
|
@@ -36,9 +36,16 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/ticketmaster/authenticator.rb",
|
37
37
|
"lib/ticketmaster/cli/commands/config.rb",
|
38
38
|
"lib/ticketmaster/cli/commands/console.rb",
|
39
|
+
"lib/ticketmaster/cli/commands/generate.rb",
|
40
|
+
"lib/ticketmaster/cli/commands/generate/provider.rb",
|
41
|
+
"lib/ticketmaster/cli/commands/generate/provider/comment.rb",
|
42
|
+
"lib/ticketmaster/cli/commands/generate/provider/project.rb",
|
43
|
+
"lib/ticketmaster/cli/commands/generate/provider/provider.rb",
|
44
|
+
"lib/ticketmaster/cli/commands/generate/provider/ticket.rb",
|
39
45
|
"lib/ticketmaster/cli/commands/help.rb",
|
40
46
|
"lib/ticketmaster/cli/commands/help/config",
|
41
47
|
"lib/ticketmaster/cli/commands/help/console",
|
48
|
+
"lib/ticketmaster/cli/commands/help/generate",
|
42
49
|
"lib/ticketmaster/cli/commands/help/help",
|
43
50
|
"lib/ticketmaster/cli/commands/help/project",
|
44
51
|
"lib/ticketmaster/cli/commands/help/ticket",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ticketmaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kiafaldorius
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-07-
|
20
|
+
date: 2010-07-16 00:00:00 -07:00
|
21
21
|
default_executable: tm
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -75,9 +75,16 @@ files:
|
|
75
75
|
- lib/ticketmaster/authenticator.rb
|
76
76
|
- lib/ticketmaster/cli/commands/config.rb
|
77
77
|
- lib/ticketmaster/cli/commands/console.rb
|
78
|
+
- lib/ticketmaster/cli/commands/generate.rb
|
79
|
+
- lib/ticketmaster/cli/commands/generate/provider.rb
|
80
|
+
- lib/ticketmaster/cli/commands/generate/provider/comment.rb
|
81
|
+
- lib/ticketmaster/cli/commands/generate/provider/project.rb
|
82
|
+
- lib/ticketmaster/cli/commands/generate/provider/provider.rb
|
83
|
+
- lib/ticketmaster/cli/commands/generate/provider/ticket.rb
|
78
84
|
- lib/ticketmaster/cli/commands/help.rb
|
79
85
|
- lib/ticketmaster/cli/commands/help/config
|
80
86
|
- lib/ticketmaster/cli/commands/help/console
|
87
|
+
- lib/ticketmaster/cli/commands/help/generate
|
81
88
|
- lib/ticketmaster/cli/commands/help/help
|
82
89
|
- lib/ticketmaster/cli/commands/help/project
|
83
90
|
- lib/ticketmaster/cli/commands/help/ticket
|