basecamper 0.0.1 → 0.0.2
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/README.md +44 -19
- data/features/support/env.rb +1 -0
- data/lib/basecamper/resources/message.rb +5 -0
- data/lib/basecamper/resources/milestone.rb +2 -5
- data/lib/basecamper/resources/project.rb +7 -0
- data/lib/basecamper/resources/time_entry.rb +5 -0
- data/lib/basecamper/version.rb +1 -1
- data/spec/basecamper/resources/message_spec.rb +7 -0
- data/spec/basecamper/resources/milestone_spec.rb +10 -2
- data/spec/basecamper/resources/project_spec.rb +18 -10
- data/spec/basecamper/resources/time_entry_spec.rb +11 -3
- metadata +4 -4
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
Basecamper
|
2
2
|
==========
|
3
3
|
|
4
|
+
[](http://travis-ci.org/rclosner/basecamper)
|
5
|
+
|
4
6
|
Basecamper is a Ruby wrapper to the 37 Signals [Basecamp API](http://developer.37signals.com/basecamp)
|
5
7
|
|
6
8
|
Installation
|
@@ -8,57 +10,80 @@ Installation
|
|
8
10
|
|
9
11
|
Simply add the gem to your Gemfile
|
10
12
|
|
13
|
+
```ruby
|
11
14
|
gem 'basecamper'
|
15
|
+
```
|
12
16
|
|
13
|
-
|
14
|
-
Usage
|
17
|
+
Configuration
|
15
18
|
-----
|
16
19
|
|
17
|
-
|
20
|
+
Add authentication configurations:
|
18
21
|
|
22
|
+
```ruby
|
19
23
|
Basecamper.configure do |config|
|
20
24
|
config.token = '123abc'
|
21
25
|
config.domain = 'dummy.basecamphq.com'
|
22
26
|
end
|
27
|
+
```
|
23
28
|
|
24
29
|
Basecamper also enables one to authenticate with one's username and password:
|
25
30
|
|
31
|
+
```ruby
|
26
32
|
Basecamper.configure do |config|
|
27
33
|
config.user = '123abc'
|
28
|
-
config.password = '
|
34
|
+
config.password = 'secret'
|
29
35
|
end
|
36
|
+
```
|
30
37
|
|
31
38
|
Use SSL?
|
32
|
-
|
39
|
+
|
40
|
+
```ruby
|
33
41
|
Basecamper.configure {|c| c.use_ssl = true }
|
42
|
+
```
|
34
43
|
|
44
|
+
Usage
|
45
|
+
-----
|
35
46
|
|
36
|
-
That's it. You're done!
|
37
47
|
|
38
|
-
View
|
48
|
+
View account info:
|
39
49
|
|
50
|
+
```ruby
|
40
51
|
Basecamper.account
|
52
|
+
```
|
41
53
|
|
42
|
-
Return
|
54
|
+
Return current user:
|
43
55
|
|
56
|
+
```ruby
|
44
57
|
Basecamper::Person.me
|
58
|
+
```
|
45
59
|
|
46
|
-
|
60
|
+
Basic operations:
|
47
61
|
|
62
|
+
```ruby
|
48
63
|
Basecamper::Project.all
|
49
64
|
returns: [#<Basecamper::Project:0x266e458 @attributes={"company"=>..}>]
|
50
65
|
|
51
|
-
|
66
|
+
Basecamper::Project.first
|
67
|
+
returns: #<Basecamper::Project:0x266e458 @attributes={"company"=>..}>
|
68
|
+
```
|
52
69
|
|
53
|
-
|
54
|
-
|
70
|
+
Advanced queries:
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
Basecamper::TodoList.all(:params => { :project_id => 1234 })
|
74
|
+
Basecamper::TodoList.find(:all, :params => { :project_id => 1234, :responsible_party => 9124 })
|
75
|
+
```
|
55
76
|
|
56
|
-
|
77
|
+
Child assocations:
|
57
78
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
79
|
+
```ruby
|
80
|
+
project = Basecamper::Project.find(123)
|
81
|
+
project.messages
|
82
|
+
```
|
62
83
|
|
63
|
-
|
64
|
-
|
84
|
+
Parent associations:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
message = Basecamper::Message.find(123)
|
88
|
+
message.project
|
89
|
+
```
|
data/features/support/env.rb
CHANGED
@@ -4,12 +4,9 @@ module Basecamper
|
|
4
4
|
parent_resources :project
|
5
5
|
|
6
6
|
class << self
|
7
|
-
|
8
|
-
|
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)}"
|
7
|
+
def all(options)
|
8
|
+
find(:all, {:from => :list}.merge(options))
|
11
9
|
end
|
12
|
-
|
13
10
|
end
|
14
11
|
end
|
15
12
|
end
|
@@ -3,5 +3,12 @@ module Basecamper
|
|
3
3
|
|
4
4
|
child_resources :attachments, :categories, :companies, :messages, :milestones, :people, :time_entries, :todo_lists
|
5
5
|
|
6
|
+
class << self
|
7
|
+
def count
|
8
|
+
if response = find(:one, :from => :count)
|
9
|
+
response.attributes
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
6
13
|
end
|
7
14
|
end
|
data/lib/basecamper/version.rb
CHANGED
@@ -17,5 +17,12 @@ module Basecamper
|
|
17
17
|
message.should respond_to(:project)
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
describe ".archived" do
|
22
|
+
it "returns archived messages" do
|
23
|
+
subject.should_receive(:find).with(:all, :from => :archive, :params => {})
|
24
|
+
subject.archived(:params => {})
|
25
|
+
end
|
26
|
+
end
|
20
27
|
end
|
21
28
|
end
|
@@ -3,11 +3,19 @@ require 'spec_helper'
|
|
3
3
|
module Basecamper
|
4
4
|
describe Milestone do
|
5
5
|
|
6
|
-
subject
|
6
|
+
subject { Milestone }
|
7
|
+
let(:milestone) { subject.new }
|
7
8
|
|
8
9
|
describe "belongs to" do
|
9
10
|
it "project" do
|
10
|
-
|
11
|
+
milestone.should respond_to(:project)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".all" do
|
16
|
+
it "appends list to the query" do
|
17
|
+
subject.should_receive(:find).with(:all, :from => :list, :params => {})
|
18
|
+
subject.all(:params => {})
|
11
19
|
end
|
12
20
|
end
|
13
21
|
end
|
@@ -3,39 +3,47 @@ require 'spec_helper'
|
|
3
3
|
module Basecamper
|
4
4
|
describe Project do
|
5
5
|
|
6
|
-
subject
|
6
|
+
subject { Project }
|
7
|
+
let(:project) { subject.new }
|
7
8
|
|
8
9
|
describe "has_many" do
|
9
10
|
it "attachments" do
|
10
|
-
|
11
|
+
project.should respond_to(:attachments)
|
11
12
|
end
|
12
13
|
|
13
14
|
it "categories" do
|
14
|
-
|
15
|
+
project.should respond_to(:categories)
|
15
16
|
end
|
16
17
|
|
17
18
|
it "companies" do
|
18
|
-
|
19
|
+
project.should respond_to(:companies)
|
19
20
|
end
|
20
21
|
|
21
22
|
it "messages" do
|
22
|
-
|
23
|
+
project.should respond_to(:messages)
|
23
24
|
end
|
24
25
|
|
25
26
|
it "milestones" do
|
26
|
-
|
27
|
+
project.should respond_to(:milestones)
|
27
28
|
end
|
28
29
|
|
29
30
|
it "people" do
|
30
|
-
|
31
|
+
project.should respond_to(:people)
|
31
32
|
end
|
32
33
|
|
33
34
|
it "time_entries" do
|
34
|
-
|
35
|
+
project.should respond_to(:time_entries)
|
35
36
|
end
|
36
|
-
|
37
|
+
|
37
38
|
it "todo_lists" do
|
38
|
-
|
39
|
+
project.should respond_to(:todo_lists)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe ".count" do
|
44
|
+
it "retrieves count" do
|
45
|
+
subject.should_receive(:find).with(:one, :from => :count)
|
46
|
+
subject.count
|
39
47
|
end
|
40
48
|
end
|
41
49
|
end
|
@@ -3,15 +3,23 @@ require 'spec_helper'
|
|
3
3
|
module Basecamper
|
4
4
|
describe TimeEntry do
|
5
5
|
|
6
|
-
subject
|
6
|
+
subject { TimeEntry }
|
7
|
+
let(:time_entry) { subject.new }
|
7
8
|
|
8
9
|
describe "belongs to" do
|
9
10
|
it "project" do
|
10
|
-
|
11
|
+
time_entry.should respond_to(:project)
|
11
12
|
end
|
12
13
|
|
13
14
|
it "todo_item" do
|
14
|
-
|
15
|
+
time_entry.should respond_to(:todo_item)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".report" do
|
20
|
+
it "returns time entry report" do
|
21
|
+
subject.should_receive(:find).with(:all, :from => :report, :params => {})
|
22
|
+
subject.report(:params => {})
|
15
23
|
end
|
16
24
|
end
|
17
25
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: basecamper
|
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
|
- Ryan Closner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-18 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|