ticketmaster-github 0.3.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/kiafaldorius/ticketmaster-github"
12
12
  gem.authors = ["HybridGroup"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_dependency "octopi", ">= 0.3.0"
14
+ gem.add_dependency "octokit"
15
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.1
@@ -7,7 +7,6 @@ module TicketMaster::Provider
7
7
  #
8
8
  class Comment < TicketMaster::Provider::Base::Comment
9
9
  attr_accessor :prefix_options
10
- API = GithubComment
11
10
 
12
11
  def initialize(*options)
13
12
  if options.first.is_a? Hash
@@ -37,23 +36,15 @@ module TicketMaster::Provider
37
36
  end
38
37
 
39
38
  # declare needed overloaded methods here
40
- def self.find_by_id(project_id, ticket_id, id)
41
- warn "This method is not supported by Github's API"
39
+
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 }
42
42
  end
43
-
44
- def self.find_by_attributes(project_id, ticket_id, attributes = {})
45
- warn "Github API only gets all comments"
46
- self::API.find_all(Project.find(:first, [project_id]), ticket_id).collect {|comment| self.new comment, project_id, ticket_id}
47
- end
48
-
49
- def self.search(project_id, ticket_id, options = {}, limit = 1000)
50
- warn "This method is not supported by Github's API"
51
- end
52
-
43
+
53
44
  def self.create(project_id, ticket_id, comment)
54
- self.new self::API.create(Project.find(:first, [project_id]), ticket_id, comment)
45
+ self.new TicketMaster::Provider::Github.api.add_comment("#{TicketMaster::Provider::Github.login}/#{project_id}", ticket_id, comment)
55
46
  end
56
-
47
+
57
48
  end
58
49
  end
59
50
  end
@@ -2,11 +2,9 @@ module TicketMaster::Provider
2
2
  # This is the Github Provider for ticketmaster
3
3
  module Github
4
4
  include TicketMaster::Provider::Base
5
- PROJECT_API = Octopi::Repository
6
- ISSUE_API = Octopi::Issue
7
5
 
8
6
  class << self
9
- attr_accessor :login
7
+ attr_accessor :login, :api
10
8
  end
11
9
 
12
10
  # This is for cases when you want to instantiate using TicketMaster::Provider::Github.new(auth)
@@ -22,31 +20,31 @@ module TicketMaster::Provider
22
20
  raise TicketMaster::Exception.new('Please provide at least a username')
23
21
  elsif auth.token.blank?
24
22
  TicketMaster::Provider::Github.login = auth.login || auth.username
25
- Octopi::Api.api = Octopi::AnonymousApi.instance
23
+ TicketMaster::Provider::Github.api = Octokit.client(:login => auth.login)
26
24
  else
27
25
  TicketMaster::Provider::Github.login = auth.login || auth.username
28
- Octopi::Api.api = Octopi::AuthApi.instance
29
- Octopi::Api.api.token = auth.token
30
- Octopi::Api.api.login = auth.login || auth.username
26
+ TicketMaster::Provider::Github.api = Octokit.client(:login => auth.login, :token => auth.token)
31
27
  end
32
28
  end
33
29
 
34
30
  def projects(*options)
35
31
  if options.empty?
36
- PROJECT_API.find(:user => TicketMaster::Provider::Github.login).collect{|repo| Project.new repo}
37
- elsif options.first.is_a?(Array)
38
- options.collect{|name| Project.find(name)}.first
32
+ Project.find_all(options)
33
+ elsif options.first.is_a? Array
34
+ options.first.collect { |name| Project.find_by_id(name) }
35
+ elsif options.first.is_a? Hash
36
+ Project.find_by_attributes(options.first)
39
37
  end
40
38
  end
41
-
42
- def project(*name)
43
- unless name.empty?
44
- Project.find(name.first)
39
+
40
+ def project(*project)
41
+ unless project.empty?
42
+ Project.find_by_id(project.first)
45
43
  else
46
44
  super
47
45
  end
48
46
  end
49
-
47
+
50
48
  end
51
49
  end
52
50
 
@@ -4,57 +4,29 @@ module TicketMaster::Provider
4
4
  #
5
5
  #
6
6
  class Project < TicketMaster::Provider::Base::Project
7
- attr_accessor :prefix_options, :name, :user
8
7
 
9
- API = Octopi::Repository
10
8
  # declare needed overloaded methods here
11
-
12
- def initialize(*object)
9
+ def initialize(*object)
13
10
  if object.first
14
11
  object = object.first
15
- @system_data = {:client => object}
16
- hash = {'description' => object.description,
17
- 'url' => object.url,
18
- 'forks' => object.forks,
19
- 'name' => object.name,
20
- 'homepage' => object.homepage,
21
- 'watchers' => object.watchers,
22
- 'private' => object.private,
23
- 'fork' => object.fork,
24
- 'open_issues' => object.open_issues,
25
- 'pledgie' => object.pledgie,
26
- 'size' => object.size,
27
- 'actions' => object.actions,
28
- 'score' => object.score,
29
- 'language' => object.language,
30
- 'followers' => object.followers,
31
- 'type' => object.type,
32
- 'username' => object.username,
33
- 'id' => object.name,
34
- 'pushed' => object.pushed,
35
- 'created' => object.created}
36
-
37
- @name = object.name
38
- @user = object.username
39
- super hash
40
- end
41
- end
42
-
43
- def self.search(options = {}, limit = 100)
44
- raise "Please supply arguments for search" if options.blank?
45
- if options.is_a? Hash
46
- r = self.new self::API.find(options)
47
- [] << r
48
- else
49
- self::API.find_all(options)[0...limit].collect { |repo| self.new repo }
50
- end
12
+ @system_data = {:client => object}
13
+ unless object.is_a? Hash
14
+ hash = {:description => object.description,
15
+ :created_at => object.created_at,
16
+ :name => object.name,
17
+ :id => object.name,
18
+ :owner => object.owner}
19
+ else
20
+ hash = object
21
+ end
22
+ super hash
23
+ end
51
24
  end
52
-
53
- def self.find_by_id(id)
54
- warn "Github API only finds by name"
55
- self.new self::API.find({:user => TicketMaster::Provider::Github.login, :repo => id})
25
+
26
+ def id
27
+ self[:name]
56
28
  end
57
-
29
+
58
30
  # copy from this.copy(that) copies that into this
59
31
  def copy(project)
60
32
  project.tickets.each do |ticket|
@@ -65,26 +37,36 @@ module TicketMaster::Provider
65
37
  end
66
38
  end
67
39
  end
68
-
69
- def easy_finder(api, *options)
70
- if api.is_a? Class
71
- #return api if options.length == 0 and symbol == :first
72
- api.find(*options)
73
- end
40
+
41
+ def self.find_by_attributes(attributes = {})
42
+ search_by_attribute(find_all, attributes).collect { |project| self.new project }
74
43
  end
75
44
 
76
- def ticket(*options)
77
- TicketMaster::Provider::Github::Ticket.find(self.id, *options)
45
+ def self.find_by_id(id)
46
+ self.new TicketMaster::Provider::Github.api.repository("#{TicketMaster::Provider::Github.login}/#{id}")
78
47
  end
79
-
48
+
49
+ def self.find_all(*options)
50
+ TicketMaster::Provider::Github.api.repositories(TicketMaster::Provider::Github.login).collect { |repository|
51
+ self.new repository }
52
+ end
53
+
80
54
  def tickets(*options)
81
- TicketMaster::Provider::Github::Ticket.find(self.id, *options)
55
+ TicketMaster::Provider::Github::Ticket.find(self.id, options)
56
+ end
57
+
58
+ def ticket(*options)
59
+ unless options.empty?
60
+ TicketMaster::Provider::Github::Ticket.find_by_id(self.id, options.first)
61
+ else
62
+ TicketMaster::Provider::Github::Ticket
63
+ end
82
64
  end
83
-
65
+
84
66
  def ticket!(*options)
85
- TicketMaster::Provider::Github::Ticket.open(name, {:params => options.first})
67
+ TicketMaster::Provider::Github::Ticket.open(self.id, options.first)
86
68
  end
87
-
88
69
  end
70
+
89
71
  end
90
72
  end
@@ -6,103 +6,93 @@ module TicketMaster::Provider
6
6
 
7
7
  @@allowed_states = %w{open close}
8
8
  attr_accessor :prefix_options
9
- API = Octopi::Issue
10
9
  # declare needed overloaded methods here
11
10
 
12
- def initialize(*object)
11
+ def initialize(*object)
12
+ project_id = object.shift
13
13
  if object.first
14
14
  object = object.first
15
- @system_data = {:client => object}
16
- unless object.is_a? Hash
17
- hash = {:repository => object.repository.name,
18
- :user => object.user,
19
- :updated_at => object.updated_at,
20
- :votes => object.votes,
21
- :number => object.number,
22
- :title => object.title,
23
- :body => object.body,
24
- :closed_at => object.closed_at,
25
- :labels => object.labels,
26
- :state => object.state,
27
- :created_at => object.created_at,
28
- :id => object.number,
29
- :project_id => object.repository.name,
30
- :description => object.body,
31
- :status => object.state,
32
- :resolution => (object.state == 'closed' ? 'closed' : nil),
33
- :requestor => object.user
34
- }
35
- else
36
- hash = object
37
- end
15
+ @system_data = {:client => object}
16
+ unless object.is_a? Hash
17
+ hash = {:title => object.title,
18
+ :created_at => object.created_at,
19
+ :updated_at => object.updated_at,
20
+ :number => object.number,
21
+ :user => object.user,
22
+ :id => object.number,
23
+ :state => object.state,
24
+ :html_url => object.html_url,
25
+ :position => object.position,
26
+ :description => object.body,
27
+ :project_id => project_id}
28
+ else
29
+ object.merge!(:project_id => project_id)
30
+ hash = object
31
+ end
32
+ super hash
33
+ end
34
+ end
38
35
 
39
- super hash
40
- end
36
+ def id
37
+ self[:number]
41
38
  end
42
-
43
- def self.find_by_id(project_id, ticket_id)
44
- self.new self::API.find(build_attributes(project_id, {:number => ticket_id}))
39
+
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))
45
42
  end
46
-
43
+
44
+ def self.find(project_id, *options)
45
+ if options.first.empty?
46
+ self.find_all(project_id)
47
+ elsif options[0].first.is_a? Array
48
+ options.first.collect { |number| self.find_by_id(project_id, number) }
49
+ elsif options[0].first.is_a? Hash
50
+ self.find_by_attributes(project_id, options[0].first)
51
+ end
52
+ end
53
+
47
54
  def self.find_by_attributes(project_id, attributes = {})
48
- attributes ||= {}
49
- issues = []
50
- if attributes[:state].nil?
51
- attributes[:state] = 'open'
52
- issues += self::API.find_all(build_attributes(project_id, attributes))
53
- attributes[:state] = 'closed'
54
- begin
55
- issues += self::API.find_all(build_attributes(project_id, attributes))
56
- rescue APICache::TimeoutError
57
- warn "Unable to fetch closed issues due to timeout"
58
- end
59
- else
60
- issues = self::API.find_all(build_attributes(project_id, attributes))
61
- end
62
- issues.collect { |issue| self.new issue }
55
+ issues = self.find_all(project_id)
56
+ search_by_attribute(issues, attributes)
63
57
  end
64
-
65
- def self.build_attributes(repo, options)
66
- hash = {:repo => repo, :user => TicketMaster::Provider::Github.login}
67
- hash.merge!(options)
58
+
59
+ def self.find_all(project_id)
60
+ issues = []
61
+ issues += TicketMaster::Provider::Github.api.issues("#{TicketMaster::Provider::Github.login}/#{project_id}")
62
+ state = 'closed'
63
+ issues += TicketMaster::Provider::Github.api.issues("#{TicketMaster::Provider::Github.login}/#{project_id}", state)
64
+ issues.collect { |issue| Ticket.new(project_id, issue) }
68
65
  end
69
-
66
+
70
67
  def self.open(project_id, *options)
71
- begin
72
- self.new self::API.open(build_attributes(project_id, options.first))
73
- rescue
74
- self.find(project_id, :all).last
75
- end
68
+ body = options.first.delete(:body)
69
+ title = options.first.delete(:title)
70
+ TicketMaster::Provider::Github.api.create_issue("#{TicketMaster::Provider::Github.login}/#{project_id}", title, body, options.first)
76
71
  end
77
-
78
- def close
79
- Ticket.new API.find(Ticket.build_attributes(repository, {:number => number})).close!
72
+
73
+ def save
74
+ t = Ticket.find_by_id(project_id, number)
75
+ return false if t.title == title and t.body == body
76
+ Ticket.new(project_id, TicketMaster::Provider::Github.api.update_issue("#{TicketMaster::Provider::Github.login}/#{project_id}", number, title, body))
77
+ true
80
78
  end
81
-
79
+
82
80
  def reopen
83
- Ticket.new API.find(Ticket.build_attributes(repository, {:number => number})).reopen!
81
+ Ticket.new(project_id, TicketMaster::Provider::Github.api.reopen_issue("#{TicketMaster::Provider::Github.login}/#{project_id}", number))
84
82
  end
85
-
86
- def save
87
- t = API.find(Ticket.build_attributes(repository, {:number => number}))
88
-
89
- return false if t.title == title and t.body == body
90
-
91
- t.title = title
92
- t.body = body
93
- t.save
94
-
95
- true
83
+
84
+ def close
85
+ Ticket.new(project_id, TicketMaster::Provider::Github.api.close_issue("#{TicketMaster::Provider::Github.login}/#{project_id}", number))
96
86
  end
97
-
87
+
98
88
  def comments
99
- Comment.find(repository, number, :all)
89
+ Comment.find(project_id, number)
100
90
  end
101
-
91
+
102
92
  def comment!(comment)
103
- Comment.create(repository, number, comment)
93
+ Comment.create(project_id, number, comment)
104
94
  end
105
-
95
+
106
96
  end
107
97
  end
108
98
  end
@@ -1,10 +1,5 @@
1
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
2
+ require 'octokit'
8
3
 
9
4
  %w{ github ticket project comment }.each do |f|
10
5
  require File.dirname(__FILE__) + '/provider/' + f + '.rb';
data/spec/comment_spec.rb CHANGED
@@ -1,32 +1,19 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
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
4
 
11
5
  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])
6
+ @github = TicketMaster.new(:github, {:login => 'cored', :token => 'kdkdkd'})
7
+ @klass = TicketMaster::Provider::Github::Comment
8
+ @api = Octokit::Client
18
9
  end
19
10
 
20
11
  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)
12
+ pending
24
13
  end
25
14
 
26
15
  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)
16
+ pending
30
17
  end
31
18
 
32
- end
19
+ end
@@ -1,7 +1,7 @@
1
- Factory.define :comment, :class => TicketMaster::Provider::Github::GithubComment do |p|
1
+ Factory.define :comment do |p|
2
2
  p.body 'Body message'
3
3
  p.id '335287'
4
4
  p.created_at '2010/07/30 13:50:42'
5
5
  p.updated_at '2010/07/30 13:50:42'
6
6
  p.user 'juanespinosa'
7
- end
7
+ end
@@ -1,4 +1,4 @@
1
- Factory.define :issue, :class => Octopi::Issue do |p|
1
+ Factory.define :issue do |p|
2
2
  p.repository 'test-juange'
3
3
  p.user 'juanespinosa'
4
4
  p.updated_at ''
@@ -10,4 +10,4 @@ Factory.define :issue, :class => Octopi::Issue do |p|
10
10
  p.labels ''
11
11
  p.state 'open'
12
12
  p.created_at ''
13
- end
13
+ end
@@ -1,4 +1,4 @@
1
- Factory.define :repository, :class => Octopi::Repository do |p|
1
+ Factory.define :repository do |p|
2
2
  p.description ''
3
3
  p.url ''
4
4
  p.forks ''
@@ -19,4 +19,4 @@ Factory.define :repository, :class => Octopi::Repository do |p|
19
19
  p.id ''
20
20
  p.pushed ''
21
21
  p.created ''
22
- end
22
+ end
data/spec/project_spec.rb CHANGED
@@ -3,54 +3,42 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "Ticketmaster::Provider::Github::Project" do
4
4
 
5
5
  before(:all) do
6
- @repo_name = "test-juange"
6
+ @repo_name = "jquery-mobile"
7
7
  @klass = TicketMaster::Provider::Github::Project
8
8
  end
9
9
 
10
10
  before(:each) do
11
- @repository = Factory.build(:repository)
12
- @repositories = [@repository]
13
- @github = TicketMaster.new(:github, {:login => 'juanespinosa', :token => 'asdfghk'})
11
+ @github = TicketMaster.new(:github, {:login => 'jquery' })
14
12
  end
15
13
 
16
14
  it "should be able to load all projects" do
17
- Octopi::Repository.stub!(:find).and_return(@repositories)
18
- projects = @github.projects
15
+ @github.projects.should be_an_instance_of(Array)
16
+ @github.projects.first.should be_an_instance_of(@klass)
17
+ end
18
+
19
+ it "should be able to load all projects based on an array of name(id)" do
20
+ projects = @github.projects([@repo_name])
19
21
  projects.should be_an_instance_of(Array)
20
22
  projects.first.should be_an_instance_of(@klass)
23
+ projects.first.id.should == @repo_name
21
24
  end
22
-
25
+
23
26
  it "should be able to find by name(id)" do
24
- Octopi::Repository.stub!(:find).and_return(@repository)
25
27
  p = @github.project(@repo_name)
26
28
  p.should be_an_instance_of(@klass)
27
29
  p.name.should be_eql(@repo_name)
28
30
  end
29
-
30
- it "should be able to find by name(id) with find method" do
31
- Octopi::Repository.stub!(:find).and_return(@repository)
31
+
32
+ it "should be able to find by name(id) with the find method" do
32
33
  p = @github.project.find(@repo_name)
33
34
  p.should be_an_instance_of(@klass)
34
35
  p.name.should be_eql(@repo_name)
35
36
  end
36
37
 
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)
38
+ it "should be able to find by attributes" do
39
+ projects = @github.projects(:name => @repo_name)
40
+ projects.should be_an_instance_of(Array)
41
+ projects.first.id.should be_eql(@repo_name)
54
42
  end
55
43
  end
56
44
 
data/spec/spec_helper.rb CHANGED
@@ -2,11 +2,11 @@ $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'
6
- require 'ticketmaster-github'
7
5
  require 'spec'
8
6
  require 'factory_girl'
7
+ require 'ticketmaster'
8
+ require 'ticketmaster-github'
9
9
 
10
10
  Dir["#{File.dirname(__FILE__)}/factories/*.rb"].each {|f| require f}
11
11
  Spec::Runner.configure do |config|
12
- end
12
+ end
data/spec/ticket_spec.rb CHANGED
@@ -1,65 +1,49 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "Ticketmaster::Provider::Github::Ticket" do
4
- before(:all) do
5
- @github = TicketMaster.new(:github, {:login => 'juanespinosa', :token => 'asdfghk'})
4
+ before(:each) do
5
+ @github = TicketMaster.new(:github, {:login => 'jquery'})
6
+ @project = @github.project('jquery-mobile')
7
+ @ticket_id = 1
8
+ @ticket = {:body => 'Creating a ticket from API', :title => 'Ticket for jquery', :number => 1}
6
9
  @klass = TicketMaster::Provider::Github::Ticket
7
- @api = Octopi::Issue
10
+ @api = Octokit::Client
8
11
  end
9
12
 
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)
13
+ it "should be able to load all tickets" do
14
+ @project.tickets.should be_an_instance_of(Array)
15
+ @project.tickets.first.should be_an_instance_of(@klass)
16
16
  end
17
17
 
18
- it "should be able to load all tickets" do
19
- @api.stub!(:find_all).and_return(@tickets)
20
- tickets = @project.tickets
18
+ it "should be able to load tickets from an array of ids" do
19
+ tickets = @project.tickets([@ticket_id])
21
20
  tickets.should be_an_instance_of(Array)
22
21
  tickets.first.should be_an_instance_of(@klass)
23
22
  end
24
23
 
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)
24
+ it "should be able to find tickets based on attributes" do
25
+ tickets = @project.tickets(:number => @ticket_id)
26
+ tickets.should be_an_instance_of(Array)
27
+ tickets.first.should be_an_instance_of(@klass)
37
28
  end
38
29
 
39
30
  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)
31
+ ticket = @project.ticket(@ticket_id)
32
+ ticket.should be_an_instance_of(@klass)
33
+ ticket.title.should be_eql('Move Ajax Test to Core')
48
34
  end
49
35
 
36
+ it "should be able to open a new ticket"
37
+
50
38
  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)
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)
59
44
  end
60
45
 
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
46
+ it "should be able to reopen a ticket"
47
+
48
+ it "should be able to close a ticket"
49
+ end
@@ -1,75 +1,71 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ticketmaster-github}
8
- s.version = "0.3.1"
8
+ s.version = "0.4.1"
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-02-28}
12
+ s.date = %q{2011-04-07}
13
13
  s.description = %q{This provides an interface with github through the ticketmaster gem.}
14
14
  s.email = %q{hong.quach@abigfisch.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.md"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.md",
24
- "Rakefile",
25
- "VERSION",
26
- "lib/github/github.rb",
27
- "lib/provider/comment.rb",
28
- "lib/provider/github.rb",
29
- "lib/provider/project.rb",
30
- "lib/provider/ticket.rb",
31
- "lib/ticketmaster-github.rb",
32
- "spec/comment_spec.rb",
33
- "spec/factories/comment.rb",
34
- "spec/factories/issue.rb",
35
- "spec/factories/repository.rb",
36
- "spec/project_spec.rb",
37
- "spec/spec.opts",
38
- "spec/spec_helper.rb",
39
- "spec/ticket_spec.rb",
40
- "spec/ticketmaster-github_spec.rb",
41
- "ticketmaster-github.gemspec"
21
+ "LICENSE",
22
+ "README.md",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/provider/comment.rb",
26
+ "lib/provider/github.rb",
27
+ "lib/provider/project.rb",
28
+ "lib/provider/ticket.rb",
29
+ "lib/ticketmaster-github.rb",
30
+ "spec/comment_spec.rb",
31
+ "spec/factories/comment.rb",
32
+ "spec/factories/issue.rb",
33
+ "spec/factories/repository.rb",
34
+ "spec/project_spec.rb",
35
+ "spec/spec.opts",
36
+ "spec/spec_helper.rb",
37
+ "spec/ticket_spec.rb",
38
+ "spec/ticketmaster-github_spec.rb",
39
+ "ticketmaster-github.gemspec"
42
40
  ]
43
41
  s.homepage = %q{http://github.com/kiafaldorius/ticketmaster-github}
44
- s.rdoc_options = ["--charset=UTF-8"]
45
42
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.3.7}
43
+ s.rubygems_version = %q{1.6.1}
47
44
  s.summary = %q{The github provider for ticketmaster}
48
45
  s.test_files = [
49
46
  "spec/comment_spec.rb",
50
- "spec/factories/comment.rb",
51
- "spec/factories/issue.rb",
52
- "spec/factories/repository.rb",
53
- "spec/project_spec.rb",
54
- "spec/spec_helper.rb",
55
- "spec/ticket_spec.rb",
56
- "spec/ticketmaster-github_spec.rb"
47
+ "spec/factories/comment.rb",
48
+ "spec/factories/issue.rb",
49
+ "spec/factories/repository.rb",
50
+ "spec/project_spec.rb",
51
+ "spec/spec_helper.rb",
52
+ "spec/ticket_spec.rb",
53
+ "spec/ticketmaster-github_spec.rb"
57
54
  ]
58
55
 
59
56
  if s.respond_to? :specification_version then
60
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
61
57
  s.specification_version = 3
62
58
 
63
59
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
64
60
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
65
- s.add_runtime_dependency(%q<octopi>, [">= 0.3.0"])
61
+ s.add_runtime_dependency(%q<octokit>, [">= 0"])
66
62
  else
67
63
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
68
- s.add_dependency(%q<octopi>, [">= 0.3.0"])
64
+ s.add_dependency(%q<octokit>, [">= 0"])
69
65
  end
70
66
  else
71
67
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
72
- s.add_dependency(%q<octopi>, [">= 0.3.0"])
68
+ s.add_dependency(%q<octokit>, [">= 0"])
73
69
  end
74
70
  end
75
71
 
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: 17
5
- prerelease: false
4
+ hash: 13
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 1
10
- version: 0.3.1
10
+ version: 0.4.1
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-02-28 00:00:00 -08:00
18
+ date: 2011-04-07 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -35,19 +35,17 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: octopi
38
+ name: octokit
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- hash: 19
45
+ hash: 3
46
46
  segments:
47
47
  - 0
48
- - 3
49
- - 0
50
- version: 0.3.0
48
+ version: "0"
51
49
  type: :runtime
52
50
  version_requirements: *id002
53
51
  description: This provides an interface with github through the ticketmaster gem.
@@ -61,12 +59,10 @@ extra_rdoc_files:
61
59
  - README.md
62
60
  files:
63
61
  - .document
64
- - .gitignore
65
62
  - LICENSE
66
63
  - README.md
67
64
  - Rakefile
68
65
  - VERSION
69
- - lib/github/github.rb
70
66
  - lib/provider/comment.rb
71
67
  - lib/provider/github.rb
72
68
  - lib/provider/project.rb
@@ -87,8 +83,8 @@ homepage: http://github.com/kiafaldorius/ticketmaster-github
87
83
  licenses: []
88
84
 
89
85
  post_install_message:
90
- rdoc_options:
91
- - --charset=UTF-8
86
+ rdoc_options: []
87
+
92
88
  require_paths:
93
89
  - lib
94
90
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -112,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
108
  requirements: []
113
109
 
114
110
  rubyforge_project:
115
- rubygems_version: 1.3.7
111
+ rubygems_version: 1.6.1
116
112
  signing_key:
117
113
  specification_version: 3
118
114
  summary: The github provider for ticketmaster
data/.gitignore DELETED
@@ -1,25 +0,0 @@
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/lib/github/github.rb DELETED
@@ -1,28 +0,0 @@
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