ticketmaster-pivotal 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
- gem "ticketmaster", "0.6.10"
6
+ gem "ticketmaster", "~> 0.7"
7
7
  # Add dependencies to develop your gem here.
8
8
  # Include everything needed to run rake, tests, features, etc.
9
9
  group :development do
@@ -1,13 +1,13 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activemodel (3.2.2)
5
- activesupport (= 3.2.2)
4
+ activemodel (3.2.3)
5
+ activesupport (= 3.2.3)
6
6
  builder (~> 3.0.0)
7
- activeresource (3.2.2)
8
- activemodel (= 3.2.2)
9
- activesupport (= 3.2.2)
10
- activesupport (3.2.2)
7
+ activeresource (3.2.3)
8
+ activemodel (= 3.2.3)
9
+ activesupport (= 3.2.3)
10
+ activesupport (3.2.3)
11
11
  i18n (~> 0.6)
12
12
  multi_json (~> 1.0)
13
13
  builder (3.0.0)
@@ -34,7 +34,7 @@ GEM
34
34
  multi_json (~> 1.0.3)
35
35
  simplecov-html (~> 0.5.3)
36
36
  simplecov-html (0.5.3)
37
- ticketmaster (0.6.10)
37
+ ticketmaster (0.7.0)
38
38
  activeresource (~> 3.0)
39
39
  activesupport (~> 3.0)
40
40
  hashie (~> 1.2)
@@ -48,4 +48,4 @@ DEPENDENCIES
48
48
  rcov (~> 1.0)
49
49
  rspec (~> 2.8)
50
50
  simplecov (~> 0.5)
51
- ticketmaster (= 0.6.10)
51
+ ticketmaster (~> 0.7)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.3
1
+ 0.7.0
@@ -35,15 +35,8 @@ module TicketMaster::Provider
35
35
  end
36
36
 
37
37
  def ticket!(*options)
38
- if options.first.is_a?(Hash)
39
- options[0].merge!(:project_id => id)
40
- title = options[0].delete('title') || options[0].delete(:title) || options[0].delete(:summary) || options[0].delete('summary')
41
- description = options[0].delete('body') || options[0].delete(:body)
42
- options[0][:name] = title
43
- options[0][:description] = description
44
- warn("Pivotal Tracker requires a title or name for the story") if options[0][:name].blank? and options[0]['name'].blank?
45
- end
46
- provider_parent(self.class)::Ticket.create(*options)
38
+ options.first.merge!(:project_id => self.id)
39
+ Ticket.create(options.first)
47
40
  end
48
41
 
49
42
  # copy from
@@ -18,16 +18,6 @@ module TicketMaster::Provider
18
18
  attr_accessor :prefix_options
19
19
  API = PivotalAPI::Story
20
20
 
21
- def self.find_by_attributes(project_id, attributes = {})
22
- date_to_search = attributes[:updated_at] || attributes[:created_at]
23
- tickets = []
24
- unless date_to_search.nil?
25
- tickets = search_by_datefields(project_id, date_to_search)
26
- else
27
- tickets += API.find(:all, :params => {:project_id => project_id, :filter => filter(attributes)}).map { |xticket| self.new xticket }
28
- end
29
- tickets.flatten
30
- end
31
21
 
32
22
  # The saver
33
23
  def save(*options)
@@ -58,8 +48,24 @@ module TicketMaster::Provider
58
48
  self.name=title
59
49
  end
60
50
 
51
+ def status
52
+ self.current_state
53
+ end
54
+
55
+ def priority
56
+ self.estimate
57
+ end
58
+
59
+ def resolution
60
+ self.current_state
61
+ end
62
+
63
+ def assignee
64
+ self.owned_by
65
+ end
66
+
61
67
  def comment!(*options)
62
- Comment.create(self.project_id, self.id, options.first)
68
+ Comment.create(self.project_id, self.id, options.first)
63
69
  end
64
70
  # The closer
65
71
  def close(resolution = 'resolved')
@@ -69,23 +75,50 @@ module TicketMaster::Provider
69
75
  ticket.save
70
76
  end
71
77
 
72
- private
73
- def self.search_by_datefields(project_id, date_to_search)
74
- date_to_search = date_to_search.strftime("%Y/%m/%d")
75
- tickets = []
76
- PivotalAPI::Activity.find(:all, :params => {:project_id => project_id, :occurred_since_date => date_to_search}).each do |activity|
77
- tickets = activity.stories.map { |xstory| self.new xstory }
78
+ class << self
79
+
80
+ def find_by_attributes(project_id, attributes = {})
81
+ date_to_search = attributes[:updated_at] || attributes[:created_at]
82
+ tickets = []
83
+ unless date_to_search.nil?
84
+ tickets = search_by_datefields(project_id, date_to_search)
85
+ else
86
+ tickets += API.find(:all, :params => {:project_id => project_id, :filter => filter(attributes)}).map { |xticket| self.new xticket }
87
+ end
88
+ tickets.flatten
78
89
  end
79
- tickets
80
- end
81
90
 
82
- def self.filter(attributes = {})
83
- filter = ""
84
- attributes.each_pair do |key, value|
85
- filter << "#{key}:#{value} "
91
+ def filter(attributes = {})
92
+ filter = ""
93
+ attributes.each_pair do |key, value|
94
+ filter << "#{key}:#{value} "
95
+ end
96
+ filter.strip!
97
+ end
98
+
99
+ def create(options)
100
+ super translate options, {:title => :name,
101
+ :requestor => :requested_by,
102
+ :status => :current_state,
103
+ :estimate => :priority,
104
+ :assignee => :owned_by}
105
+ end
106
+
107
+ private
108
+ def search_by_datefields(project_id, date_to_search)
109
+ date_to_search = date_to_search.strftime("%Y/%m/%d")
110
+ tickets = []
111
+ PivotalAPI::Activity.find(:all, :params => {:project_id => project_id, :occurred_since_date => date_to_search}).each do |activity|
112
+ tickets = activity.stories.map { |xstory| self.new xstory }
113
+ end
114
+ tickets
115
+ end
116
+
117
+ def translate(hash, mapping)
118
+ Hash[hash.map { |k, v| [mapping[k] ||= k, v]}]
86
119
  end
87
- filter.strip!
88
120
  end
89
121
  end
122
+
90
123
  end
91
124
  end
@@ -9,6 +9,7 @@
9
9
  <description>Hi hi. Description!</description>
10
10
  <name>Hello</name>
11
11
  <requested_by>Hong Quach</requested_by>
12
+ <owned_by>Hong Quach</owned_by>
12
13
  <created_at type="datetime">2010/06/26 22:31:08 UTC</created_at>
13
14
  <updated_at type="datetime">2010/06/26 22:56:02 UTC</updated_at>
14
15
  <notes type="array">
@@ -18,77 +18,97 @@ describe "Ticketmaster::Provider::Pivotal::Ticket" do
18
18
  @project_id = 93790
19
19
  @ticket_id = 4056827
20
20
  end
21
-
21
+
22
22
  before(:each) do
23
23
  @ticketmaster = TicketMaster.new(:pivotal, :token => '000000')
24
24
  @project = @ticketmaster.project(@project_id)
25
25
  @klass = TicketMaster::Provider::Pivotal::Ticket
26
26
  end
27
-
27
+
28
28
  it "should be able to load all tickets" do
29
29
  @project.tickets.should be_an_instance_of(Array)
30
30
  @project.tickets.first.should be_an_instance_of(@klass)
31
31
  end
32
-
32
+
33
33
  it "should be able to load all tickets based on an array of ids" do
34
34
  @tickets = @project.tickets([@ticket_id])
35
35
  @tickets.should be_an_instance_of(Array)
36
36
  @tickets.first.should be_an_instance_of(@klass)
37
37
  @tickets.first.id.should == @ticket_id
38
38
  end
39
-
39
+
40
40
  it "should be able to load all tickets based on attributes" do
41
41
  @tickets = @project.tickets(:id => @ticket_id)
42
42
  @tickets.should be_an_instance_of(Array)
43
43
  @tickets.first.should be_an_instance_of(@klass)
44
44
  @tickets.first.id.should == @ticket_id
45
45
  end
46
-
46
+
47
47
  it "should return the ticket class" do
48
48
  @project.ticket.should == @klass
49
49
  end
50
-
50
+
51
51
  it "should be able to load a single ticket" do
52
52
  @ticket = @project.ticket(@ticket_id)
53
53
  @ticket.should be_an_instance_of(@klass)
54
54
  @ticket.id.should == @ticket_id
55
55
  end
56
-
56
+
57
57
  it "should be able to load a single ticket based on attributes" do
58
58
  @ticket = @project.ticket(:id => @ticket_id)
59
59
  @ticket.should be_an_instance_of(@klass)
60
60
  @ticket.id.should == @ticket_id
61
61
  end
62
-
62
+
63
63
  it "should be able to update and save a ticket" do
64
64
  @ticket = @project.ticket(@ticket_id)
65
65
  #@ticket.save.should == nil
66
66
  @ticket.description = 'hello'
67
67
  @ticket.save.should == true
68
68
  end
69
-
69
+
70
70
  it "should be able to create a ticket" do
71
71
  @ticket = @project.ticket!(:title => 'Ticket #12', :description => 'Body')
72
72
  @ticket.should be_an_instance_of(@klass)
73
73
  end
74
74
 
75
- it "should be able to load all tickets based on attributes using updated_at field" do
75
+ it "should be able to load all tickets based on attributes using updated_at field" do
76
76
  @ticket = @project.ticket(@ticket_id)
77
77
  tickets = @project.tickets(:updated_at => @ticket.updated_at)
78
78
  tickets.should be_an_instance_of(Array)
79
79
  tickets.first.should be_an_instance_of(@klass)
80
80
  end
81
81
 
82
- it "shoule be able to load all tickets based on attributes using created_at field" do
82
+ it "shoule be able to load all tickets based on attributes using created_at field" do
83
83
  @ticket = @project.ticket(@ticket_id)
84
84
  tickets = @project.tickets(:created_at => @ticket.created_at)
85
85
  tickets.should be_an_instance_of(Array)
86
86
  tickets.first.should be_an_instance_of(@klass)
87
87
  end
88
88
 
89
- it "should return the requested_by field" do
89
+ it "should return the requested_by field" do
90
90
  @ticket = @project.ticket(@ticket_id)
91
91
  @ticket.requestor.should == 'Hong Quach'
92
92
  end
93
-
93
+
94
+ it "should be able to update a ticket" do
95
+ @ticket = @project.ticket(@ticket_id)
96
+ @ticket.title = "Hello World"
97
+ @ticket.save.should be_true
98
+ end
99
+
100
+ it "should have all contract fields for tickets" do
101
+ @ticket = @project.ticket(@ticket_id)
102
+ @ticket.title.should_not be_nil
103
+ @ticket.description.should_not be_nil
104
+ @ticket.status.should_not be_nil
105
+ @ticket.priority.should_not be_nil
106
+ @ticket.resolution.should_not be_nil
107
+ @ticket.created_at.should_not be_nil
108
+ @ticket.updated_at.should_not be_nil
109
+ @ticket.assignee.should_not be_nil
110
+ @ticket.requestor.should_not be_nil
111
+ @ticket.project_id.should_not be_nil
112
+ end
113
+
94
114
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ticketmaster-pivotal"
8
- s.version = "0.6.3"
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-27"
12
+ s.date = "2012-04-11"
13
13
  s.description = "This is a ticketmaster provider for interacting with Pivotal Tracker ."
14
14
  s.email = "hong.quach@abigfisch.com"
15
15
  s.extra_rdoc_files = [
@@ -55,14 +55,14 @@ Gem::Specification.new do |s|
55
55
  s.specification_version = 3
56
56
 
57
57
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
58
- s.add_runtime_dependency(%q<ticketmaster>, ["= 0.6.10"])
58
+ s.add_runtime_dependency(%q<ticketmaster>, ["~> 0.7"])
59
59
  s.add_development_dependency(%q<rspec>, ["~> 2.8"])
60
60
  s.add_development_dependency(%q<bundler>, ["~> 1.1"])
61
61
  s.add_development_dependency(%q<jeweler>, ["~> 1.6"])
62
62
  s.add_development_dependency(%q<simplecov>, ["~> 0.5"])
63
63
  s.add_development_dependency(%q<rcov>, ["~> 1.0"])
64
64
  else
65
- s.add_dependency(%q<ticketmaster>, ["= 0.6.10"])
65
+ s.add_dependency(%q<ticketmaster>, ["~> 0.7"])
66
66
  s.add_dependency(%q<rspec>, ["~> 2.8"])
67
67
  s.add_dependency(%q<bundler>, ["~> 1.1"])
68
68
  s.add_dependency(%q<jeweler>, ["~> 1.6"])
@@ -70,7 +70,7 @@ Gem::Specification.new do |s|
70
70
  s.add_dependency(%q<rcov>, ["~> 1.0"])
71
71
  end
72
72
  else
73
- s.add_dependency(%q<ticketmaster>, ["= 0.6.10"])
73
+ s.add_dependency(%q<ticketmaster>, ["~> 0.7"])
74
74
  s.add_dependency(%q<rspec>, ["~> 2.8"])
75
75
  s.add_dependency(%q<bundler>, ["~> 1.1"])
76
76
  s.add_dependency(%q<jeweler>, ["~> 1.6"])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticketmaster-pivotal
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
9
- - 3
10
- version: 0.6.3
8
+ - 7
9
+ - 0
10
+ version: 0.7.0
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: 2012-03-27 00:00:00 Z
18
+ date: 2012-04-11 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: ticketmaster
@@ -24,14 +24,13 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - "="
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 19
29
+ hash: 5
30
30
  segments:
31
31
  - 0
32
- - 6
33
- - 10
34
- version: 0.6.10
32
+ - 7
33
+ version: "0.7"
35
34
  version_requirements: *id001
36
35
  - !ruby/object:Gem::Dependency
37
36
  name: rspec