ticketmaster-trac 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/trac/trac.rb CHANGED
@@ -35,22 +35,28 @@ class CommentUtil
35
35
  comment_id = 0
36
36
  @doc.css('h3.change a.timeline').collect do |value|
37
37
  body = @doc.css('div.comment p')
38
+ authors = @doc.css('h3.change')
38
39
  comment_id += 1
39
- build_comment_hash(value, comment_id, body[comment_id-1].text)
40
+ build_comment_hash(value, comment_id, body[comment_id-1].text, authors[comment_id-1].content)
40
41
  end
41
42
  end
42
43
 
43
44
  private
44
- def build_comment_hash(value, comment_id, body)
45
+ def build_comment_hash(value, comment_id, body, author)
45
46
  comment = {}
46
47
  comment[:created_at] = date_from_attributes(value)
47
48
  comment[:updated_at] = date_from_attributes(value)
48
49
  comment[:ticket_id] = @ticket_id
49
50
  comment[:body] = body
51
+ comment[:author] = normalize_author_field(author)
50
52
  comment[:id] = comment_id
51
53
  comment
52
54
  end
53
55
 
56
+ def normalize_author_field(author)
57
+ author.strip.split(/by/)[1]
58
+ end
59
+
54
60
  def date_from_attributes(value)
55
61
  value.attributes["title"].value.split(/\s/)[0]
56
62
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ticketmaster-trac}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rafael George"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticketmaster-trac
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rafael George
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-06 00:00:00 +00:00
18
+ date: 2011-01-06 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency