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 CHANGED
@@ -1,6 +1,8 @@
1
1
  Basecamper
2
2
  ==========
3
3
 
4
+ [![travis](https://secure.travis-ci.org/rclosner/basecamper.png)](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
- Configuration:
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 = 'dummy.basecamphq.com'
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 your account info:
48
+ View account info:
39
49
 
50
+ ```ruby
40
51
  Basecamper.account
52
+ ```
41
53
 
42
- Return the current user:
54
+ Return current user:
43
55
 
56
+ ```ruby
44
57
  Basecamper::Person.me
58
+ ```
45
59
 
46
- Returns resource index:
60
+ Basic operations:
47
61
 
62
+ ```ruby
48
63
  Basecamper::Project.all
49
64
  returns: [#<Basecamper::Project:0x266e458 @attributes={"company"=>..}>]
50
65
 
51
- Utilize has_many assocations:
66
+ Basecamper::Project.first
67
+ returns: #<Basecamper::Project:0x266e458 @attributes={"company"=>..}>
68
+ ```
52
69
 
53
- project = Basecamper::Project.find(:first)
54
- messages = project.messages
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
- Utilize belongs_to associations:
77
+ Child assocations:
57
78
 
58
- message = messages.first
59
- message.project
60
-
61
- Add query params.
79
+ ```ruby
80
+ project = Basecamper::Project.find(123)
81
+ project.messages
82
+ ```
62
83
 
63
- Basecamper::TodoList.all(:params => { :project_id => 1234 })
64
- Basecamper::TodoList.find(:all, :params => { :project_id => 1234, :responsible_party => 9124 })
84
+ Parent associations:
85
+
86
+ ```ruby
87
+ message = Basecamper::Message.find(123)
88
+ message.project
89
+ ```
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
+ require 'active_resource'
3
4
  require 'basecamper'
4
5
 
5
6
  module BasecamperMethods
@@ -5,5 +5,10 @@ module Basecamper
5
5
 
6
6
  parent_resources :project
7
7
 
8
+ class << self
9
+ def archived(options = {})
10
+ find(:all, {:from => :archive}.merge(options))
11
+ end
12
+ end
8
13
  end
9
14
  end
@@ -4,12 +4,9 @@ module Basecamper
4
4
  parent_resources :project
5
5
 
6
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)}"
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
@@ -3,5 +3,10 @@ module Basecamper
3
3
 
4
4
  parent_resources :project, :todo_item
5
5
 
6
+ class << self
7
+ def report(options = {})
8
+ find(:all, {:from => :report}.merge(options))
9
+ end
10
+ end
6
11
  end
7
12
  end
@@ -1,3 +1,3 @@
1
1
  module Basecamper
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -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 { Milestone.new }
6
+ subject { Milestone }
7
+ let(:milestone) { subject.new }
7
8
 
8
9
  describe "belongs to" do
9
10
  it "project" do
10
- subject.should respond_to(:project)
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 { Project.new }
6
+ subject { Project }
7
+ let(:project) { subject.new }
7
8
 
8
9
  describe "has_many" do
9
10
  it "attachments" do
10
- subject.should respond_to(:attachments)
11
+ project.should respond_to(:attachments)
11
12
  end
12
13
 
13
14
  it "categories" do
14
- subject.should respond_to(:categories)
15
+ project.should respond_to(:categories)
15
16
  end
16
17
 
17
18
  it "companies" do
18
- subject.should respond_to(:companies)
19
+ project.should respond_to(:companies)
19
20
  end
20
21
 
21
22
  it "messages" do
22
- subject.should respond_to(:messages)
23
+ project.should respond_to(:messages)
23
24
  end
24
25
 
25
26
  it "milestones" do
26
- subject.should respond_to(:milestones)
27
+ project.should respond_to(:milestones)
27
28
  end
28
29
 
29
30
  it "people" do
30
- subject.should respond_to(:people)
31
+ project.should respond_to(:people)
31
32
  end
32
33
 
33
34
  it "time_entries" do
34
- subject.should respond_to(:time_entries)
35
+ project.should respond_to(:time_entries)
35
36
  end
36
-
37
+
37
38
  it "todo_lists" do
38
- subject.should respond_to(:todo_lists)
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 { TimeEntry.new }
6
+ subject { TimeEntry }
7
+ let(:time_entry) { subject.new }
7
8
 
8
9
  describe "belongs to" do
9
10
  it "project" do
10
- subject.should respond_to(:project)
11
+ time_entry.should respond_to(:project)
11
12
  end
12
13
 
13
14
  it "todo_item" do
14
- subject.should respond_to(:todo_item)
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
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-14 00:00:00 -07:00
18
+ date: 2011-07-18 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency