ticketmaster-github 0.4.6 → 0.4.7

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/README.md CHANGED
@@ -5,7 +5,7 @@ This is a provider for [ticketmaster](http://ticketrb.com). It provides interope
5
5
  # Usage and Examples
6
6
 
7
7
  First we have to instantiate a new ticketmaster instance:
8
- github = TicketMaster.new(:github, {:username => "code", :token => "m4st3r!"})
8
+ github = TicketMaster.new(:github, {:login => "coder", :token => "m4st3r!"})
9
9
 
10
10
  If you do not pass in the token and the username, it will only access public information for the account.
11
11
 
@@ -14,8 +14,8 @@ If you do not pass in the token and the username, it will only access public inf
14
14
  You can find your own projects by doing:
15
15
 
16
16
  projects = github.projects # Will return all your repositories
17
- projects = github.projects(['your_repo1', 'your_repo2'])
18
- project = github.project('your_repo')
17
+ projects = github.projects(['your_repo1', 'your_repo2'])
18
+ project = github.project('your_repo')
19
19
 
20
20
  Also you can access other users repos
21
21
 
@@ -27,7 +27,7 @@ Or even make a search with an array
27
27
 
28
28
  == Finding Tickets(Issues)
29
29
 
30
- tickets = project.tickets # All open issues
30
+ tickets = project.tickets # All open issues
31
31
  tickets = project.tickets(:all, {:state => 'closed'}) # All closed tickets
32
32
  ticket = project.ticket(<issue_number>)
33
33
 
@@ -53,7 +53,7 @@ Or even make a search with an array
53
53
  comments = ticket.comments
54
54
 
55
55
  == Create Comment
56
- comment = ticket.comment!(<comment text>)
56
+ comment = ticket.comment!("your comment goes here")
57
57
 
58
58
  ## Requirements
59
59
 
@@ -83,4 +83,4 @@ If you see or find any issues, feel free to open up an issue report.
83
83
 
84
84
  ## Copyright
85
85
 
86
- Copyright (c) 2010 The Hybrid Group. See LICENSE for details.
86
+ Copyright (c) 2010-2011 The Hybrid Group. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.6
1
+ 0.4.7
@@ -38,11 +38,11 @@ module TicketMaster::Provider
38
38
  # declare needed overloaded methods here
39
39
 
40
40
  def self.find(project_id, ticket_id)
41
- TicketMaster::Provider::Github.api.issue_comments("#{TicketMaster::Provider::Github.login}/#{project_id}", ticket_id).collect { |comment| self.new comment }
41
+ TicketMaster::Provider::Github.api.issue_comments(project_id, ticket_id).collect { |comment| self.new comment }
42
42
  end
43
43
 
44
44
  def self.create(project_id, ticket_id, comment)
45
- self.new TicketMaster::Provider::Github.api.add_comment("#{TicketMaster::Provider::Github.login}/#{project_id}", ticket_id, comment)
45
+ self.new TicketMaster::Provider::Github.api.add_comment(project_id, ticket_id, comment)
46
46
  end
47
47
 
48
48
  end
@@ -34,6 +34,8 @@ module TicketMaster::Provider
34
34
  Project.find_all(options)
35
35
  elsif options.first.is_a? Array
36
36
  options.first.collect { |name| Project.find_by_id(name) }
37
+ elsif options.first.is_a? String
38
+ Project.find_by_id(options.first)
37
39
  elsif options.first.is_a? Hash
38
40
  Project.find_by_attributes(options.first)
39
41
  end
@@ -41,7 +41,7 @@ module TicketMaster::Provider
41
41
  end
42
42
 
43
43
  def id
44
- self[:name]
44
+ "#{self[:owner]}/#{self[:name]}"
45
45
  end
46
46
 
47
47
  # copy from this.copy(that) copies that into this
@@ -38,7 +38,7 @@ module TicketMaster::Provider
38
38
  end
39
39
 
40
40
  def self.find_by_id(project_id, number)
41
- self.new(project_id, TicketMaster::Provider::Github.api.issue("#{TicketMaster::Provider::Github.login}/#{project_id}", number))
41
+ self.new(project_id, TicketMaster::Provider::Github.api.issue(project_id, number))
42
42
  end
43
43
 
44
44
  def self.find(project_id, *options)
@@ -58,16 +58,16 @@ module TicketMaster::Provider
58
58
 
59
59
  def self.find_all(project_id)
60
60
  issues = []
61
- issues += TicketMaster::Provider::Github.api.issues("#{TicketMaster::Provider::Github.login}/#{project_id}")
61
+ issues += TicketMaster::Provider::Github.api.issues(project_id)
62
62
  state = 'closed'
63
- issues += TicketMaster::Provider::Github.api.issues("#{TicketMaster::Provider::Github.login}/#{project_id}", state)
63
+ issues += TicketMaster::Provider::Github.api.issues(project_id, state)
64
64
  issues.collect { |issue| Ticket.new(project_id, issue) }
65
65
  end
66
66
 
67
67
  def self.open(project_id, *options)
68
68
  body = options.first.delete(:body)
69
69
  title = options.first.delete(:title)
70
- TicketMaster::Provider::Github.api.create_issue("#{TicketMaster::Provider::Github.login}/#{project_id}", title, body, options.first)
70
+ TicketMaster::Provider::Github.api.create_issue(project_id, title, body, options.first)
71
71
  end
72
72
 
73
73
  def created_at
@@ -89,16 +89,16 @@ module TicketMaster::Provider
89
89
  def save
90
90
  t = Ticket.find_by_id(project_id, number)
91
91
  return false if t.title == title and t.body == body
92
- Ticket.new(project_id, TicketMaster::Provider::Github.api.update_issue("#{TicketMaster::Provider::Github.login}/#{project_id}", number, title, body))
92
+ Ticket.new(project_id, TicketMaster::Provider::Github.api.update_issue(project_id, number, title, body))
93
93
  true
94
94
  end
95
95
 
96
96
  def reopen
97
- Ticket.new(project_id, TicketMaster::Provider::Github.api.reopen_issue("#{TicketMaster::Provider::Github.login}/#{project_id}", number))
97
+ Ticket.new(project_id, TicketMaster::Provider::Github.api.reopen_issue(project_id, number))
98
98
  end
99
99
 
100
100
  def close
101
- Ticket.new(project_id, TicketMaster::Provider::Github.api.close_issue("#{TicketMaster::Provider::Github.login}/#{project_id}", number))
101
+ Ticket.new(project_id, TicketMaster::Provider::Github.api.close_issue(project_id, number))
102
102
  end
103
103
 
104
104
  def comments
@@ -1,5 +1,6 @@
1
1
  #require YOUR_PROVIDER_API
2
2
  require 'octokit'
3
+ require 'active_support/core_ext/string'
3
4
 
4
5
  %w{ github ticket project comment }.each do |f|
5
6
  require File.dirname(__FILE__) + '/provider/' + f + '.rb';
data/spec/project_spec.rb CHANGED
@@ -20,7 +20,13 @@ describe "Ticketmaster::Provider::Github::Project" do
20
20
  projects = @github.projects([@repo_name])
21
21
  projects.should be_an_instance_of(Array)
22
22
  projects.first.should be_an_instance_of(@klass)
23
- projects.first.id.should == @repo_name
23
+ projects.first.name.should == @repo_name
24
+ end
25
+
26
+ it "should be able to load a single project based on a single name(id)" do
27
+ project = @github.projects(@repo_name)
28
+ project.should be_an_instance_of(@klass)
29
+ project.name.should == @repo_name
24
30
  end
25
31
 
26
32
  it "should be able to find by name(id)" do
@@ -38,7 +44,7 @@ describe "Ticketmaster::Provider::Github::Project" do
38
44
  it "should be able to find by attributes" do
39
45
  projects = @github.projects(:name => @repo_name)
40
46
  projects.should be_an_instance_of(Array)
41
- projects.first.id.should be_eql(@repo_name)
47
+ projects.first.name.should be_eql(@repo_name)
42
48
  end
43
49
  end
44
50
 
data/spec/spec_helper.rb CHANGED
@@ -2,10 +2,10 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
 
4
4
  require 'rubygems'
5
+ require 'ticketmaster'
5
6
  require 'active_support/core_ext/string'
6
7
  require 'spec'
7
8
  require 'factory_girl'
8
- require 'ticketmaster'
9
9
  require 'ticketmaster-github'
10
10
 
11
11
  Dir["#{File.dirname(__FILE__)}/factories/*.rb"].each {|f| require f}
data/spec/ticket_spec.rb CHANGED
@@ -35,13 +35,7 @@ describe "Ticketmaster::Provider::Github::Ticket" do
35
35
 
36
36
  it "should be able to open a new ticket"
37
37
 
38
- it "should be able to update a existing ticket" do
39
- @api.stub!('issue').and_return(@ticket)
40
- tick = @project.ticket(@ticket_id)
41
- tick.stub!('save').and_return(true)
42
- tick.title = 'hello'
43
- tick.save.should be_eql(true)
44
- end
38
+ it "should be able to update a existing ticket"
45
39
 
46
40
  it "should be able to reopen a ticket"
47
41
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ticketmaster-github}
8
- s.version = "0.4.6"
8
+ s.version = "0.4.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["HybridGroup"]
12
- s.date = %q{2011-04-09}
12
+ s.date = %q{2011-04-11}
13
13
  s.description = %q{Ticketmaster provider for Github Issues tracking.}
14
14
  s.email = %q{hong@hybridgroup.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticketmaster-github
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 6
10
- version: 0.4.6
9
+ - 7
10
+ version: 0.4.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - HybridGroup
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-09 00:00:00 -07:00
18
+ date: 2011-04-11 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency