ticketmaster-github 0.6.10 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.10
1
+ 0.7.0
@@ -12,7 +12,7 @@ module TicketMaster::Provider
12
12
  if object.first
13
13
  object = object.first
14
14
  unless object.is_a? Hash
15
- hash = {:id => object.id,
15
+ hash = {:id => object.number,
16
16
  :status => object.state,
17
17
  :description => object.body,
18
18
  :user => object.user,
@@ -82,7 +82,9 @@ module TicketMaster::Provider
82
82
  def self.open(project_id, *options)
83
83
  body = options.first.delete(:body)
84
84
  title = options.first.delete(:title)
85
- TicketMaster::Provider::Github.api.create_issue(project_id, title, body, options.first)
85
+ new_issue = TicketMaster::Provider::Github.api.create_issue(project_id, title, body, options.first)
86
+ new_issue.merge!(:project_id => project_id)
87
+ self.new new_issue
86
88
  end
87
89
 
88
90
  def created_at
@@ -102,9 +104,11 @@ module TicketMaster::Provider
102
104
  end
103
105
 
104
106
  def save
105
- t = Ticket.find_by_id(project_id, number)
106
- return false if t.title == title and t.body == body
107
- Ticket.new(project_id, TicketMaster::Provider::Github.api.update_issue(project_id, number, title, body))
107
+ issue = Ticket.find_by_id(project_id, number)
108
+ return false if issue.title == title and issue.body == body
109
+ ticket_update = TicketMaster::Provider::Github.api.update_issue(project_id, number, title, body)
110
+ ticket_update.merge!(:project_id => project_id)
111
+ Ticket.new ticket_update
108
112
  true
109
113
  end
110
114
 
@@ -1,27 +1,29 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "Ticketmaster::Provider::Github::Comment" do
4
-
4
+
5
5
  before(:each) do
6
6
  @github = TicketMaster.new(:github, {:login => 'ticketmaster-user', :password => 'Tm123456'})
7
7
  stub_get('https://ticketmaster-user:Tm123456@api.github.com/users/ticketmaster-user/repos', 'projects.json')
8
8
  stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues','issues.json')
9
9
  stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues?state=closed','closed_issues.json')
10
+ stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues/1/comments', 'comments.json')
11
+ stub_post('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues/1/comments', 'comments/3951282.json')
10
12
  @project = @github.projects.first
11
13
  @ticket = @project.tickets.first
12
14
  @klass = TicketMaster::Provider::Github::Comment
13
15
  @api = Octokit::Client
14
16
  end
15
-
17
+
16
18
  it "should be able to load all comments" do
17
- stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues/1/comments', 'comments.json')
18
19
  @comments = @ticket.comments
19
20
  @comments.should be_an_instance_of(Array)
20
21
  @comments.first.should be_an_instance_of(@klass)
21
22
  end
22
-
23
+
23
24
  it "should be able to create a new comment" do
24
- pending
25
+ comment = @ticket.comment!(:body => 'new comment')
26
+ comment.should be_an_instance_of(@klass)
25
27
  end
26
-
28
+
27
29
  end
@@ -0,0 +1,14 @@
1
+ {
2
+ "url": "https://api.github.com/repos/ticketmaster-user/tmtest-repo/issues/comments/3951282",
3
+ "created_at": "2012-02-13T22:49:55Z",
4
+ "body": "for testing",
5
+ "updated_at": "2012-02-13T22:49:55Z",
6
+ "id": 3951282,
7
+ "user": {
8
+ "url": "https://api.github.com/users/ticketmaster-user",
9
+ "gravatar_id": "42bd18419413dfbd6e7ec4fefdec94ae",
10
+ "login": "ticketmaster-user",
11
+ "avatar_url": "https://secure.gravatar.com/avatar/42bd18419413dfbd6e7ec4fefdec94ae?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
12
+ "id": 1434902
13
+ }
14
+ }
@@ -0,0 +1 @@
1
+ {"issue":{"comments":1,"position":1.0,"number":1,"state":"open","updated_at":"2012/02/13 14:49:55 -0800","labels":[],"user":"ticketmaster-user","body":"","title":"for testing","html_url":"https://github.com/ticketmaster-user/tmtest-repo/issues/1","created_at":"2012/02/13 14:45:27 -0800","votes":0,"gravatar_id":"42bd18419413dfbd6e7ec4fefdec94ae"}}
@@ -3,22 +3,26 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "Ticketmaster::Provider::Github::Ticket" do
4
4
  before(:each) do
5
5
  @github = TicketMaster.new(:github, {:login => 'ticketmaster-user', :password => 'Tm123456'})
6
- stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo', 'project.json')
7
6
  @project = @github.project('tmtest-repo')
8
7
  @ticket_id = 1
9
8
  @klass = TicketMaster::Provider::Github::Ticket
10
- end
11
9
 
12
- it "should be able to load all tickets" do
10
+ # mocking requests
11
+ stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo', 'project.json')
13
12
  stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues', 'issues.json')
14
13
  stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues?state=closed', 'closed_issues.json')
14
+ stub_get('https://ticketmaster-user:Tm123456@github.com/api/v2/json/issues/show/ticketmaster-user/tmtest-repo/1', 'issues/1.json')
15
+ stub_post('https://ticketmaster-user:Tm123456@github.com/api/v2/json/issues/edit/ticketmaster-user/tmtest-repo/1', 'issues/1.json')
16
+ stub_post('https://ticketmaster-user:Tm123456@github.com/api/v2/json/issues/open/ticketmaster-user/tmtest-repo', 'issues/new_ticket.json')
17
+ end
18
+
19
+ it "should be able to load all tickets" do
15
20
  @tickets = @project.tickets
16
21
  @tickets.should be_an_instance_of(Array)
17
22
  @tickets.first.should be_an_instance_of(@klass)
18
23
  end
19
24
 
20
25
  it "should be able to load tickets from an array of ids" do
21
- stub_get('https://ticketmaster-user:Tm123456@github.com/api/v2/json/issues/show/ticketmaster-user/tmtest-repo/1', 'issues/1.json')
22
26
  @tickets = @project.tickets([@ticket_id])
23
27
  @tickets.should be_an_instance_of(Array)
24
28
  @tickets.first.should be_an_instance_of(@klass)
@@ -30,14 +34,22 @@ describe "Ticketmaster::Provider::Github::Ticket" do
30
34
  @tickets.first.should be_an_instance_of(@klass)
31
35
  end
32
36
 
33
- it "should retrieve tickets from a private repo" do
34
-
35
- end
36
-
37
37
  it "should find a ticket by id(number)" do
38
38
  @ticket = @project.ticket(@ticket_id)
39
39
  @ticket.should be_an_instance_of(@klass)
40
40
  @ticket.title.should be_eql('for testing')
41
41
  end
42
42
 
43
+ it "should update a ticket" do
44
+ @ticket = @project.ticket(@ticket_id)
45
+ @ticket.save.should be_false
46
+ @ticket.title = "Testing"
47
+ @ticket.save.should be_true
48
+ end
49
+
50
+ it "should create a ticket" do
51
+ ticket = @project.ticket!(:title => 'new ticket', :body => 'testing')
52
+ ticket.should be_an_instance_of(@klass)
53
+ end
54
+
43
55
  end
@@ -11,13 +11,6 @@ describe "Ticketmaster::Provider::Github" do
11
11
  @github.should be_a_kind_of(TicketMaster::Provider::Github)
12
12
  end
13
13
 
14
- it "should show attempted authenticated if a token is present" do
15
- pending
16
- @github = TicketMaster.new(:github, {:login => 'juanespinosa', :token => 'asdfghk'})
17
- @github.authorize
18
- TicketMaster::Provider::Github.api.authenticated?.should be_true
19
- end
20
-
21
14
  context 'when calling #valid?' do
22
15
  it 'should test #total_private_repos number' do
23
16
  user = mock 'user'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ticketmaster-github"
8
- s.version = "0.6.10"
8
+ s.version = "0.7.0"
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 = "2012-03-06"
12
+ s.date = "2012-03-07"
13
13
  s.description = "This provides an interface with github through the ticketmaster gem."
14
14
  s.email = "hong.quach@abigfisch.com"
15
15
  s.extra_rdoc_files = [
@@ -36,8 +36,10 @@ Gem::Specification.new do |s|
36
36
  "spec/comment_spec.rb",
37
37
  "spec/fixtures/closed_issues.json",
38
38
  "spec/fixtures/comments.json",
39
+ "spec/fixtures/comments/3951282.json",
39
40
  "spec/fixtures/issues.json",
40
41
  "spec/fixtures/issues/1.json",
42
+ "spec/fixtures/issues/new_ticket.json",
41
43
  "spec/fixtures/project.json",
42
44
  "spec/fixtures/projects.json",
43
45
  "spec/fixtures/repositories.json",
@@ -50,7 +52,7 @@ Gem::Specification.new do |s|
50
52
  ]
51
53
  s.homepage = "http://github.com/kiafaldorius/ticketmaster-github"
52
54
  s.require_paths = ["lib"]
53
- s.rubygems_version = "1.8.15"
55
+ s.rubygems_version = "1.8.17"
54
56
  s.summary = "The github provider for ticketmaster"
55
57
 
56
58
  if s.respond_to? :specification_version then
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: 19
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
9
- - 10
10
- version: 0.6.10
8
+ - 7
9
+ - 0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - HybridGroup
@@ -15,9 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-06 00:00:00 Z
18
+ date: 2012-03-07 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ name: ticketmaster
22
+ prerelease: false
23
+ type: :runtime
21
24
  requirement: &id001 !ruby/object:Gem::Requirement
22
25
  none: false
23
26
  requirements:
@@ -30,10 +33,10 @@ dependencies:
30
33
  - 7
31
34
  version: 0.6.7
32
35
  version_requirements: *id001
33
- name: ticketmaster
36
+ - !ruby/object:Gem::Dependency
37
+ name: octokit
34
38
  prerelease: false
35
39
  type: :runtime
36
- - !ruby/object:Gem::Dependency
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
38
41
  none: false
39
42
  requirements:
@@ -46,10 +49,10 @@ dependencies:
46
49
  - 5
47
50
  version: 0.6.5
48
51
  version_requirements: *id002
49
- name: octokit
52
+ - !ruby/object:Gem::Dependency
53
+ name: jeweler
50
54
  prerelease: false
51
55
  type: :runtime
52
- - !ruby/object:Gem::Dependency
53
56
  requirement: &id003 !ruby/object:Gem::Requirement
54
57
  none: false
55
58
  requirements:
@@ -62,10 +65,10 @@ dependencies:
62
65
  - 4
63
66
  version: 1.6.4
64
67
  version_requirements: *id003
65
- name: jeweler
66
- prerelease: false
67
- type: :runtime
68
68
  - !ruby/object:Gem::Dependency
69
+ name: rspec
70
+ prerelease: false
71
+ type: :development
69
72
  requirement: &id004 !ruby/object:Gem::Requirement
70
73
  none: false
71
74
  requirements:
@@ -78,10 +81,10 @@ dependencies:
78
81
  - 0
79
82
  version: 1.3.0
80
83
  version_requirements: *id004
81
- name: rspec
84
+ - !ruby/object:Gem::Dependency
85
+ name: fakeweb
82
86
  prerelease: false
83
87
  type: :development
84
- - !ruby/object:Gem::Dependency
85
88
  requirement: &id005 !ruby/object:Gem::Requirement
86
89
  none: false
87
90
  requirements:
@@ -94,9 +97,6 @@ dependencies:
94
97
  - 0
95
98
  version: 1.3.0
96
99
  version_requirements: *id005
97
- name: fakeweb
98
- prerelease: false
99
- type: :development
100
100
  description: This provides an interface with github through the ticketmaster gem.
101
101
  email: hong.quach@abigfisch.com
102
102
  executables: []
@@ -126,8 +126,10 @@ files:
126
126
  - spec/comment_spec.rb
127
127
  - spec/fixtures/closed_issues.json
128
128
  - spec/fixtures/comments.json
129
+ - spec/fixtures/comments/3951282.json
129
130
  - spec/fixtures/issues.json
130
131
  - spec/fixtures/issues/1.json
132
+ - spec/fixtures/issues/new_ticket.json
131
133
  - spec/fixtures/project.json
132
134
  - spec/fixtures/projects.json
133
135
  - spec/fixtures/repositories.json
@@ -166,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
168
  requirements: []
167
169
 
168
170
  rubyforge_project:
169
- rubygems_version: 1.8.15
171
+ rubygems_version: 1.8.17
170
172
  signing_key:
171
173
  specification_version: 3
172
174
  summary: The github provider for ticketmaster