basecamper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.md +64 -0
- data/Rakefile +17 -0
- data/basecamper.gemspec +31 -0
- data/features/support/env.rb +37 -0
- data/lib/basecamper/connection.rb +25 -0
- data/lib/basecamper/resource.rb +64 -0
- data/lib/basecamper/resources/attachment.rb +7 -0
- data/lib/basecamper/resources/category.rb +7 -0
- data/lib/basecamper/resources/comment.rb +7 -0
- data/lib/basecamper/resources/company.rb +7 -0
- data/lib/basecamper/resources/message.rb +9 -0
- data/lib/basecamper/resources/milestone.rb +15 -0
- data/lib/basecamper/resources/person.rb +13 -0
- data/lib/basecamper/resources/project.rb +7 -0
- data/lib/basecamper/resources/time_entry.rb +7 -0
- data/lib/basecamper/resources/todo_item.rb +8 -0
- data/lib/basecamper/resources/todo_list.rb +8 -0
- data/lib/basecamper/version.rb +3 -0
- data/lib/basecamper.rb +30 -0
- data/spec/basecamper/connection_spec.rb +152 -0
- data/spec/basecamper/resource_spec.rb +118 -0
- data/spec/basecamper/resources/attachment_spec.rb +14 -0
- data/spec/basecamper/resources/category_spec.rb +14 -0
- data/spec/basecamper/resources/comment_spec.rb +22 -0
- data/spec/basecamper/resources/company_spec.rb +14 -0
- data/spec/basecamper/resources/message_spec.rb +21 -0
- data/spec/basecamper/resources/milestone_spec.rb +14 -0
- data/spec/basecamper/resources/person_spec.rb +26 -0
- data/spec/basecamper/resources/project_spec.rb +42 -0
- data/spec/basecamper/resources/time_entry_spec.rb +18 -0
- data/spec/basecamper/resources/todo_item_spec.rb +20 -0
- data/spec/basecamper/resources/todo_list_spec.rb +20 -0
- data/spec/basecamper_spec.rb +21 -0
- data/spec/fixtures/basecamp.yml.sample +4 -0
- data/spec/spec_helper.rb +6 -0
- metadata +199 -0
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
Basecamper
|
2
|
+
==========
|
3
|
+
|
4
|
+
Basecamper is a Ruby wrapper to the 37 Signals [Basecamp API](http://developer.37signals.com/basecamp)
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
Simply add the gem to your Gemfile
|
10
|
+
|
11
|
+
gem 'basecamper'
|
12
|
+
|
13
|
+
|
14
|
+
Usage
|
15
|
+
-----
|
16
|
+
|
17
|
+
Configuration:
|
18
|
+
|
19
|
+
Basecamper.configure do |config|
|
20
|
+
config.token = '123abc'
|
21
|
+
config.domain = 'dummy.basecamphq.com'
|
22
|
+
end
|
23
|
+
|
24
|
+
Basecamper also enables one to authenticate with one's username and password:
|
25
|
+
|
26
|
+
Basecamper.configure do |config|
|
27
|
+
config.user = '123abc'
|
28
|
+
config.password = 'dummy.basecamphq.com'
|
29
|
+
end
|
30
|
+
|
31
|
+
Use SSL?
|
32
|
+
|
33
|
+
Basecamper.configure {|c| c.use_ssl = true }
|
34
|
+
|
35
|
+
|
36
|
+
That's it. You're done!
|
37
|
+
|
38
|
+
View your account info:
|
39
|
+
|
40
|
+
Basecamper.account
|
41
|
+
|
42
|
+
Return the current user:
|
43
|
+
|
44
|
+
Basecamper::Person.me
|
45
|
+
|
46
|
+
Returns resource index:
|
47
|
+
|
48
|
+
Basecamper::Project.all
|
49
|
+
returns: [#<Basecamper::Project:0x266e458 @attributes={"company"=>..}>]
|
50
|
+
|
51
|
+
Utilize has_many assocations:
|
52
|
+
|
53
|
+
project = Basecamper::Project.find(:first)
|
54
|
+
messages = project.messages
|
55
|
+
|
56
|
+
Utilize belongs_to associations:
|
57
|
+
|
58
|
+
message = messages.first
|
59
|
+
message.project
|
60
|
+
|
61
|
+
Add query params.
|
62
|
+
|
63
|
+
Basecamper::TodoList.all(:params => { :project_id => 1234 })
|
64
|
+
Basecamper::TodoList.find(:all, :params => { :project_id => 1234, :responsible_party => 9124 })
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'cucumber/rake/task'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
Bundler::GemHelper.install_tasks
|
6
|
+
|
7
|
+
desc 'Run all specs in spec directory'
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
t.pattern = "spec/**/*_spec.rb"
|
10
|
+
t.rspec_opts = %w(-fd -c)
|
11
|
+
end
|
12
|
+
|
13
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
14
|
+
t.cucumber_opts = "features --format pretty"
|
15
|
+
end
|
16
|
+
|
17
|
+
task :default => [:spec, :features]
|
data/basecamper.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "basecamper/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "basecamper"
|
7
|
+
s.version = Basecamper::VERSION
|
8
|
+
s.authors = ["Ryan Closner"]
|
9
|
+
s.email = ["ryan.closner@gmail.com"]
|
10
|
+
s.homepage = "http://rubygems.org/gems/basecamper"
|
11
|
+
s.summary = %q{Basecamp API Wrapper}
|
12
|
+
s.description = %q{Basecamp API Wrapper}
|
13
|
+
|
14
|
+
s.rubyforge_project = "basecamper"
|
15
|
+
|
16
|
+
{
|
17
|
+
'activeresource' => '>= 2.3.10',
|
18
|
+
}.each {|lib, version| s.add_runtime_dependency lib, version }
|
19
|
+
|
20
|
+
{
|
21
|
+
'bundler' => '~> 1.0.0',
|
22
|
+
'cucumber' => '~> 0.10.0',
|
23
|
+
'rake' => '~> 0.8.7',
|
24
|
+
'rspec' => '~> 2.5.0',
|
25
|
+
}.each {|lib, version| s.add_development_dependency lib, version }
|
26
|
+
|
27
|
+
s.files = `git ls-files`.split("\n")
|
28
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
29
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'basecamper'
|
4
|
+
|
5
|
+
module BasecamperMethods
|
6
|
+
def basecamp_user
|
7
|
+
basecamp['user']
|
8
|
+
end
|
9
|
+
|
10
|
+
def basecamp_password
|
11
|
+
basecamp['password']
|
12
|
+
end
|
13
|
+
|
14
|
+
def basecamp_token
|
15
|
+
basecamp['token']
|
16
|
+
end
|
17
|
+
|
18
|
+
def basecamp_domain
|
19
|
+
basecamp['domain']
|
20
|
+
end
|
21
|
+
|
22
|
+
def basecamp
|
23
|
+
@basecamp ||= YAML::load_file(File.dirname(__FILE__) + "../../spec/fixtures/basecamp.yml")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
World(BasecamperMethods)
|
29
|
+
|
30
|
+
Before do
|
31
|
+
Basecamper::Connection.configure do |config|
|
32
|
+
config.user = basecamp_user
|
33
|
+
config.password = basecamp_password
|
34
|
+
config.token = basecamp_token
|
35
|
+
config.domain = basecamp_domain
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Basecamper
|
2
|
+
class Connection
|
3
|
+
class << self
|
4
|
+
|
5
|
+
attr_accessor :token, :use_ssl
|
6
|
+
attr_writer :user, :password, :domain
|
7
|
+
|
8
|
+
def user
|
9
|
+
token.present? ? token : @user
|
10
|
+
end
|
11
|
+
|
12
|
+
def password
|
13
|
+
token.present? ? 'X' : @password
|
14
|
+
end
|
15
|
+
|
16
|
+
def domain
|
17
|
+
!!use_ssl ? "https://#{@domain}" : "http://#{@domain}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def configure(&block)
|
21
|
+
yield self
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Basecamper
|
2
|
+
class Resource < ActiveResource::Base
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
protected
|
7
|
+
alias :old_find :find
|
8
|
+
public
|
9
|
+
|
10
|
+
def find(*args)
|
11
|
+
self.site = Basecamper::Connection.domain
|
12
|
+
self.user = Basecamper::Connection.user
|
13
|
+
self.password = Basecamper::Connection.password
|
14
|
+
|
15
|
+
old_find(*args)
|
16
|
+
end
|
17
|
+
|
18
|
+
def parent_resources(*parents)
|
19
|
+
parents.each do |parent|
|
20
|
+
|
21
|
+
define_method(parent) do
|
22
|
+
resource = "Basecamper::#{parent.to_s.classify}".constantize
|
23
|
+
|
24
|
+
parent_id_key = "#{resource.element_name}_id"
|
25
|
+
id_value = attributes[parent_id_key]
|
26
|
+
|
27
|
+
resource.find(id_value) rescue nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def child_resources(*children)
|
33
|
+
children.each do |child|
|
34
|
+
define_method(child) do
|
35
|
+
resource = "Basecamper::#{child.to_s.singularize.classify}".constantize
|
36
|
+
|
37
|
+
parent_id_key = "#{self.class.element_name}_id"
|
38
|
+
resource.prefix = "/#{self.class.collection_name}/:#{parent_id_key}/"
|
39
|
+
|
40
|
+
resource.all(:params => { parent_id_key => id }) rescue []
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def all(*args)
|
46
|
+
find(:all, *args)
|
47
|
+
end
|
48
|
+
|
49
|
+
def first(*args)
|
50
|
+
find(:first, *args)
|
51
|
+
end
|
52
|
+
|
53
|
+
def last(*args)
|
54
|
+
find(:last, *args)
|
55
|
+
end
|
56
|
+
|
57
|
+
def prefix_source
|
58
|
+
'/'
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Basecamper
|
2
|
+
class Milestone < Resource
|
3
|
+
|
4
|
+
parent_resources :project
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def collection_path(prefix_options = {}, query_options = nil)
|
9
|
+
prefix_options, query_options = split_options(prefix_options) if query_options.nil?
|
10
|
+
"#{prefix(prefix_options)}#{collection_name}/list.#{format.extension}#{query_string(query_options)}"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/basecamper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "basecamper/version"
|
2
|
+
|
3
|
+
# Basecamper Utilities
|
4
|
+
require "basecamper/connection"
|
5
|
+
require "basecamper/resource"
|
6
|
+
|
7
|
+
# Basecamp Resources
|
8
|
+
require "basecamper/resources/attachment"
|
9
|
+
require "basecamper/resources/category"
|
10
|
+
require "basecamper/resources/comment"
|
11
|
+
require "basecamper/resources/company"
|
12
|
+
require "basecamper/resources/message"
|
13
|
+
require "basecamper/resources/milestone"
|
14
|
+
require "basecamper/resources/person"
|
15
|
+
require "basecamper/resources/project"
|
16
|
+
require "basecamper/resources/time_entry"
|
17
|
+
require "basecamper/resources/todo_list"
|
18
|
+
require "basecamper/resources/todo_item"
|
19
|
+
|
20
|
+
module Basecamper
|
21
|
+
class << self
|
22
|
+
def account
|
23
|
+
Resource.find(:one, :from => "/account.xml")
|
24
|
+
end
|
25
|
+
|
26
|
+
def configure(&block)
|
27
|
+
Connection.configure(&block)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe Connection do
|
5
|
+
|
6
|
+
let(:domain) { 'dummy.basecamphq.com' }
|
7
|
+
let(:user) { 'dummy' }
|
8
|
+
let(:password) { 'secret' }
|
9
|
+
let(:token) { '123456' }
|
10
|
+
|
11
|
+
subject { Connection }
|
12
|
+
|
13
|
+
describe ".token=" do
|
14
|
+
it "sets @token to the passed value" do
|
15
|
+
subject.token = token
|
16
|
+
subject.instance_variable_get(:@token).should == token
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe ".token" do
|
21
|
+
it "returns the value of @token" do
|
22
|
+
subject.instance_variable_set(:@token, token)
|
23
|
+
subject.token.should == token
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe ".use_ssl=" do
|
28
|
+
it "sets @use_ssl to the passed value" do
|
29
|
+
subject.use_ssl = true
|
30
|
+
subject.instance_variable_get(:@use_ssl).should be_true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
describe ".use_ssl" do
|
36
|
+
it "returns the value of @token" do
|
37
|
+
subject.instance_variable_set(:@use_ssl, true)
|
38
|
+
subject.use_ssl.should == true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe ".user=" do
|
43
|
+
it "sets @user to the passed value" do
|
44
|
+
subject.user = user
|
45
|
+
subject.instance_variable_get(:@user).should == user
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe ".user" do
|
50
|
+
before(:each) do
|
51
|
+
subject.instance_variable_set(:@user, user)
|
52
|
+
end
|
53
|
+
|
54
|
+
context ".token is present" do
|
55
|
+
before(:each) do
|
56
|
+
subject.stub(:token).and_return(token)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "returns the token" do
|
60
|
+
subject.user.should == token
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context ".token is not present" do
|
65
|
+
before(:each) do
|
66
|
+
subject.stub(:token).and_return(nil)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "returns @user" do
|
70
|
+
subject.user.should == user
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe ".password" do
|
76
|
+
before(:each) do
|
77
|
+
subject.instance_variable_set(:@password, password)
|
78
|
+
end
|
79
|
+
|
80
|
+
context ".token is present" do
|
81
|
+
before(:each) do
|
82
|
+
subject.stub(:token).and_return(token)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "returns 'X'" do
|
86
|
+
subject.password.should == 'X'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context ".token is not present" do
|
91
|
+
before(:each) do
|
92
|
+
subject.stub(:token).and_return(nil)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "returns @password" do
|
96
|
+
subject.password.should == password
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe ".domain=" do
|
102
|
+
it "sets @domain to the passed value" do
|
103
|
+
subject.domain = domain
|
104
|
+
subject.instance_variable_get(:@domain).should == domain
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe ".domain" do
|
109
|
+
before(:each) do
|
110
|
+
subject.instance_variable_set(:@domain, domain)
|
111
|
+
end
|
112
|
+
|
113
|
+
context ".use_ssl is nil" do
|
114
|
+
before(:each) do
|
115
|
+
subject.stub(:use_ssl).and_return(nil)
|
116
|
+
end
|
117
|
+
|
118
|
+
it "returns the domain prepended by 'http://'" do
|
119
|
+
subject.domain.should == "http://#{domain}"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context ".use_ssl is false" do
|
124
|
+
before(:each) do
|
125
|
+
subject.stub(:use_ssl).and_return(false)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "returns the domain prepended by 'http://'" do
|
129
|
+
subject.domain.should == "http://#{domain}"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context ".use_ssl is true" do
|
134
|
+
before(:each) do
|
135
|
+
subject.stub(:use_ssl).and_return(true)
|
136
|
+
end
|
137
|
+
|
138
|
+
it "returns the domain prepended by 'https://'" do
|
139
|
+
subject.domain.should == "https://#{domain}"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe ".configure" do
|
145
|
+
it "yields Basecamper::Connection" do
|
146
|
+
subject.configure do |config|
|
147
|
+
config.should == Basecamper::Connection
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe Resource do
|
5
|
+
|
6
|
+
class Foo < Resource
|
7
|
+
child_resources :bars
|
8
|
+
|
9
|
+
def attributes
|
10
|
+
{'id' => 123}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Bar < Resource
|
15
|
+
parent_resources :foo
|
16
|
+
|
17
|
+
def attributes
|
18
|
+
{'foo_id' => 456}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
subject { Resource }
|
23
|
+
|
24
|
+
it "inherits from ActiveResource::Base" do
|
25
|
+
subject.new.should be_a(ActiveResource::Base)
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ".parent_resources" do
|
29
|
+
context "Bar" do
|
30
|
+
|
31
|
+
let(:bar_instance) { Bar.new }
|
32
|
+
|
33
|
+
describe "#foo" do
|
34
|
+
it "calls Foo.find with its parent id" do
|
35
|
+
Foo.should_receive(:find).with(456)
|
36
|
+
bar_instance.foo
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe ".child_resources" do
|
43
|
+
context "Foo" do
|
44
|
+
|
45
|
+
let(:foo) { Foo.new }
|
46
|
+
|
47
|
+
describe "#bars" do
|
48
|
+
it "calls Bar.all with its parent id" do
|
49
|
+
Bar.should_receive(:all).with(:params => {"foo_id" => 123})
|
50
|
+
foo.bars
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe ".find" do
|
57
|
+
|
58
|
+
let(:domain) { 'https://dummy.basecamphq.com' }
|
59
|
+
let(:user) { 'dummy' }
|
60
|
+
let(:password) { 'secret' }
|
61
|
+
|
62
|
+
before(:each) do
|
63
|
+
Basecamper::Connection.stub(:domain).and_return(domain)
|
64
|
+
Basecamper::Connection.stub(:user).and_return(user)
|
65
|
+
Basecamper::Connection.stub(:password).and_return(password)
|
66
|
+
|
67
|
+
subject.stub(:old_find)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "sets the site to Connection.domain" do
|
71
|
+
subject.should_receive(:site=).with(domain)
|
72
|
+
subject.find
|
73
|
+
end
|
74
|
+
|
75
|
+
it "sets the user to Connection.user" do
|
76
|
+
subject.should_receive(:user=).with(user)
|
77
|
+
subject.find
|
78
|
+
end
|
79
|
+
|
80
|
+
it "sets the password to Connection.password" do
|
81
|
+
subject.should_receive(:password=).with(password)
|
82
|
+
subject.find
|
83
|
+
end
|
84
|
+
|
85
|
+
it "calls .old_find" do
|
86
|
+
subject.should_receive(:old_find).with(:all, {})
|
87
|
+
subject.find(:all, {})
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe ".all" do
|
92
|
+
it "aliases find(:all)" do
|
93
|
+
subject.should_receive(:find).with(:all, {})
|
94
|
+
subject.all({})
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe ".first" do
|
99
|
+
it "aliases find(:first)" do
|
100
|
+
subject.should_receive(:find).with(:first, {})
|
101
|
+
subject.first({})
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe ".last" do
|
106
|
+
it "aliases find(:last)" do
|
107
|
+
subject.should_receive(:find).with(:last, {})
|
108
|
+
subject.last({})
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe ".prefix_source" do
|
113
|
+
it "equals '/'" do
|
114
|
+
subject.prefix_source.should == '/'
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe Comment do
|
5
|
+
|
6
|
+
subject { Comment.new }
|
7
|
+
|
8
|
+
describe "belongs to" do
|
9
|
+
it "message" do
|
10
|
+
subject.should respond_to(:message)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "milestone" do
|
14
|
+
subject.should respond_to(:milestone)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "todo_item" do
|
18
|
+
subject.should respond_to(:todo_item)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe Message do
|
5
|
+
|
6
|
+
subject { Message }
|
7
|
+
let(:message) { subject.new}
|
8
|
+
|
9
|
+
describe ".element_name" do
|
10
|
+
it "returns 'post'" do
|
11
|
+
subject.element_name.should == 'post'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "belongs to" do
|
16
|
+
it "project" do
|
17
|
+
message.should respond_to(:project)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe Person do
|
5
|
+
|
6
|
+
subject { Person }
|
7
|
+
let(:person) { subject.new }
|
8
|
+
|
9
|
+
describe "belongs to" do
|
10
|
+
it "project" do
|
11
|
+
person.should respond_to(:project)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "company" do
|
15
|
+
person.should respond_to(:company)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".me" do
|
20
|
+
it "returns the current users information" do
|
21
|
+
subject.should_receive(:find).with(:one, :from => '/me.xml')
|
22
|
+
subject.me
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe Project do
|
5
|
+
|
6
|
+
subject { Project.new }
|
7
|
+
|
8
|
+
describe "has_many" do
|
9
|
+
it "attachments" do
|
10
|
+
subject.should respond_to(:attachments)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "categories" do
|
14
|
+
subject.should respond_to(:categories)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "companies" do
|
18
|
+
subject.should respond_to(:companies)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "messages" do
|
22
|
+
subject.should respond_to(:messages)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "milestones" do
|
26
|
+
subject.should respond_to(:milestones)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "people" do
|
30
|
+
subject.should respond_to(:people)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "time_entries" do
|
34
|
+
subject.should respond_to(:time_entries)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "todo_lists" do
|
38
|
+
subject.should respond_to(:todo_lists)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe TimeEntry do
|
5
|
+
|
6
|
+
subject { TimeEntry.new }
|
7
|
+
|
8
|
+
describe "belongs to" do
|
9
|
+
it "project" do
|
10
|
+
subject.should respond_to(:project)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "todo_item" do
|
14
|
+
subject.should respond_to(:todo_item)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe TodoItem do
|
5
|
+
|
6
|
+
subject { TodoItem.new }
|
7
|
+
|
8
|
+
describe "belongs to" do
|
9
|
+
it "todo_list" do
|
10
|
+
subject.should respond_to(:todo_list)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "has many" do
|
15
|
+
it "time_entries" do
|
16
|
+
subject.should respond_to(:time_entries)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Basecamper
|
4
|
+
describe TodoList do
|
5
|
+
|
6
|
+
subject { TodoList.new }
|
7
|
+
|
8
|
+
describe "belongs to" do
|
9
|
+
it "project" do
|
10
|
+
subject.should respond_to(:project)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "has many" do
|
15
|
+
it "todo_items" do
|
16
|
+
subject.should respond_to(:todo_items)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Basecamper do
|
4
|
+
|
5
|
+
subject { Basecamper }
|
6
|
+
|
7
|
+
describe ".account" do
|
8
|
+
it "retrieves account information" do
|
9
|
+
Basecamper::Resource.should_receive(:find).with(:one, :from => '/account.xml')
|
10
|
+
subject.account
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".configure" do
|
15
|
+
it "yields a Basecamper::Connection" do
|
16
|
+
Basecamper.configure do |config|
|
17
|
+
config.should == Basecamper::Connection
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: basecamper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Closner
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-07-14 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activeresource
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 3
|
33
|
+
- 10
|
34
|
+
version: 2.3.10
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 49
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 8
|
49
|
+
- 7
|
50
|
+
version: 0.8.7
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rspec
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 27
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 5
|
65
|
+
- 0
|
66
|
+
version: 2.5.0
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 23
|
78
|
+
segments:
|
79
|
+
- 1
|
80
|
+
- 0
|
81
|
+
- 0
|
82
|
+
version: 1.0.0
|
83
|
+
type: :development
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: cucumber
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 55
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
- 10
|
97
|
+
- 0
|
98
|
+
version: 0.10.0
|
99
|
+
type: :development
|
100
|
+
version_requirements: *id005
|
101
|
+
description: Basecamp API Wrapper
|
102
|
+
email:
|
103
|
+
- ryan.closner@gmail.com
|
104
|
+
executables: []
|
105
|
+
|
106
|
+
extensions: []
|
107
|
+
|
108
|
+
extra_rdoc_files: []
|
109
|
+
|
110
|
+
files:
|
111
|
+
- .gitignore
|
112
|
+
- Gemfile
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- basecamper.gemspec
|
116
|
+
- features/support/env.rb
|
117
|
+
- lib/basecamper.rb
|
118
|
+
- lib/basecamper/connection.rb
|
119
|
+
- lib/basecamper/resource.rb
|
120
|
+
- lib/basecamper/resources/attachment.rb
|
121
|
+
- lib/basecamper/resources/category.rb
|
122
|
+
- lib/basecamper/resources/comment.rb
|
123
|
+
- lib/basecamper/resources/company.rb
|
124
|
+
- lib/basecamper/resources/message.rb
|
125
|
+
- lib/basecamper/resources/milestone.rb
|
126
|
+
- lib/basecamper/resources/person.rb
|
127
|
+
- lib/basecamper/resources/project.rb
|
128
|
+
- lib/basecamper/resources/time_entry.rb
|
129
|
+
- lib/basecamper/resources/todo_item.rb
|
130
|
+
- lib/basecamper/resources/todo_list.rb
|
131
|
+
- lib/basecamper/version.rb
|
132
|
+
- spec/basecamper/connection_spec.rb
|
133
|
+
- spec/basecamper/resource_spec.rb
|
134
|
+
- spec/basecamper/resources/attachment_spec.rb
|
135
|
+
- spec/basecamper/resources/category_spec.rb
|
136
|
+
- spec/basecamper/resources/comment_spec.rb
|
137
|
+
- spec/basecamper/resources/company_spec.rb
|
138
|
+
- spec/basecamper/resources/message_spec.rb
|
139
|
+
- spec/basecamper/resources/milestone_spec.rb
|
140
|
+
- spec/basecamper/resources/person_spec.rb
|
141
|
+
- spec/basecamper/resources/project_spec.rb
|
142
|
+
- spec/basecamper/resources/time_entry_spec.rb
|
143
|
+
- spec/basecamper/resources/todo_item_spec.rb
|
144
|
+
- spec/basecamper/resources/todo_list_spec.rb
|
145
|
+
- spec/basecamper_spec.rb
|
146
|
+
- spec/fixtures/basecamp.yml.sample
|
147
|
+
- spec/spec_helper.rb
|
148
|
+
has_rdoc: true
|
149
|
+
homepage: http://rubygems.org/gems/basecamper
|
150
|
+
licenses: []
|
151
|
+
|
152
|
+
post_install_message:
|
153
|
+
rdoc_options: []
|
154
|
+
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
hash: 3
|
163
|
+
segments:
|
164
|
+
- 0
|
165
|
+
version: "0"
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
hash: 3
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
version: "0"
|
175
|
+
requirements: []
|
176
|
+
|
177
|
+
rubyforge_project: basecamper
|
178
|
+
rubygems_version: 1.6.2
|
179
|
+
signing_key:
|
180
|
+
specification_version: 3
|
181
|
+
summary: Basecamp API Wrapper
|
182
|
+
test_files:
|
183
|
+
- features/support/env.rb
|
184
|
+
- spec/basecamper/connection_spec.rb
|
185
|
+
- spec/basecamper/resource_spec.rb
|
186
|
+
- spec/basecamper/resources/attachment_spec.rb
|
187
|
+
- spec/basecamper/resources/category_spec.rb
|
188
|
+
- spec/basecamper/resources/comment_spec.rb
|
189
|
+
- spec/basecamper/resources/company_spec.rb
|
190
|
+
- spec/basecamper/resources/message_spec.rb
|
191
|
+
- spec/basecamper/resources/milestone_spec.rb
|
192
|
+
- spec/basecamper/resources/person_spec.rb
|
193
|
+
- spec/basecamper/resources/project_spec.rb
|
194
|
+
- spec/basecamper/resources/time_entry_spec.rb
|
195
|
+
- spec/basecamper/resources/todo_item_spec.rb
|
196
|
+
- spec/basecamper/resources/todo_list_spec.rb
|
197
|
+
- spec/basecamper_spec.rb
|
198
|
+
- spec/fixtures/basecamp.yml.sample
|
199
|
+
- spec/spec_helper.rb
|