ticketmaster 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +72 -31
- data/VERSION +1 -1
- data/lib/ticketmaster/project.rb +2 -2
- data/test/test_unfuddler.rb +1 -1
- metadata +4 -13
data/README.md
CHANGED
@@ -22,49 +22,91 @@ You could then install for instance ticketmaster-unfuddle:
|
|
22
22
|
|
23
23
|
gem install ticketmaster-unfuddle
|
24
24
|
|
25
|
-
## TODO
|
26
|
-
|
27
|
-
* Find ticket by property
|
28
|
-
* Load login information from local file
|
29
|
-
|
30
25
|
## Usage
|
31
26
|
|
32
|
-
**Note
|
27
|
+
**Note:** The API may change, and the following may not be the final. Please keep yourself updated before you upgrade.
|
28
|
+
|
29
|
+
First, we instance a new class with the right set of options. In this example, we are authenticating with Unfuddle. As Unfuddle is a closed system, it is *required* that you authenticate to a subdomain:
|
33
30
|
|
34
|
-
First, we instance a new class with the right set of options. In this example, we are authenticating with Unfuddle. As Unfuddle is a closed system, it is *required* that you authenticate with a user to a subdomain, and so we do:
|
35
31
|
unfuddle = TicketMaster.new(:unfuddle, {:username => "john", :password => "seekrit", :subdomain => "ticketmaster"})
|
36
32
|
|
37
|
-
|
33
|
+
### Grabbing a project
|
34
|
+
|
35
|
+
Now that we've got out ticketmaster instance, let's go ahead and grab "testproject":
|
36
|
+
|
38
37
|
project = unfuddle.project["testproject"]
|
38
|
+
#=> TicketMaster::Project<#name="testproject"..>
|
39
|
+
|
40
|
+
*Project#[]* is an alias to *Project#find*:
|
39
41
|
|
40
|
-
Which is a shortcut for:
|
41
42
|
project = unfuddle.project.find "testproject"
|
43
|
+
#=> TicketMaster::Project<#name="testproject"..>
|
44
|
+
|
45
|
+
Which translates into:
|
42
46
|
|
43
|
-
Which is a shortcut for:
|
44
47
|
project = unfuddle.project.find :name => "testproject"
|
48
|
+
#=> TicketMaster::Project<#name="testproject"..>
|
49
|
+
|
50
|
+
That means you can actually look up a project by something else than the title, like the owner:
|
45
51
|
|
46
|
-
|
47
|
-
|
52
|
+
project = unfuddle.project.find :owner => "Sirupsen"
|
53
|
+
#=> TicketMaster::Project<#owner="sirupsen"..>
|
54
|
+
|
55
|
+
To retrieve all projects, simply pass no argument to find:
|
56
|
+
|
57
|
+
project = unfuddle.project.find
|
58
|
+
#=> [TicketMaster::Project<#..>,TicketMaster::Project<#..>,..]
|
59
|
+
|
60
|
+
### Creating a ticket
|
61
|
+
|
62
|
+
Now that we grabbed the right project. Let's go ahead and create a ticket at this project:
|
48
63
|
|
49
|
-
Let's create a ticket with our project instance, unfuddle requires these three properties in order to create a ticket:
|
50
64
|
project.ticket.create(:priority => 3, :summary => "Test", :description => "Hello World")
|
51
65
|
|
52
|
-
|
66
|
+
We create our ticket with three properties, the only one which may seem unfamiliar is the priority one, however, this attribute is required by Unfuddle.
|
67
|
+
|
68
|
+
### Finding tickets
|
69
|
+
|
70
|
+
Alright, let's play with the projects tickets! Here we grab the ticket with the id of 22:
|
71
|
+
|
53
72
|
ticket = project.tickets(:id => 22)
|
73
|
+
#=> TicketMaster::Ticket<#id=22..>
|
74
|
+
|
75
|
+
Like with projects, we can also find tickets by other attributes, like title, priority and so on, with tickets we do not use a find method though. Also as with projects, if no argument is passed, all tickets are retrieved:
|
76
|
+
|
77
|
+
tickets = project.tickets
|
78
|
+
#=> [TicketMaster::Ticket<#..>,TicketMaster::Ticket<#..>,..]
|
79
|
+
|
80
|
+
### Changing ticket attributes
|
81
|
+
|
82
|
+
Let's say that we're working on this ticket right now, so let's go ahead and change the status to reflect that:
|
54
83
|
|
55
|
-
We're working on this ticket right now, so let's go ahead and change the status
|
56
84
|
ticket.status = :in_progress
|
57
85
|
|
58
|
-
Other valid ticket statuses
|
86
|
+
Other valid ticket statuses include:
|
87
|
+
|
59
88
|
:closed, :accepted, :resolved
|
60
89
|
|
61
|
-
For the
|
90
|
+
For the sake of example, we'll change the description as well, and then save the ticket.
|
91
|
+
|
62
92
|
ticket.description = "Changed description to something else!"
|
63
93
|
ticket.save
|
64
94
|
|
65
|
-
|
95
|
+
### Closing a ticket
|
96
|
+
|
97
|
+
The issue was solved, let's make that official by closing the ticket with the appropriate resolution:
|
98
|
+
|
66
99
|
ticket.close(:resolution => "fixed", :description => "Fixed issue by doing x")
|
67
100
|
|
101
|
+
Note that you could close the ticket by changing all the attributes manually, like so:
|
102
|
+
|
103
|
+
ticket.status = :closed
|
104
|
+
ticket.resolution = "fixed"
|
105
|
+
ticket.resolution_description = "Fixed issue by doing x"
|
106
|
+
ticket.save
|
107
|
+
|
108
|
+
However, as closing a ticket with a resolution is such a common task, the other method is included because it may be more convenient.
|
109
|
+
|
68
110
|
## Support
|
69
111
|
|
70
112
|
Currently ticketmaster supports the following systems:
|
@@ -75,44 +117,43 @@ To use Unfuddle with ticketmaster, install it:
|
|
75
117
|
gem install ticketmaster-unfuddle
|
76
118
|
|
77
119
|
Then simply require it, and you are good to use Unfuddle with ticketmaster!
|
120
|
+
|
78
121
|
require 'ticketmaster'
|
79
122
|
require 'ticketmaster-unfuddle'
|
80
123
|
unfuddle = TicketMaster.new(:unfuddle, {:username => "..", :password => "..", :subdomain => ".."})
|
81
124
|
|
82
125
|
## Creating a provider
|
83
|
-
Creating a provider consists of
|
126
|
+
Creating a provider consists of two steps:
|
84
127
|
|
85
128
|
* Create the ticketmaster provider (a.k.a. the remap)
|
86
129
|
* Release it to RubyGems
|
87
|
-
* Send an email to sirup@sirupsen.dk telling me about the awesome provider you created so we can fit it onto the list!
|
88
130
|
|
89
131
|
### Create the ticketmaster provider
|
90
|
-
Almost all APIs are different. And so are their Ruby providers. ticketmaster attempts to create an universal API for
|
132
|
+
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-unfuddle](http://github.com/hybridgroup/ticketmaster-unfuddle) relies on [Unfuddler](http://github.com/hybridgroup/unfuddler) in order to interact with the Unfuddle API. Look at it like this:
|
91
134
|
|
92
135
|
**ticketmaster** -> **Provider** -> *(Ruby library)* -> **Site's API**
|
93
136
|
|
94
|
-
Provider being the
|
137
|
+
Provider being the *glue* between the site's API and ticketmaster. The Ruby library is "optional" (though higly recommended as mentioned), therefore it is in parantheses.
|
95
138
|
|
96
|
-
An example of a provider could be [ticketmaster-unfuddle](http://github.com/hybridgroup/ticketmaster-unfuddle), an example of a Ruby library
|
139
|
+
An example of a provider could be [ticketmaster-unfuddle](http://github.com/hybridgroup/ticketmaster-unfuddle), an example of a Ruby library could be [Unfuddler](http://github.com/hybridgroup/unfuddler).
|
97
140
|
|
98
|
-
For now, look at [ticketmaster-unfuddle](http://github.com/hybridgroup/ticketmaster-unfuddle) as an example on how to create a provider. More detailed documentation
|
141
|
+
For now, look at [ticketmaster-unfuddle](http://github.com/hybridgroup/ticketmaster-unfuddle) as an example on how to create a provider. More detailed documentation will be available soon.
|
99
142
|
|
100
143
|
### Release it
|
101
|
-
|
144
|
+
Simply release it to RubyGems.org, the name of the provider Gem should follow this simple naming rule:
|
102
145
|
|
103
146
|
ticketmaster-<provider's name>
|
104
147
|
|
105
|
-
For instance for a Github provider:
|
148
|
+
For instance if you set for a Github provider, it would be named:
|
106
149
|
|
107
150
|
ticketmaster-github
|
108
151
|
|
109
|
-
This makes it easy for people to
|
110
|
-
|
111
|
-
gem search ticketmaster
|
152
|
+
This makes it easy for people to find providers, simply by issuing:
|
112
153
|
|
113
|
-
|
154
|
+
gem search -r ticketmaster
|
114
155
|
|
115
|
-
|
156
|
+
They should be presented with a nice list of all available providers.
|
116
157
|
|
117
158
|
## Note on Patches/Pull Requests
|
118
159
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.1
|
data/lib/ticketmaster/project.rb
CHANGED
@@ -52,8 +52,8 @@ module TicketMasterMod
|
|
52
52
|
|
53
53
|
objects.each do |object|
|
54
54
|
matches = 0
|
55
|
-
query.
|
56
|
-
matches += 1 if object.send(
|
55
|
+
query.each_pair do |method, expected_value|
|
56
|
+
matches += 1 if object.send(method) == expected_value
|
57
57
|
end
|
58
58
|
|
59
59
|
matching_objects << object if matches == query.length
|
data/test/test_unfuddler.rb
CHANGED
@@ -49,7 +49,7 @@ class TestTicketmaster < Test::Unit::TestCase
|
|
49
49
|
|
50
50
|
assert_equal 1, ticket.id
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
should "create a ticket" do
|
54
54
|
assert @project.ticket.create(:priority => 3, :summary => "Test", :description => "Hello World from TicketMaster::Unfuddle").empty?
|
55
55
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ticketmaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 31
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Sirupsen
|
@@ -16,18 +15,16 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-12 00:00:00 +02:00
|
20
19
|
default_executable: ticket
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: hashie
|
24
23
|
prerelease: false
|
25
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
25
|
requirements:
|
28
26
|
- - ">="
|
29
27
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 3
|
31
28
|
segments:
|
32
29
|
- 0
|
33
30
|
version: "0"
|
@@ -37,11 +34,9 @@ dependencies:
|
|
37
34
|
name: shoulda
|
38
35
|
prerelease: false
|
39
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
37
|
requirements:
|
42
38
|
- - ">="
|
43
39
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 3
|
45
40
|
segments:
|
46
41
|
- 0
|
47
42
|
version: "0"
|
@@ -81,27 +76,23 @@ rdoc_options:
|
|
81
76
|
require_paths:
|
82
77
|
- lib
|
83
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
79
|
requirements:
|
86
80
|
- - ">="
|
87
81
|
- !ruby/object:Gem::Version
|
88
|
-
hash: 3
|
89
82
|
segments:
|
90
83
|
- 0
|
91
84
|
version: "0"
|
92
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
86
|
requirements:
|
95
87
|
- - ">="
|
96
88
|
- !ruby/object:Gem::Version
|
97
|
-
hash: 3
|
98
89
|
segments:
|
99
90
|
- 0
|
100
91
|
version: "0"
|
101
92
|
requirements: []
|
102
93
|
|
103
94
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.3.
|
95
|
+
rubygems_version: 1.3.6
|
105
96
|
signing_key:
|
106
97
|
specification_version: 3
|
107
98
|
summary: Ticketmaster provides a universal API to trouble ticket and project management systems.
|