taskmapper-basecamp 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
@@ -14,11 +14,11 @@ module TaskMapper::Provider
14
14
  object = object.first
15
15
  unless object.is_a? Hash
16
16
  hash = {:id => object.id,
17
- :body => object.body,
18
- :author => object.author_name,
19
- :created_at => object.created_at,
20
- :project_id => object.project_id,
21
- :ticket_id => object.ticket_id}
17
+ :body => object.body,
18
+ :author => object.author_name,
19
+ :created_at => object.created_at,
20
+ :project_id => object.project_id,
21
+ :ticket_id => object.ticket_id}
22
22
  else
23
23
  hash = object
24
24
  end
@@ -39,25 +39,25 @@ module TaskMapper::Provider
39
39
  comments = API.find(:all, :params => {:todo_item_id => ticket_id}).collect {|c| self.new(c.attributes.merge!(:project_id => project_id, :ticket_id => ticket_id)) }
40
40
  search_by_attribute(comments, options, limit)
41
41
  end
42
-
42
+
43
43
  def self.create(ticket_id, attributes)
44
44
  new_comment = API.new attributes.merge(:todo_item_id => ticket_id)
45
45
  new_comment.save
46
-
46
+
47
47
  reloaded_comment = find_bc_comment(ticket_id, new_comment.id)
48
48
  self.new reloaded_comment.attributes.merge!(:ticket_id => ticket_id)
49
49
  end
50
-
50
+
51
51
  def save
52
52
  bc_comment = self.class.find_bc_comment ticket_id, id
53
53
  bc_comment.body = self.body
54
54
  bc_comment.save
55
55
  end
56
-
56
+
57
57
  private
58
- def self.find_bc_comment(ticket_id, id)
59
- API.find id, :params => { :todo_item_id => ticket_id }
60
- end
58
+ def self.find_bc_comment(ticket_id, id)
59
+ API.find id, :params => { :todo_item_id => ticket_id }
60
+ end
61
61
  end
62
62
  end
63
63
  end
@@ -1,6 +1,32 @@
1
1
  require 'basecamp'
2
2
  require 'active_support/all'
3
3
 
4
+ module HTMLStripper
5
+ def remove_tags
6
+ self.empty? ? "" : self.gsub(/(<[^>]*>)|\n|\t/s) {""}
7
+ end
8
+ end
9
+
10
+ class Hash
11
+
12
+ class << self
13
+
14
+ alias_method :from_xml_original, :from_xml
15
+
16
+ def from_xml(xml)
17
+ scrubbed = scrub_attributes(xml)
18
+ from_xml_original(scrubbed)
19
+ end
20
+
21
+ def scrub_attributes(xml)
22
+ xml.gsub(/<comments type=\"array\" count=\"*\">/, "<stories type=\"array\">")
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+
4
30
  %w{ basecamp ticket project comment }.each do |f|
5
31
  require File.dirname(__FILE__) + '/provider/' + f + '.rb';
6
32
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe HTMLStripper do
4
+
5
+ context "Blank string" do
6
+ subject { "".extend(HTMLStripper) }
7
+ its(:remove_tags) { should == "" }
8
+ end
9
+
10
+ context "With simple tags" do
11
+ subject { "<div>hello world</div>".extend(HTMLStripper) }
12
+ its(:remove_tags) { should == "hello world" }
13
+ end
14
+
15
+ end
data/spec/tickets_spec.rb CHANGED
@@ -20,15 +20,13 @@ describe TaskMapper::Provider::Basecamp::Ticket do
20
20
  end
21
21
  end
22
22
 
23
- shared_examples_for "ticket 133184178" do
24
- its(:title) { should match /updated/ }
23
+ shared_examples_for "ticket 19700819" do
24
+ its(:id) { should == 19700819 }
25
25
  its(:priority) { should == 1 }
26
- its(:status) { should == 'incomplete' }
27
- its(:resolution) { should == 'In Progress' }
26
+ its(:status) { should == "incomplete" }
27
+ its(:resolution) { should == "In Progress" }
28
28
  its(:updated_at) { should be_an_instance_of Time }
29
- its(:description) { should match /updated/ }
30
- its(:assignee) { should == 'Unassigned' }
31
- its(:requestor) { should match /Clutch/ }
29
+ its(:assignee) { should == "Unassigned" }
32
30
  its(:project_id) { should == 5220065 }
33
31
  end
34
32
 
@@ -40,23 +38,25 @@ describe TaskMapper::Provider::Basecamp::Ticket do
40
38
 
41
39
  describe :first do
42
40
  subject { tickets.first }
43
- its(:id) { should == 19700819 }
41
+ it_should_behave_like "ticket 19700819"
44
42
  end
45
43
  end
46
44
 
47
- pending "Search passing ids array'" do
48
- let(:tickets) { project.tickets [133184178, 19700382] }
45
+ describe "Search passing ids array'" do
46
+ let(:tickets) { project.tickets [19700819, 19700382] }
49
47
  subject { tickets }
50
48
 
51
49
  its(:count) { should == 2 }
52
50
 
53
51
  describe :first do
54
52
  subject { tickets.first }
53
+ it_should_behave_like "ticket 19700819"
55
54
  end
56
55
  end
57
56
 
58
57
  describe "Find by id" do
59
- subject { project.ticket 133184178 }
58
+ subject { project.ticket 19700819 }
59
+ it_should_behave_like "ticket 19700819"
60
60
  end
61
61
  end
62
62
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "taskmapper-basecamp"
8
- s.version = "0.7.0"
8
+ s.version = "0.7.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 = "2013-01-09"
12
+ s.date = "2013-01-10"
13
13
  s.description = "This gem provides an interface to basecamp through the taskmapper gem"
14
14
  s.email = "hong.quach@abigfisch.com"
15
15
  s.extra_rdoc_files = [
@@ -62,6 +62,7 @@ Gem::Specification.new do |s|
62
62
  "spec/projects_spec.rb",
63
63
  "spec/spec.opts",
64
64
  "spec/spec_helper.rb",
65
+ "spec/string_strip_html_spec.rb",
65
66
  "spec/taskmapper-basecamp_spec.rb",
66
67
  "spec/tickets_spec.rb",
67
68
  "taskmapper-basecamp.gemspec",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskmapper-basecamp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-09 00:00:00.000000000 Z
12
+ date: 2013-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: taskmapper
@@ -224,6 +224,7 @@ files:
224
224
  - spec/projects_spec.rb
225
225
  - spec/spec.opts
226
226
  - spec/spec_helper.rb
227
+ - spec/string_strip_html_spec.rb
227
228
  - spec/taskmapper-basecamp_spec.rb
228
229
  - spec/tickets_spec.rb
229
230
  - taskmapper-basecamp.gemspec
@@ -242,7 +243,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
243
  version: '0'
243
244
  segments:
244
245
  - 0
245
- hash: 2426728134394223182
246
+ hash: 3432716451324672874
246
247
  required_rubygems_version: !ruby/object:Gem::Requirement
247
248
  none: false
248
249
  requirements: