ticketmaster-github 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ nbproject/
23
+
24
+ ## RVM
25
+ .rvmrc
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2010 The Hybrid Group
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.md ADDED
@@ -0,0 +1,50 @@
1
+ # ticketmaster-github
2
+
3
+ This is a provider for [ticketmaster](http://ticketrb.com). It provides interoperability with [Github](http://www.github.com/) and its issue tracking system through the ticketmaster gem.
4
+
5
+ # Usage and Examples
6
+
7
+ First we have to instantiate a new ticketmaster instance:
8
+ github = TicketMaster.new(:github, {:username => "code", :password => "m4st3r!"})
9
+
10
+ If you do not pass in the token or both the username and password, it will only access public information for the account.
11
+
12
+ == Finding Projects
13
+
14
+ project = github.project['project_name']
15
+ project = github.project.find(:id => 505)
16
+
17
+ == Finding Tickets
18
+
19
+ tickets = project.tickets
20
+
21
+
22
+ ## Requirements
23
+
24
+ * rubygems (obviously)
25
+ * ticketmaster gem (latest version preferred)
26
+ * jeweler gem (only if you want to repackage and develop)
27
+ * Octopi gem provdes interface to Github
28
+
29
+ The ticketmaster gem should automatically be installed during the installation of this gem if it is not already installed.
30
+
31
+ ## Other Notes
32
+
33
+ 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.
34
+
35
+ If you see or find any issues, feel free to open up an issue report.
36
+
37
+
38
+ ## Note on Patches/Pull Requests
39
+
40
+ * Fork the project.
41
+ * Make your feature addition or bug fix.
42
+ * Add tests for it. This is important so we don't break it in a
43
+ future version unintentionally.
44
+ * Commit, do not mess with rakefile, version, or history.
45
+ (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)
46
+ * Send us a pull request. Bonus points for topic branches.
47
+
48
+ ## Copyright
49
+
50
+ Copyright (c) 2010 The Hybrid Group. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "ticketmaster-github"
8
+ gem.summary = %Q{The github provider for ticketmaster}
9
+ gem.description = %Q{This provides an interface with github through the ticketmaster gem.}
10
+ gem.email = "hong.quach@abigfisch.com"
11
+ gem.homepage = "http://github.com/kiafaldorius/ticketmaster-github"
12
+ gem.authors = ["HybridGroup"]
13
+ gem.add_development_dependency "rspec", ">= 1.2.9"
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+ Jeweler::GemcutterTasks.new
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
+ end
20
+
21
+ require 'spec/rake/spectask'
22
+ Spec::Rake::SpecTask.new(:spec) do |spec|
23
+ spec.libs << 'lib' << 'spec'
24
+ spec.spec_files = FileList['spec/**/*_spec.rb']
25
+ end
26
+
27
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
28
+ spec.libs << 'lib' << 'spec'
29
+ spec.pattern = 'spec/**/*_spec.rb'
30
+ spec.rcov = true
31
+ end
32
+
33
+ task :spec => :check_dependencies
34
+
35
+ task :default => :spec
36
+
37
+ require 'rake/rdoctask'
38
+ Rake::RDocTask.new do |rdoc|
39
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
+
41
+ rdoc.rdoc_dir = 'rdoc'
42
+ rdoc.title = "ticketmaster-github #{version}"
43
+ rdoc.rdoc_files.include('README*')
44
+ rdoc.rdoc_files.include('lib/**/*.rb')
45
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,28 @@
1
+ module TicketMaster::Provider
2
+ module Github
3
+
4
+ class GithubComment
5
+ include HTTParty
6
+ URI = 'http://github.com/api/v2/json'
7
+ attr_accessor :gravatar_id, :created_at, :body, :updated_at, :id, :user
8
+
9
+ base_uri "http://github.com/api/v2/json"
10
+
11
+ def self.find_all(repo, number)
12
+ HTTParty.get("#{URI}/issues/comments/#{repo.username}/#{repo.name}/#{number}", :query => auth_params).parsed_response['comments']
13
+ end
14
+
15
+ def self.create(repo, number, comment)
16
+ HTTParty.post("#{secure}/issues/comment/#{repo.username}/#{repo.name}/#{number}", :query => auth_params, :body => {:comment => comment}).parsed_response['comment']
17
+ end
18
+
19
+ def self.auth_params
20
+ {:login => Octopi::Api.api.login, :token => Octopi::Api.api.token}
21
+ end
22
+
23
+ def self.secure
24
+ URI.gsub('http','https')
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,38 @@
1
+ module TicketMaster::Provider
2
+ module Github
3
+ # The comment class for ticketmaster-github
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
+ attr_accessor :prefix_options
10
+ API = GithubComment
11
+
12
+ def initialize(*options)
13
+ if options.first.is_a? Hash
14
+ super options.first
15
+ end
16
+ end
17
+
18
+ # declare needed overloaded methods here
19
+ def self.find_by_id(project_id, ticket_id, id)
20
+ warn "This method is not supported by Github's API"
21
+ end
22
+
23
+ def self.find_by_attributes(project_id, ticket_id, attributes = {})
24
+ warn "Github API only gets all comments"
25
+ self::API.find_all(Project.find(:first, [project_id]), ticket_id).collect {|comment| self.new comment}
26
+ end
27
+
28
+ def self.search(project_id, ticket_id, options = {}, limit = 1000)
29
+ warn "This method is not supported by Github's API"
30
+ end
31
+
32
+ def self.create(project_id, ticket_id, comment)
33
+ self.new self::API.create(Project.find(:first, [project_id]), ticket_id, comment)
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,45 @@
1
+ module TicketMaster::Provider
2
+ # This is the Github Provider for ticketmaster
3
+ module Github
4
+ include TicketMaster::Provider::Base
5
+ PROJECT_API = Octopi::Repository
6
+ ISSUE_API = Octopi::Issue
7
+
8
+ # This is for cases when you want to instantiate using TicketMaster::Provider::Github.new(auth)
9
+ def self.new(auth = {})
10
+ TicketMaster.new(:github, auth)
11
+ end
12
+
13
+ # declare needed overloaded methods here
14
+ def authorize(auth = {})
15
+ @authentication ||= TicketMaster::Authenticator.new(auth)
16
+ auth = @authentication
17
+ if auth.token.nil? or auth.login.nil?
18
+ raise "Please provide token and login"
19
+ else
20
+ Octopi::Api.api = Octopi::AuthApi.instance
21
+ Octopi::Api.api.token = auth.token
22
+ Octopi::Api.api.login = auth.login
23
+ end
24
+ end
25
+
26
+ def projects(*options)
27
+ unless options.empty?
28
+ options.collect{|name| Project.find(name)}.first if options.first.is_a?(Array)
29
+ else
30
+ PROJECT_API.find(:user => Octopi::Api.api.login).collect{|repo| Project.new repo}
31
+ end
32
+ end
33
+
34
+ def project(*name)
35
+ unless name.empty?
36
+ Project.find(name.first)
37
+ else
38
+ super
39
+ end
40
+ end
41
+
42
+ end
43
+ end
44
+
45
+
@@ -0,0 +1,98 @@
1
+ module TicketMaster::Provider
2
+ module Github
3
+ # Project class for ticketmaster-github
4
+ #
5
+ #
6
+ class Project < TicketMaster::Provider::Base::Project
7
+ attr_accessor :prefix_options, :name, :user
8
+
9
+ API = Octopi::Repository
10
+ # declare needed overloaded methods here
11
+
12
+ def initialize(*object)
13
+ if object.first
14
+ object = object.first
15
+ hash = {'description' => object.description,
16
+ 'url' => object.url,
17
+ 'forks' => object.forks,
18
+ 'name' => object.name,
19
+ 'homepage' => object.homepage,
20
+ 'watchers' => object.watchers,
21
+ 'private' => object.private,
22
+ 'fork' => object.fork,
23
+ 'open_issues' => object.open_issues,
24
+ 'pledgie' => object.pledgie,
25
+ 'size' => object.size,
26
+ 'actions' => object.actions,
27
+ 'score' => object.score,
28
+ 'language' => object.language,
29
+ 'followers' => object.followers,
30
+ 'type' => object.type,
31
+ 'username' => object.username,
32
+ 'id' => object.id,
33
+ 'pushed' => object.pushed,
34
+ 'created' => object.created}
35
+
36
+ @name = object.name
37
+ @user = object.username
38
+ super hash
39
+ end
40
+ end
41
+
42
+ def self.search(options = {}, limit = 100)
43
+ raise "Please supply arguments for search" if options.blank?
44
+ if options.is_a? Hash
45
+ r = self.new self::API.find(options)
46
+ [] << r
47
+ else
48
+ self::API.find_all(options)[0...limit].collect { |repo| self.new repo }
49
+ end
50
+ end
51
+
52
+ def self.find_by_id(id)
53
+ warn "Github API only finds by name"
54
+ self.new self::API.find({:user => Octopi::Api.api.login, :repo => id})
55
+ end
56
+
57
+ # copy from this.copy(that) copies that into this
58
+ def copy(project)
59
+ project.tickets.each do |ticket|
60
+ copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
61
+ ticket.comments.each do |comment|
62
+ copy_ticket.comment!(:body => comment.body)
63
+ sleep 1
64
+ end
65
+ end
66
+ end
67
+
68
+ def easy_finder(api, *options)
69
+ if api.is_a? Class
70
+ #return api if options.length == 0 and symbol == :first
71
+ api.find(*options)
72
+ end
73
+ end
74
+
75
+ def tickets(*options)
76
+ first = options.shift
77
+
78
+ if first.nil? || (first == :all and options.nil?)
79
+ easy_finder(TicketMaster::Provider::Github::Ticket, name, :all)
80
+ elsif first.is_a? Fixnum
81
+ easy_finder(TicketMaster::Provider::Github::Ticket, name, first)
82
+ elsif first
83
+ unless options.blank?
84
+ options = options.first
85
+ else
86
+ options = {}
87
+ end
88
+ easy_finder(TicketMaster::Provider::Github::Ticket, name, first, options)
89
+ end
90
+ end
91
+
92
+ def ticket!(*options)
93
+ TicketMaster::Provider::Github::Ticket.open(name, {:params => options.first})
94
+ end
95
+
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,85 @@
1
+ module TicketMaster::Provider
2
+ module Github
3
+ # Ticket class for ticketmaster-github
4
+
5
+ class Ticket < TicketMaster::Provider::Base::Ticket
6
+
7
+ @@allowed_states = %w{open close}
8
+ attr_accessor :prefix_options
9
+ API = Octopi::Issue
10
+ # declare needed overloaded methods here
11
+
12
+ def initialize(*object)
13
+ if object.first
14
+ object = object.first
15
+ unless object.is_a? Hash
16
+ hash = {:repository => object.repository.name,
17
+ :user => object.user,
18
+ :updated_at => object.updated_at,
19
+ :votes => object.votes,
20
+ :number => object.number,
21
+ :title => object.title,
22
+ :body => object.body,
23
+ :closed_at => object.closed_at,
24
+ :labels => object.labels,
25
+ :state => object.state,
26
+ :created_at => object.created_at
27
+ }
28
+ else
29
+ hash = object
30
+ end
31
+
32
+ super hash
33
+ end
34
+ end
35
+
36
+ def self.find_by_id(project_id, ticket_id)
37
+ self.new self::API.find(build_attributes(project_id, {:number => ticket_id}))
38
+ end
39
+
40
+ def self.find_by_attributes(project_id, attributes = {})
41
+ attributes ||= {}
42
+ attributes[:state] ||= 'open'
43
+ self::API.find_all(build_attributes(project_id, attributes)).collect{|issue| self.new issue}
44
+ end
45
+
46
+ def self.build_attributes(repo, options)
47
+ hash = {:repo => repo, :user => Octopi::Api.api.login}
48
+ hash.merge!(options)
49
+ end
50
+
51
+ def self.open(project_id, *options)
52
+ self.new self::API.open(build_attributes(project_id, options.first))
53
+ end
54
+
55
+ def close
56
+ Ticket.new API.find(Ticket.build_attributes(repository, {:number => number})).close!
57
+ end
58
+
59
+ def reopen
60
+ Ticket.new API.find(Ticket.build_attributes(repository, {:number => number})).reopen!
61
+ end
62
+
63
+ def save
64
+ t = API.find(Ticket.build_attributes(repository, {:number => number}))
65
+
66
+ return false if t.title == title and t.body = body
67
+
68
+ t.title = title
69
+ t.body = body
70
+ t.save
71
+
72
+ true
73
+ end
74
+
75
+ def comments
76
+ Comment.find(repository, number, :all)
77
+ end
78
+
79
+ def comment!(comment)
80
+ Comment.create(repository, number, comment)
81
+ end
82
+
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,11 @@
1
+ #require YOUR_PROVIDER_API
2
+ require 'octopi'
3
+ require 'httparty'
4
+
5
+ %w{ github }.each do |f|
6
+ require File.dirname(__FILE__) + '/github/' + f + '.rb';
7
+ end
8
+
9
+ %w{ github ticket project comment }.each do |f|
10
+ require File.dirname(__FILE__) + '/provider/' + f + '.rb';
11
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ticketmaster::Provider::Github::Comment" do
4
+ before(:all) do
5
+ @github = TicketMaster.new(:github, {:login => 'juanespinosa', :token => 'asdfghk'})
6
+ @klass = TicketMaster::Provider::Github::Comment
7
+ @api = TicketMaster::Provider::Github::GithubComment
8
+ @repository = Factory.build(:repository)
9
+ end
10
+
11
+ before(:each) do
12
+ issue = Factory.build(:issue)
13
+ issue.stub_chain(:repository, :name).and_return(issue.repository)
14
+ @ticket = TicketMaster::Provider::Github::Ticket.new issue
15
+ @comment = Factory.build(:comment)
16
+ @comments = [@comment]
17
+ Octopi::Repository.stub!(:find_all).and_return([@repository])
18
+ end
19
+
20
+ it "should be able to load all comments" do
21
+ @api.stub!(:find_all).and_return(@comments)
22
+ @ticket.comments.should be_an_instance_of(Array)
23
+ @ticket.comments.first.should be_an_instance_of(@klass)
24
+ end
25
+
26
+ it "should be able to create a new comment" do
27
+ @api.stub!(:create).and_return(@comment)
28
+ @comment = @ticket.comment!("A new comment")
29
+ @comment.should be_an_instance_of(@klass)
30
+ end
31
+
32
+ end
@@ -0,0 +1,7 @@
1
+ Factory.define :comment, :class => TicketMaster::Provider::Github::GithubComment do |p|
2
+ p.body 'Body message'
3
+ p.id '335287'
4
+ p.created_at '2010/07/30 13:50:42'
5
+ p.updated_at '2010/07/30 13:50:42'
6
+ p.user 'juanespinosa'
7
+ end
@@ -0,0 +1,13 @@
1
+ Factory.define :issue, :class => Octopi::Issue do |p|
2
+ p.repository 'test-juange'
3
+ p.user 'juanespinosa'
4
+ p.updated_at ''
5
+ p.votes ''
6
+ p.number '1'
7
+ p.title 'test'
8
+ p.body 'test ticket body'
9
+ p.closed_at ''
10
+ p.labels ''
11
+ p.state 'open'
12
+ p.created_at ''
13
+ end
@@ -0,0 +1,22 @@
1
+ Factory.define :repository, :class => Octopi::Repository do |p|
2
+ p.description ''
3
+ p.url ''
4
+ p.forks ''
5
+ p.name 'test-juange'
6
+ p.homepage ''
7
+ p.watchers ''
8
+ p.private ''
9
+ p.fork ''
10
+ p.open_issues ''
11
+ p.pledgie ''
12
+ p.size ''
13
+ p.actions ''
14
+ p.score ''
15
+ p.language ''
16
+ p.followers ''
17
+ p.type ''
18
+ p.username 'juanespinosa'
19
+ p.id ''
20
+ p.pushed ''
21
+ p.created ''
22
+ end
@@ -0,0 +1,56 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ticketmaster::Provider::Github::Project" do
4
+
5
+ before(:all) do
6
+ @repo_name = "test-juange"
7
+ @klass = TicketMaster::Provider::Github::Project
8
+ end
9
+
10
+ before(:each) do
11
+ @repository = Factory.build(:repository)
12
+ @repositories = [@repository]
13
+ @github = TicketMaster.new(:github, {:login => 'juanespinosa', :token => 'asdfghk'})
14
+ end
15
+
16
+ it "should be able to load all projects" do
17
+ Octopi::Repository.stub!(:find).and_return(@repositories)
18
+ projects = @github.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 find by name(id)" do
24
+ Octopi::Repository.stub!(:find).and_return(@repository)
25
+ p = @github.project(@repo_name)
26
+ p.should be_an_instance_of(@klass)
27
+ p.name.should be_eql(@repo_name)
28
+ end
29
+
30
+ it "should be able to find by name(id) with find method" do
31
+ Octopi::Repository.stub!(:find).and_return(@repository)
32
+ p = @github.project.find(@repo_name)
33
+ p.should be_an_instance_of(@klass)
34
+ p.name.should be_eql(@repo_name)
35
+ end
36
+
37
+ it "should be able to get projects with array of names" do
38
+ Octopi::Repository.stub!(:find).and_return(@repository)
39
+ p = @github.projects([@repo_name])
40
+ p.should be_an_instance_of(Array)
41
+ p.first.should be_an_instance_of(@klass)
42
+ end
43
+
44
+ it "should be able to find by attributes(name and repo)" do
45
+ Octopi::Repository.stub!(:find).and_return(@repository)
46
+ p = @github.project.find(:first, {:user => 'juanespinosa', :repo => 'test-juange'})
47
+ p.should be_an_instance_of(@klass)
48
+ end
49
+
50
+ it "should be able to find repos in an array" do
51
+ Octopi::Repository.stub!(:find_all).and_return(@repositories)
52
+ p = @github.project.find(:all, ['test-juange', 'ticketmaster'])
53
+ p.should be_an_instance_of(Array)
54
+ end
55
+ end
56
+
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'rubygems'
5
+ require 'ticketmaster'
6
+ require 'ticketmaster-github'
7
+ require 'spec'
8
+ require 'factory_girl'
9
+
10
+ Dir["#{File.dirname(__FILE__)}/factories/*.rb"].each {|f| require f}
11
+ Spec::Runner.configure do |config|
12
+ end
@@ -0,0 +1,65 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ticketmaster::Provider::Github::Ticket" do
4
+ before(:all) do
5
+ @github = TicketMaster.new(:github, {:login => 'juanespinosa', :token => 'asdfghk'})
6
+ @klass = TicketMaster::Provider::Github::Ticket
7
+ @api = Octopi::Issue
8
+ end
9
+
10
+ before(:each) do
11
+ @ticket_id = "1"
12
+ @project = TicketMaster::Provider::Github::Project.new Factory.build(:repository)
13
+ @ticket = Factory.build(:issue)
14
+ @tickets = [@ticket]
15
+ @ticket.stub_chain(:repository, :name).and_return(@ticket.repository)
16
+ end
17
+
18
+ it "should be able to load all tickets" do
19
+ @api.stub!(:find_all).and_return(@tickets)
20
+ tickets = @project.tickets
21
+ tickets.should be_an_instance_of(Array)
22
+ tickets.first.should be_an_instance_of(@klass)
23
+ end
24
+
25
+ it "should be able to load ticket from an array of ids" do
26
+ @api.stub!(:find).and_return(@ticket)
27
+ @tickets = @project.tickets([@ticket_id])
28
+ @tickets.should be_an_instance_of(Array)
29
+ @tickets.first.should be_an_instance_of(@klass)
30
+ @tickets.first.number.should == @ticket_id
31
+ end
32
+
33
+ it "should be able to find a single ticket based on number attribute" do
34
+ @api.stub!(:find).and_return(@ticket)
35
+ @ticket = @project.tickets({:number => @ticket_id})
36
+ @ticket.should be_an_instance_of(@klass)
37
+ end
38
+
39
+ it "should find a ticket by id(number)" do
40
+ @api.stub!(:find).and_return(@ticket)
41
+ @project.tickets(@ticket_id).should be_an_instance_of(@klass)
42
+ end
43
+
44
+ it "should be able to open a new ticket" do
45
+ @api.stub!(:open).and_return(@ticket)
46
+ tick = @project.ticket!({:body => "new ticket", :title => "New"})
47
+ tick.should be_an_instance_of(@klass)
48
+ end
49
+
50
+ it "should be able to update a existing ticket" do
51
+ @ticket.stub!(:save).and_return(true)
52
+ @ticket.body = "new ticket body"
53
+ @ticket.save.should be_eql(true)
54
+ end
55
+
56
+ it "should be able to close a ticket" do
57
+ @api.stub_chain(:find, :close!).and_return(@ticket)
58
+ @klass.new.close.should be_an_instance_of(@klass)
59
+ end
60
+
61
+ it "should be able to reopen a ticket" do
62
+ @api.stub_chain(:find, :reopen!).and_return(@ticket)
63
+ @klass.new.reopen.should be_an_instance_of(@klass)
64
+ end
65
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ticketmaster::Provider::Github" do
4
+
5
+ it "Should be able to instantiate a new instance" do
6
+ @github = TicketMaster.new(:Github, {:login => 'juanespinosa', :token => 'asdfghk'})
7
+ @github.should be_an_instance_of(TicketMaster)
8
+ @github.should be_a_kind_of(TicketMaster::Provider::Github)
9
+ end
10
+
11
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ticketmaster-github
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - HybridGroup
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-12 00:00:00 -05: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
+ description: This provides an interface with github through the ticketmaster gem.
38
+ email: hong.quach@abigfisch.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.md
46
+ files:
47
+ - .document
48
+ - .gitignore
49
+ - LICENSE
50
+ - README.md
51
+ - Rakefile
52
+ - VERSION
53
+ - lib/github/github.rb
54
+ - lib/provider/comment.rb
55
+ - lib/provider/github.rb
56
+ - lib/provider/project.rb
57
+ - lib/provider/ticket.rb
58
+ - lib/ticketmaster-github.rb
59
+ - spec/comment_spec.rb
60
+ - spec/factories/comment.rb
61
+ - spec/factories/issue.rb
62
+ - spec/factories/repository.rb
63
+ - spec/project_spec.rb
64
+ - spec/spec.opts
65
+ - spec/spec_helper.rb
66
+ - spec/ticket_spec.rb
67
+ - spec/ticketmaster-github_spec.rb
68
+ has_rdoc: true
69
+ homepage: http://github.com/kiafaldorius/ticketmaster-github
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options:
74
+ - --charset=UTF-8
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project:
98
+ rubygems_version: 1.3.7
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: The github provider for ticketmaster
102
+ test_files:
103
+ - spec/comment_spec.rb
104
+ - spec/factories/comment.rb
105
+ - spec/factories/issue.rb
106
+ - spec/factories/repository.rb
107
+ - spec/project_spec.rb
108
+ - spec/spec_helper.rb
109
+ - spec/ticket_spec.rb
110
+ - spec/ticketmaster-github_spec.rb