ticketmaster-bugherd 0.0.5 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,7 +4,8 @@ source "http://rubygems.org"
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
6
  gem "ticketmaster", "~> 0.6.0"
7
- gem "bugherd-api", "~> 0.0.3"
7
+ gem "activesupport", "~> 3.0.0"
8
+ gem "activeresource", "~> 3.0.0"
8
9
  # Add dependencies to develop your gem here.
9
10
  # Include everything needed to run rake, tests, features, etc.
10
11
  group :development do
@@ -9,9 +9,6 @@ GEM
9
9
  activemodel (= 3.0.9)
10
10
  activesupport (= 3.0.9)
11
11
  activesupport (3.0.9)
12
- bugherd-api (0.0.3)
13
- activeresource
14
- activesupport
15
12
  builder (2.1.2)
16
13
  diff-lcs (1.1.2)
17
14
  git (1.2.5)
@@ -45,7 +42,8 @@ PLATFORMS
45
42
  x86-mingw32
46
43
 
47
44
  DEPENDENCIES
48
- bugherd-api (~> 0.0.3)
45
+ activeresource (~> 3.0.0)
46
+ activesupport (~> 3.0.0)
49
47
  bundler (~> 1.0.0)
50
48
  jeweler (~> 1.6.4)
51
49
  rcov
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.1
@@ -2,7 +2,7 @@ module TicketMaster::Provider
2
2
  # This is the Bugherd Provider for ticketmaster
3
3
  module Bugherd
4
4
  include TicketMaster::Provider::Base
5
- TICKET_API = Bugherd::Ticket # The class to access the api's tickets
5
+ #TICKET_API = Bugherd::Ticket # The class to access the api's tickets
6
6
  PROJECT_API = BugherdAPI::Project # The class to access the api's projects
7
7
 
8
8
  # This is for cases when you want to instantiate using TicketMaster::Provider::Bugherd.new(auth)
@@ -24,8 +24,8 @@ module TicketMaster::Provider
24
24
 
25
25
  # declare needed overloaded methods here
26
26
  def valid?
27
- begin
28
- !BugherdAPI::User.find(:all).nil?
27
+ begin
28
+ !BugherdAPI::User.find(:first).nil?
29
29
  rescue
30
30
  false
31
31
  end
@@ -6,37 +6,9 @@ module TicketMaster::Provider
6
6
  # versions of the ticket.
7
7
  #
8
8
  class Comment < TicketMaster::Provider::Base::Comment
9
- API = BugherdAPI::Comment # The class to access the api's comments
9
+ #API = Bugherd::Comment # The class to access the api's comments
10
10
  # declare needed overloaded methods here
11
11
 
12
- def author
13
- author = BugherdAPI::User.find(:all).select do |user|
14
- user.id == self[:user_id]
15
- end.first
16
- "#{author.name} #{author.surname}"
17
- end
18
-
19
- def ticket_id
20
- self.prefix_options[:task_id]
21
- end
22
-
23
- def project_id
24
- self.prefix_options[:project_id]
25
- end
26
-
27
- def body
28
- self[:text]
29
- end
30
-
31
- def self.search(project_id, ticket_id, options = {}, limit = 1000)
32
- API.find(:all, :params => {:project_id => project_id, :task_id => ticket_id}).collect do |comment|
33
- self.new comment
34
- end
35
- end
36
-
37
- def self.find_by_id(project_id, ticket_id, id)
38
- self.new API.find(id, :params => {:project_id => project_id, :task_id => ticket_id})
39
- end
40
12
  end
41
13
  end
42
14
  end
@@ -14,7 +14,7 @@ module TicketMaster::Provider
14
14
  end
15
15
 
16
16
  def priority
17
- self[:priority_id].nil? ? "" : PRIORITY[self[:priority_id]]
17
+ PRIORITY[self[:priority_id]]
18
18
  end
19
19
 
20
20
  def assignee
@@ -34,6 +34,11 @@ module TicketMaster::Provider
34
34
  end
35
35
  end
36
36
 
37
+ def comments(*options)
38
+ warn "Bugherd API doesn't support comments"
39
+ []
40
+ end
41
+
37
42
  end
38
43
  end
39
44
  end
@@ -1,5 +1,4 @@
1
- require 'rubygems'
2
- require 'bugherd-api'
1
+ require 'lib/bugherd/bugherd-api'
3
2
 
4
3
  %w{ bugherd ticket project comment }.each do |f|
5
4
  require File.dirname(__FILE__) + '/provider/' + f + '.rb';
@@ -1,53 +1,7 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "TicketMaster::Provider::Bugherd::Comment" do
4
- before(:each) do
5
- @tm = TicketMaster.new(:bugherd, :email => 'user@email.com',
6
- :password => '0000')
7
- @klass = TicketMaster::Provider::Bugherd::Comment
8
- headers = {'Authorization' => 'Basic dXNlckBlbWFpbC5jb206MDAwMA==', 'Accept' => 'application/xml'}
9
- ActiveResource::HttpMock.respond_to do |mock|
10
- mock.get '/api_v1/projects/1458.xml', headers, fixture_for('projects/1458', 'xml'), 200
11
- mock.get '/api_v1/projects/1458/tasks/4950.xml', headers, fixture_for('tasks/4950', 'xml'), 200
12
- mock.get '/api_v1/projects/1458/tasks/4950/comments.xml', headers, fixture_for('comments', 'xml'), 200
13
- mock.get '/api_v1/projects/1458/tasks/4950/comments/9760.xml', headers, fixture_for('comments/9760', 'xml'), 200
14
- mock.get '/api_v1/users.xml', headers, fixture_for('users', 'xml'), 200
15
- end
16
- @project_id = 1458
17
- @ticket_id = 4950
18
- @project = @tm.project(@project_id)
19
- @ticket = @project.ticket(@ticket_id)
20
- end
21
4
 
22
- it "should retrieve all comments" do
23
- @ticket.comments.should be_an_instance_of(Array)
24
- @ticket.comments.first.should be_an_instance_of(@klass)
25
- end
5
+ it "should create a comment"
26
6
 
27
- it "should retrieve all comments based on an array of id's" do
28
- comments = @ticket.comments([9760])
29
- comments.should be_an_instance_of(Array)
30
- comments.first.should be_an_instance_of(@klass)
31
- end
32
-
33
- it "should be able to retrieve a single comment based on id" do
34
- comment = @ticket.comment(9760)
35
- comment.should be_an_instance_of(@klass)
36
- end
37
-
38
- it "should be able to retrieve a single comment based on attributes" do
39
- comment = @ticket.comment(:id => 9760)
40
- comment.should be_an_instance_of(@klass)
41
- end
42
-
43
- it "should have all valid fields for a comment" do
44
- comment = @ticket.comment(9760)
45
- comment.author.should == 'Rafael George'
46
- comment.body.should == "I'm working on this already"
47
- comment.id.should == 9760
48
- comment.ticket_id.should == 4950
49
- comment.project_id.should == 1458
50
- comment.updated_at.should_not be_nil
51
- comment.created_at.should_not be_nil
52
- end
53
7
  end
@@ -3,8 +3,12 @@
3
3
  <id type="integer">1458</id>
4
4
  <name>clutchapptest</name>
5
5
  <devurl>http://clutchapptest.ticketmaster.com</devurl>
6
- <api-key>6f416a76-7ce1-463e-92d7-5f21f9b77dd9</api-key>
7
- <created-at type="datetime">2011-08-17T20:07:07Z</created-at>
8
- <updated-at type="datetime">2011-08-18T19:56:58Z</updated-at>
9
- <is-active type="boolean">true</is-active>
6
+ <users type="array">
7
+ <user>
8
+ <id type="integer">1798</id>
9
+ <email>george.rafael@gmail.com</email>
10
+ <name>Rafael</name>
11
+ <surname>George</surname>
12
+ </user>
13
+ </users>
10
14
  </project>
@@ -3,8 +3,14 @@
3
3
  <id type="integer">4950</id>
4
4
  <description>Now this one should be green not red</description>
5
5
  <status-id type="integer">2</status-id>
6
- <priority-id type="integer" nil="true"></priority-id>
6
+ <priority-id type="integer" nil="true">1</priority-id>
7
7
  <assigned-to-id type="integer">1798</assigned-to-id>
8
- <created-at type="datetime">2011-08-18T19:57:35Z</created-at>
9
- <updated-at type="datetime">2011-08-18T19:57:40Z</updated-at>
8
+ <comments type="array">
9
+ <comment>
10
+ <id type="integer">9760</id>
11
+ <created-at type="datetime">2011-08-18T19:57:56Z</created-at>
12
+ <text>I'm working on this already</text>
13
+ <user-id type="integer">1798</user-id>
14
+ </comment>
15
+ </comments>
10
16
  </task>
@@ -2,10 +2,10 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "TicketMaster::Provider::Bugherd::Project" do
4
4
  before(:each) do
5
- headers = {'Authorization' => 'Basic dXNlckBlbWFpbC5jb206MDAwMA==', 'Accept' => 'application/xml'}
6
5
  @tm = TicketMaster.new(:bugherd, :email => 'user@email.com',
7
6
  :password => '0000')
8
7
  @klass = TicketMaster::Provider::Bugherd::Project
8
+ headers = {'Authorization' => 'Basic dXNlckBlbWFpbC5jb206MDAwMA==', 'Accept' => 'application/xml'}
9
9
  ActiveResource::HttpMock.respond_to do |mock|
10
10
  mock.get '/api_v1/projects.xml', headers, fixture_for('projects', 'xml'), 200
11
11
  mock.get '/api_v1/projects/1458.xml', headers, fixture_for('/projects/1458', 'xml'), 200
@@ -54,7 +54,5 @@ describe "TicketMaster::Provider::Bugherd::Project" do
54
54
  project = @tm.project(@project_id)
55
55
  project.id.should == 1458
56
56
  project.name.should == 'clutchapptest'
57
- project.created_at.should_not be_nil
58
- project.updated_at.should_not be_nil
59
57
  end
60
58
  end
@@ -2,33 +2,33 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "TicketmasterBugherd" do
4
4
  before(:each) do
5
- headers = {'Authorization' => 'Basic Z2VvcmdlLnJhZmFlbEBnbWFpbC5jb206MTIzNDU2', 'Accept' => 'application/xml'}
6
- ActiveResource::HttpMock.respond_to do |mock|
7
- @tm = TicketMaster.new(:bugherd, :email => 'george.rafael@gmail.com', :password => '123456')
8
- ActiveResource::HttpMock.respond_to do |mock|
9
- mock.get '/api_v1/users.xml', headers, fixture_for('users', 'xml'), 200
10
- end
5
+ @tm = TicketMaster.new(:bugherd, :email => 'user@bugherd.com', :password => '123456')
6
+ headers = {'Authorization' => 'Basic dXNlckBidWdoZXJkLmNvbToxMjM0NTY=', 'Accept' => 'application/xml'}
7
+ ActiveResource::HttpMock.respond_to do |mock|
8
+ mock.get '/api_v1/users.xml', headers, fixture_for('users', 'xml'), 200
11
9
  end
10
+ end
12
11
 
13
- context "Initialization and validation" do
14
- it "should be able to initialize a ticketmaster object" do
15
- @tm.should be_an_instance_of(TicketMaster)
16
- @tm.should be_a_kind_of(TicketMaster::Provider::Bugherd)
17
- end
12
+ context "Initialization and validation" do
13
+ it "should be able to initialize a ticketmaster object" do
14
+ @tm.should be_an_instance_of(TicketMaster)
15
+ @tm.should be_a_kind_of(TicketMaster::Provider::Bugherd)
16
+ end
18
17
 
19
- it "should validate the ticketmaster instance" do
20
- @tm.valid?.should be_true
21
- end
18
+ it "should validate the ticketmaster instance" do
19
+ @tm.valid?.should be_true
22
20
  end
21
+ end
23
22
 
24
- context "Raise exceptions" do
25
- it "should raise an exception without email or password" do
26
- lambda { @tm = TicketMaster.new(:bugherd, :email => '', :password => '') }.should raise_error
27
- end
23
+ context "Raise exceptions" do
24
+ it "should raise an exception without email or password" do
25
+ lambda { @tm = TicketMaster.new(:bugherd, :email => '', :password => '') }.should raise_error
26
+ end
28
27
 
29
- it "should raise an exception with an user message" do
30
- lambda { @tm = TicketMaster.new(:bugherd, :email => '', :password => '')}.should raise_error("You must provide email and password for authentication")
31
- end
28
+ it "should raise an exception with an user message" do
29
+ lambda { @tm = TicketMaster.new(:bugherd, :email => '', :password => '')}.should raise_error("You must provide email and password for authentication")
32
30
  end
33
31
  end
32
+
33
+
34
34
  end
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "TicketMaster::Provider::Bugherd::Ticket" do
4
4
 
5
5
  before(:each) do
6
- headers = {'Authorization' => 'Basic Z2VvcmdlLnJhZmFlbEBnbWFpbC5jb206MTIzNDU2', 'Accept' => 'application/xml'}
6
+ headers = { 'Authorization' => 'Basic Z2VvcmdlLnJhZmFlbEBnbWFpbC5jb206MTIzNDU2', 'Accept' => 'application/xml'}
7
7
  ActiveResource::HttpMock.respond_to do |mock|
8
8
  mock.get '/api_v1/projects/1458.xml', headers, fixture_for('/projects/1458', 'xml'), 200
9
9
  mock.get '/api_v1/projects/1458/tasks.xml', headers, fixture_for('tasks', 'xml'), 200
@@ -53,11 +53,11 @@ describe "TicketMaster::Provider::Bugherd::Ticket" do
53
53
  ticket = @project.ticket(4950)
54
54
  ticket.id.should == 4950
55
55
  ticket.status.should == 'active'
56
- ticket.priority.should == ''
56
+ ticket.priority.should == 'critical'
57
57
  ticket.title.should be_nil
58
58
  ticket.resolution.should be_nil
59
- ticket.created_at.should_not be_nil
60
- ticket.updated_at.should_not be_nil
59
+ ticket.created_at.should be_nil
60
+ ticket.updated_at.should be_nil
61
61
  ticket.description.should == 'Now this one should be green not red'
62
62
  ticket.assignee.should == 'Rafael George'
63
63
  ticket.requestor.should be_nil
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ticketmaster-bugherd}
8
- s.version = "0.0.5"
8
+ s.version = "0.1.1"
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"]
12
- s.date = %q{2011-09-01}
12
+ s.date = %q{2011-08-24}
13
13
  s.description = %q{Ticketmaster provider for Bugherd}
14
14
  s.email = %q{george.rafael@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -33,8 +33,6 @@ Gem::Specification.new do |s|
33
33
  "lib/ticketmaster-bugherd.rb",
34
34
  "request.xml",
35
35
  "spec/comments_spec.rb",
36
- "spec/fixtures/comments.xml",
37
- "spec/fixtures/comments/9760.xml",
38
36
  "spec/fixtures/projects.xml",
39
37
  "spec/fixtures/projects/1458.xml",
40
38
  "spec/fixtures/tasks.xml",
@@ -57,14 +55,14 @@ Gem::Specification.new do |s|
57
55
 
58
56
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
59
57
  s.add_runtime_dependency(%q<ticketmaster>, ["~> 0.6.0"])
60
- s.add_runtime_dependency(%q<bugherd-api>, ["~> 0.0.3"])
58
+ s.add_runtime_dependency(%q<bugherd-api>, ["~> 0.0.1"])
61
59
  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
62
60
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
63
61
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
64
62
  s.add_development_dependency(%q<rcov>, [">= 0"])
65
63
  else
66
64
  s.add_dependency(%q<ticketmaster>, ["~> 0.6.0"])
67
- s.add_dependency(%q<bugherd-api>, ["~> 0.0.3"])
65
+ s.add_dependency(%q<bugherd-api>, ["~> 0.0.1"])
68
66
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
69
67
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
70
68
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
@@ -72,7 +70,7 @@ Gem::Specification.new do |s|
72
70
  end
73
71
  else
74
72
  s.add_dependency(%q<ticketmaster>, ["~> 0.6.0"])
75
- s.add_dependency(%q<bugherd-api>, ["~> 0.0.3"])
73
+ s.add_dependency(%q<bugherd-api>, ["~> 0.0.1"])
76
74
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
77
75
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
78
76
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticketmaster-bugherd
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 0
9
- - 5
10
- version: 0.0.5
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
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-09-01 00:00:00 -04:00
18
+ date: 2011-08-24 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -41,12 +41,12 @@ dependencies:
41
41
  requirements:
42
42
  - - ~>
43
43
  - !ruby/object:Gem::Version
44
- hash: 25
44
+ hash: 29
45
45
  segments:
46
46
  - 0
47
47
  - 0
48
- - 3
49
- version: 0.0.3
48
+ - 1
49
+ version: 0.0.1
50
50
  version_requirements: *id002
51
51
  name: bugherd-api
52
52
  prerelease: false
@@ -138,8 +138,6 @@ files:
138
138
  - lib/ticketmaster-bugherd.rb
139
139
  - request.xml
140
140
  - spec/comments_spec.rb
141
- - spec/fixtures/comments.xml
142
- - spec/fixtures/comments/9760.xml
143
141
  - spec/fixtures/projects.xml
144
142
  - spec/fixtures/projects/1458.xml
145
143
  - spec/fixtures/tasks.xml
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <comments type="array">
3
- <comment>
4
- <id type="integer">9760</id>
5
- <created-at type="datetime">2011-08-18T19:57:56Z</created-at>
6
- <text>I'm working on this already</text>
7
- <user-id type="integer">1798</user-id>
8
- </comment>
9
- </comments>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <comment>
3
- <id type="integer">9760</id>
4
- <text>I'm working on this already</text>
5
- <user-id type="integer">1798</user-id>
6
- <created-at type="datetime">2011-08-18T19:57:56Z</created-at>
7
- <updated-at type="datetime">2011-08-18T19:57:56Z</updated-at>
8
- </comment>