ticketmaster-bugherd 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -2
- data/Gemfile.lock +4 -2
- data/README.rdoc +26 -1
- data/VERSION +1 -1
- data/lib/provider/bugherd.rb +2 -6
- data/lib/provider/comment.rb +29 -1
- data/lib/provider/ticket.rb +0 -5
- data/lib/ticketmaster-bugherd.rb +2 -1
- data/spec/comments_spec.rb +45 -1
- data/spec/fixtures/comments.xml +9 -0
- data/spec/fixtures/comments/9760.xml +7 -0
- data/spec/projects_spec.rb +1 -1
- data/spec/ticketmaster-bugherd_spec.rb +21 -21
- data/spec/tickets_spec.rb +1 -1
- data/ticketmaster-bugherd.gemspec +7 -9
- metadata +18 -33
- data/lib/bugherd/bugherd-api.rb +0 -39
data/Gemfile
CHANGED
@@ -4,8 +4,7 @@ source "http://rubygems.org"
|
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
5
|
|
6
6
|
gem "ticketmaster", "~> 0.6.0"
|
7
|
-
gem "
|
8
|
-
gem "activeresource", "~> 3.0.0"
|
7
|
+
gem "bugherd-api", "~> 0.0.3"
|
9
8
|
# Add dependencies to develop your gem here.
|
10
9
|
# Include everything needed to run rake, tests, features, etc.
|
11
10
|
group :development do
|
data/Gemfile.lock
CHANGED
@@ -9,6 +9,9 @@ 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
|
12
15
|
builder (2.1.2)
|
13
16
|
diff-lcs (1.1.2)
|
14
17
|
git (1.2.5)
|
@@ -42,8 +45,7 @@ PLATFORMS
|
|
42
45
|
x86-mingw32
|
43
46
|
|
44
47
|
DEPENDENCIES
|
45
|
-
|
46
|
-
activesupport (~> 3.0.0)
|
48
|
+
bugherd-api (~> 0.0.3)
|
47
49
|
bundler (~> 1.0.0)
|
48
50
|
jeweler (~> 1.6.4)
|
49
51
|
rcov
|
data/README.rdoc
CHANGED
@@ -1,6 +1,31 @@
|
|
1
1
|
= ticketmaster-bugherd
|
2
2
|
|
3
|
-
|
3
|
+
This is a provider for ticketmaster[http://ticketrb.com]. It provides interoperability with Bugherd[http://www.bugherd.com] through the ticketmaster gem.
|
4
|
+
|
5
|
+
== Usage and Examples
|
6
|
+
|
7
|
+
first we have to instance a new ticketmaster instance:
|
8
|
+
bugherd = TicketMaster.new(:bugherd, :email => 'user@email.com', :password => 'password')
|
9
|
+
|
10
|
+
=== Retreiving all projects
|
11
|
+
bugherd.projects
|
12
|
+
|
13
|
+
=== Retrieving projects based on an array of id's
|
14
|
+
bugherd.projects([1,2,3])
|
15
|
+
|
16
|
+
=== Retrieving projects based on attributes
|
17
|
+
bugherd.projects(:id => 1)
|
18
|
+
|
19
|
+
=== Retrieving a single project
|
20
|
+
bugherd.project(1)
|
21
|
+
|
22
|
+
=== Retrieving all tickets
|
23
|
+
project = bugherd.project(1)
|
24
|
+
project.tickets
|
25
|
+
|
26
|
+
=== Retrieving tickets based on array of id's
|
27
|
+
project = bugherd.project(1)
|
28
|
+
project.tickets([1,2,3,4])
|
4
29
|
|
5
30
|
== Contributing to ticketmaster-bugherd
|
6
31
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/provider/bugherd.rb
CHANGED
@@ -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
|
-
|
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,11 +24,7 @@ module TicketMaster::Provider
|
|
24
24
|
|
25
25
|
# declare needed overloaded methods here
|
26
26
|
def valid?
|
27
|
-
|
28
|
-
!BugherdAPI::User.find(:first).nil?
|
29
|
-
rescue
|
30
|
-
false
|
31
|
-
end
|
27
|
+
BugherdAPI::User.find(:all)
|
32
28
|
end
|
33
29
|
|
34
30
|
end
|
data/lib/provider/comment.rb
CHANGED
@@ -6,9 +6,37 @@ module TicketMaster::Provider
|
|
6
6
|
# versions of the ticket.
|
7
7
|
#
|
8
8
|
class Comment < TicketMaster::Provider::Base::Comment
|
9
|
-
|
9
|
+
API = BugherdAPI::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
|
12
40
|
end
|
13
41
|
end
|
14
42
|
end
|
data/lib/provider/ticket.rb
CHANGED
data/lib/ticketmaster-bugherd.rb
CHANGED
data/spec/comments_spec.rb
CHANGED
@@ -1,7 +1,51 @@
|
|
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
|
4
21
|
|
5
|
-
it "should
|
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
|
6
26
|
|
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
|
+
end
|
7
51
|
end
|
@@ -0,0 +1,9 @@
|
|
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>
|
data/spec/projects_spec.rb
CHANGED
@@ -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'}
|
5
6
|
@tm = TicketMaster.new(:bugherd, :email => 'user@email.com',
|
6
7
|
:password => '0000')
|
7
8
|
@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
|
@@ -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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
9
11
|
end
|
10
|
-
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
it "should validate the ticketmaster instance" do
|
20
|
+
@tm.valid?.should be_true
|
21
|
+
end
|
20
22
|
end
|
21
|
-
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
27
28
|
|
28
|
-
|
29
|
-
|
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
|
30
32
|
end
|
31
33
|
end
|
32
|
-
|
33
|
-
|
34
34
|
end
|
data/spec/tickets_spec.rb
CHANGED
@@ -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 = {
|
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
|
@@ -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.
|
8
|
+
s.version = "0.0.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"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-29}
|
13
13
|
s.description = %q{Ticketmaster provider for Bugherd}
|
14
14
|
s.email = %q{george.rafael@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,7 +26,6 @@ Gem::Specification.new do |s|
|
|
26
26
|
"README.rdoc",
|
27
27
|
"Rakefile",
|
28
28
|
"VERSION",
|
29
|
-
"lib/bugherd/bugherd-api.rb",
|
30
29
|
"lib/provider/bugherd.rb",
|
31
30
|
"lib/provider/comment.rb",
|
32
31
|
"lib/provider/project.rb",
|
@@ -34,6 +33,8 @@ Gem::Specification.new do |s|
|
|
34
33
|
"lib/ticketmaster-bugherd.rb",
|
35
34
|
"request.xml",
|
36
35
|
"spec/comments_spec.rb",
|
36
|
+
"spec/fixtures/comments.xml",
|
37
|
+
"spec/fixtures/comments/9760.xml",
|
37
38
|
"spec/fixtures/projects.xml",
|
38
39
|
"spec/fixtures/projects/1458.xml",
|
39
40
|
"spec/fixtures/tasks.xml",
|
@@ -56,16 +57,14 @@ Gem::Specification.new do |s|
|
|
56
57
|
|
57
58
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
59
|
s.add_runtime_dependency(%q<ticketmaster>, ["~> 0.6.0"])
|
59
|
-
s.add_runtime_dependency(%q<
|
60
|
-
s.add_runtime_dependency(%q<activeresource>, ["~> 3.0.0"])
|
60
|
+
s.add_runtime_dependency(%q<bugherd-api>, ["~> 0.0.3"])
|
61
61
|
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
62
62
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
63
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
64
64
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
65
65
|
else
|
66
66
|
s.add_dependency(%q<ticketmaster>, ["~> 0.6.0"])
|
67
|
-
s.add_dependency(%q<
|
68
|
-
s.add_dependency(%q<activeresource>, ["~> 3.0.0"])
|
67
|
+
s.add_dependency(%q<bugherd-api>, ["~> 0.0.3"])
|
69
68
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
70
69
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
71
70
|
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
@@ -73,8 +72,7 @@ Gem::Specification.new do |s|
|
|
73
72
|
end
|
74
73
|
else
|
75
74
|
s.add_dependency(%q<ticketmaster>, ["~> 0.6.0"])
|
76
|
-
s.add_dependency(%q<
|
77
|
-
s.add_dependency(%q<activeresource>, ["~> 3.0.0"])
|
75
|
+
s.add_dependency(%q<bugherd-api>, ["~> 0.0.3"])
|
78
76
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
79
77
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
80
78
|
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:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.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-08-
|
18
|
+
date: 2011-08-29 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -41,34 +41,18 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
44
|
+
hash: 25
|
45
45
|
segments:
|
46
|
-
- 3
|
47
46
|
- 0
|
48
47
|
- 0
|
49
|
-
version: 3.0.0
|
50
|
-
version_requirements: *id002
|
51
|
-
name: activesupport
|
52
|
-
prerelease: false
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
type: :runtime
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
|
-
requirements:
|
58
|
-
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 7
|
61
|
-
segments:
|
62
48
|
- 3
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
version_requirements: *id003
|
67
|
-
name: activeresource
|
49
|
+
version: 0.0.3
|
50
|
+
version_requirements: *id002
|
51
|
+
name: bugherd-api
|
68
52
|
prerelease: false
|
69
53
|
- !ruby/object:Gem::Dependency
|
70
54
|
type: :development
|
71
|
-
requirement: &
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
72
56
|
none: false
|
73
57
|
requirements:
|
74
58
|
- - ~>
|
@@ -79,12 +63,12 @@ dependencies:
|
|
79
63
|
- 3
|
80
64
|
- 0
|
81
65
|
version: 2.3.0
|
82
|
-
version_requirements: *
|
66
|
+
version_requirements: *id003
|
83
67
|
name: rspec
|
84
68
|
prerelease: false
|
85
69
|
- !ruby/object:Gem::Dependency
|
86
70
|
type: :development
|
87
|
-
requirement: &
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
88
72
|
none: false
|
89
73
|
requirements:
|
90
74
|
- - ~>
|
@@ -95,12 +79,12 @@ dependencies:
|
|
95
79
|
- 0
|
96
80
|
- 0
|
97
81
|
version: 1.0.0
|
98
|
-
version_requirements: *
|
82
|
+
version_requirements: *id004
|
99
83
|
name: bundler
|
100
84
|
prerelease: false
|
101
85
|
- !ruby/object:Gem::Dependency
|
102
86
|
type: :development
|
103
|
-
requirement: &
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
104
88
|
none: false
|
105
89
|
requirements:
|
106
90
|
- - ~>
|
@@ -111,12 +95,12 @@ dependencies:
|
|
111
95
|
- 6
|
112
96
|
- 4
|
113
97
|
version: 1.6.4
|
114
|
-
version_requirements: *
|
98
|
+
version_requirements: *id005
|
115
99
|
name: jeweler
|
116
100
|
prerelease: false
|
117
101
|
- !ruby/object:Gem::Dependency
|
118
102
|
type: :development
|
119
|
-
requirement: &
|
103
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
120
104
|
none: false
|
121
105
|
requirements:
|
122
106
|
- - ">="
|
@@ -125,7 +109,7 @@ dependencies:
|
|
125
109
|
segments:
|
126
110
|
- 0
|
127
111
|
version: "0"
|
128
|
-
version_requirements: *
|
112
|
+
version_requirements: *id006
|
129
113
|
name: rcov
|
130
114
|
prerelease: false
|
131
115
|
description: Ticketmaster provider for Bugherd
|
@@ -147,7 +131,6 @@ files:
|
|
147
131
|
- README.rdoc
|
148
132
|
- Rakefile
|
149
133
|
- VERSION
|
150
|
-
- lib/bugherd/bugherd-api.rb
|
151
134
|
- lib/provider/bugherd.rb
|
152
135
|
- lib/provider/comment.rb
|
153
136
|
- lib/provider/project.rb
|
@@ -155,6 +138,8 @@ files:
|
|
155
138
|
- lib/ticketmaster-bugherd.rb
|
156
139
|
- request.xml
|
157
140
|
- spec/comments_spec.rb
|
141
|
+
- spec/fixtures/comments.xml
|
142
|
+
- spec/fixtures/comments/9760.xml
|
158
143
|
- spec/fixtures/projects.xml
|
159
144
|
- spec/fixtures/projects/1458.xml
|
160
145
|
- spec/fixtures/tasks.xml
|
data/lib/bugherd/bugherd-api.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'active_support'
|
3
|
-
require 'active_resource'
|
4
|
-
|
5
|
-
module BugherdAPI
|
6
|
-
class Error < StandardError; end
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def authenticate(email, password)
|
10
|
-
@email = email
|
11
|
-
@password = password
|
12
|
-
self::Base.user = email
|
13
|
-
self::Base.password = password
|
14
|
-
end
|
15
|
-
|
16
|
-
def resources
|
17
|
-
@resources ||= []
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class Base < ActiveResource::Base
|
22
|
-
self.format = :xml
|
23
|
-
self.site = 'http://www.bugherd.com/api_v1/'
|
24
|
-
def self.inherited(base)
|
25
|
-
BugherdAPI.resources << base
|
26
|
-
super
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class User < Base
|
31
|
-
end
|
32
|
-
|
33
|
-
class Project < Base
|
34
|
-
end
|
35
|
-
|
36
|
-
class Task < Base
|
37
|
-
self.site += 'projects/:project_id/'
|
38
|
-
end
|
39
|
-
end
|