ticketmaster-github 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/provider/comment.rb +41 -32
- data/lib/ticketmaster-github.rb +1 -0
- data/spec/comment_spec.rb +8 -0
- data/spec/fixtures/comments/3951282_update.json +14 -0
- data/ticketmaster-github.gemspec +3 -2
- metadata +22 -21
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
data/lib/provider/comment.rb
CHANGED
@@ -22,61 +22,70 @@ module TicketMaster::Provider
|
|
22
22
|
super hash
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def author
|
27
27
|
self.user.login
|
28
28
|
end
|
29
29
|
|
30
30
|
def created_at
|
31
31
|
@created_at ||= begin
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
Time.parse(self[:created_at])
|
33
|
+
rescue
|
34
|
+
self[:created_at]
|
35
|
+
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
def updated_at
|
39
39
|
@updated_at ||= begin
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
Time.parse(self[:updated_at])
|
41
|
+
rescue
|
42
|
+
self[:updated_at]
|
43
|
+
end
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
# declare needed overloaded methods here
|
47
|
-
|
48
|
-
def self.find_by_attributes(project_id, ticket_id, attributes = {})
|
49
|
-
search_by_attribute(self.find_all(project_id, ticket_id), attributes)
|
50
|
-
end
|
51
47
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
48
|
+
def self.find_by_attributes(project_id, ticket_id, attributes = {})
|
49
|
+
search_by_attribute(self.find_all(project_id, ticket_id), attributes)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.find_all(project_id, ticket_id)
|
53
|
+
TicketMaster::Provider::Github.api.issue_comments(project_id, ticket_id).collect do |comment|
|
54
|
+
comment.merge!(:project_id => project_id, :ticket_id => ticket_id)
|
55
|
+
clean_body! comment
|
56
|
+
self.new comment
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.create(project_id, ticket_id, comment)
|
61
|
+
github_comment = TicketMaster::Provider::Github.api.add_comment(project_id, ticket_id, comment)
|
62
|
+
github_comment.merge!(:project_id => project_id, :ticket_id => ticket_id)
|
63
|
+
flat_body github_comment
|
64
|
+
self.new github_comment
|
65
|
+
end
|
59
66
|
|
60
|
-
def self.create(project_id, ticket_id, comment)
|
61
|
-
github_comment = TicketMaster::Provider::Github.api.add_comment(project_id, ticket_id, comment)
|
62
|
-
github_comment.merge!(:project_id => project_id, :ticket_id => ticket_id)
|
63
|
-
flat_body github_comment
|
64
|
-
self.new github_comment
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
67
|
#See https://www.kanbanpad.com/projects/31edb8d134e7967c1f0d#!xt-4f994d17014289000707433f
|
70
68
|
def self.flat_body(comment_hashie)
|
71
69
|
comment_hashie.body = comment_hashie.body.body
|
72
70
|
comment_hashie
|
73
71
|
end
|
74
|
-
|
72
|
+
|
75
73
|
# See https://www.kanbanpad.com/projects/31edb8d134e7967c1f0d#!xt-4f994f2101428900070759fd
|
76
74
|
def self.clean_body!(comment)
|
77
75
|
comment.body = comment.body.sub(/\A---\s\sbody:\s/, '').gsub(/\s\z/, '')
|
78
76
|
end
|
79
77
|
|
78
|
+
def save
|
79
|
+
update_comment(project_id, id, body)
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
def update_comment(repo, number, comment, options = {})
|
84
|
+
TicketMaster::Provider::Github.api.update_comment repo, number, comment, options
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
88
|
+
|
80
89
|
end
|
81
90
|
end
|
82
91
|
end
|
data/lib/ticketmaster-github.rb
CHANGED
data/spec/comment_spec.rb
CHANGED
@@ -9,6 +9,7 @@ describe "Ticketmaster::Provider::Github::Comment" do
|
|
9
9
|
stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues?state=closed','closed_issues.json')
|
10
10
|
stub_get('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues/1/comments', 'comments.json')
|
11
11
|
stub_post('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues/1/comments', 'comments/3951282.json')
|
12
|
+
stub_post('https://ticketmaster-user:Tm123456@api.github.com/repos/ticketmaster-user/tmtest-repo/issues/comments/3951282', 'comments/3951282_update.json')
|
12
13
|
@project = @github.projects.first
|
13
14
|
@ticket = @project.tickets.first
|
14
15
|
@klass = TicketMaster::Provider::Github::Comment
|
@@ -32,4 +33,11 @@ describe "Ticketmaster::Provider::Github::Comment" do
|
|
32
33
|
it "should be able to load a ticket and clean comment body" do
|
33
34
|
comments = @ticket.comments.map(&:body).should == ["for testing", "test comment"]
|
34
35
|
end
|
36
|
+
|
37
|
+
it "should be able to update comments" do
|
38
|
+
comment = @ticket.comments.first
|
39
|
+
comment.body = "updated comment"
|
40
|
+
comment.save.should be_true
|
41
|
+
end
|
42
|
+
|
35
43
|
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
|
+
}
|
data/ticketmaster-github.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ticketmaster-github"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.9.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"]
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"spec/fixtures/closed_issues.json",
|
38
38
|
"spec/fixtures/comments.json",
|
39
39
|
"spec/fixtures/comments/3951282.json",
|
40
|
+
"spec/fixtures/comments/3951282_update.json",
|
40
41
|
"spec/fixtures/issues.json",
|
41
42
|
"spec/fixtures/issues/1.json",
|
42
43
|
"spec/fixtures/issues/new_ticket.json",
|
@@ -52,7 +53,7 @@ Gem::Specification.new do |s|
|
|
52
53
|
]
|
53
54
|
s.homepage = "http://github.com/kiafaldorius/ticketmaster-github"
|
54
55
|
s.require_paths = ["lib"]
|
55
|
-
s.rubygems_version = "1.8.
|
56
|
+
s.rubygems_version = "1.8.15"
|
56
57
|
s.summary = "The github provider for ticketmaster"
|
57
58
|
|
58
59
|
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:
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 9
|
9
|
+
- 0
|
10
|
+
version: 0.9.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- HybridGroup
|
@@ -18,9 +18,6 @@ cert_chain: []
|
|
18
18
|
date: 2012-05-01 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: ticketmaster
|
22
|
-
prerelease: false
|
23
|
-
type: :runtime
|
24
21
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
22
|
none: false
|
26
23
|
requirements:
|
@@ -33,10 +30,10 @@ dependencies:
|
|
33
30
|
- 0
|
34
31
|
version: 0.7.0
|
35
32
|
version_requirements: *id001
|
36
|
-
|
37
|
-
name: octokit
|
33
|
+
name: ticketmaster
|
38
34
|
prerelease: false
|
39
35
|
type: :runtime
|
36
|
+
- !ruby/object:Gem::Dependency
|
40
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
38
|
none: false
|
42
39
|
requirements:
|
@@ -48,10 +45,10 @@ dependencies:
|
|
48
45
|
- 6
|
49
46
|
version: "0.6"
|
50
47
|
version_requirements: *id002
|
51
|
-
|
52
|
-
name: jeweler
|
48
|
+
name: octokit
|
53
49
|
prerelease: false
|
54
|
-
type: :
|
50
|
+
type: :runtime
|
51
|
+
- !ruby/object:Gem::Dependency
|
55
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
53
|
none: false
|
57
54
|
requirements:
|
@@ -63,10 +60,10 @@ dependencies:
|
|
63
60
|
- 6
|
64
61
|
version: "1.6"
|
65
62
|
version_requirements: *id003
|
66
|
-
|
67
|
-
name: rspec
|
63
|
+
name: jeweler
|
68
64
|
prerelease: false
|
69
65
|
type: :development
|
66
|
+
- !ruby/object:Gem::Dependency
|
70
67
|
requirement: &id004 !ruby/object:Gem::Requirement
|
71
68
|
none: false
|
72
69
|
requirements:
|
@@ -78,10 +75,10 @@ dependencies:
|
|
78
75
|
- 3
|
79
76
|
version: "2.3"
|
80
77
|
version_requirements: *id004
|
81
|
-
|
82
|
-
name: fakeweb
|
78
|
+
name: rspec
|
83
79
|
prerelease: false
|
84
80
|
type: :development
|
81
|
+
- !ruby/object:Gem::Dependency
|
85
82
|
requirement: &id005 !ruby/object:Gem::Requirement
|
86
83
|
none: false
|
87
84
|
requirements:
|
@@ -93,10 +90,10 @@ dependencies:
|
|
93
90
|
- 3
|
94
91
|
version: "1.3"
|
95
92
|
version_requirements: *id005
|
96
|
-
|
97
|
-
name: simplecov
|
93
|
+
name: fakeweb
|
98
94
|
prerelease: false
|
99
95
|
type: :development
|
96
|
+
- !ruby/object:Gem::Dependency
|
100
97
|
requirement: &id006 !ruby/object:Gem::Requirement
|
101
98
|
none: false
|
102
99
|
requirements:
|
@@ -108,10 +105,10 @@ dependencies:
|
|
108
105
|
- 5
|
109
106
|
version: "0.5"
|
110
107
|
version_requirements: *id006
|
111
|
-
|
112
|
-
name: rcov
|
108
|
+
name: simplecov
|
113
109
|
prerelease: false
|
114
110
|
type: :development
|
111
|
+
- !ruby/object:Gem::Dependency
|
115
112
|
requirement: &id007 !ruby/object:Gem::Requirement
|
116
113
|
none: false
|
117
114
|
requirements:
|
@@ -123,6 +120,9 @@ dependencies:
|
|
123
120
|
- 0
|
124
121
|
version: "1.0"
|
125
122
|
version_requirements: *id007
|
123
|
+
name: rcov
|
124
|
+
prerelease: false
|
125
|
+
type: :development
|
126
126
|
description: This provides an interface with github through the ticketmaster gem.
|
127
127
|
email: hong.quach@abigfisch.com
|
128
128
|
executables: []
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- spec/fixtures/closed_issues.json
|
154
154
|
- spec/fixtures/comments.json
|
155
155
|
- spec/fixtures/comments/3951282.json
|
156
|
+
- spec/fixtures/comments/3951282_update.json
|
156
157
|
- spec/fixtures/issues.json
|
157
158
|
- spec/fixtures/issues/1.json
|
158
159
|
- spec/fixtures/issues/new_ticket.json
|
@@ -194,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
195
|
requirements: []
|
195
196
|
|
196
197
|
rubyforge_project:
|
197
|
-
rubygems_version: 1.8.
|
198
|
+
rubygems_version: 1.8.15
|
198
199
|
signing_key:
|
199
200
|
specification_version: 3
|
200
201
|
summary: The github provider for ticketmaster
|