easy_basecamp 0.0.1

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.textile ADDED
File without changes
@@ -0,0 +1,30 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "easy_basecamp"
3
+ s.version = "0.0.1"
4
+ s.email = "g.marcilhacy@gmail.com"
5
+ s.homepage = "https://github.com/gregorym/easy-basecamp"
6
+ s.summary = "Ruby wrapper of the Basecamp API"
7
+ s.has_rdoc = false
8
+ s.authors = ["Grégory Marcilhacy"]
9
+
10
+ s.require_paths = %w[lib]
11
+ s.add_dependency('activeresource', ">= 3.0.0")
12
+
13
+ s.files = %w[
14
+ easy_basecamp.gemspec
15
+ README.textile
16
+ lib/basecamp.rb
17
+ lib/basecamp/category.rb
18
+ lib/basecamp/comment.rb
19
+ lib/basecamp/company.rb
20
+ lib/basecamp/file.rb
21
+ lib/basecamp/message.rb
22
+ lib/basecamp/milestone.rb
23
+ lib/basecamp/person.rb
24
+ lib/basecamp/project.rb
25
+ lib/basecamp/time_tracker.rb
26
+ lib/basecamp/todo_list.rb
27
+ lib/basecamp/todo_list_item.rb
28
+ ]
29
+
30
+ end
@@ -0,0 +1,26 @@
1
+ module Basecamp
2
+
3
+ # Model format
4
+ # <category>
5
+ # <id type="integer">#{id}</id>
6
+ # <name>#{name}</name>
7
+ # <project-id type="integer">#{project_id}</project-id>
8
+ # <elements-count type="integer">#{elements_count}</elements-count>
9
+ # <type>#{type}</type>
10
+ # </category>
11
+ class Category < Base
12
+ TYPE = [:post, :attchment]
13
+
14
+ def self.in_project(project_id, type = nil)
15
+ params = type.present? ? {:type => type} : {}
16
+ find(:all, :from => "/projects/#{company_id}/categories.xml", :params => params)
17
+ end
18
+
19
+ # Type is required
20
+ # TODO
21
+ def self.create
22
+
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,23 @@
1
+ module Basecamp
2
+
3
+ # <comment>
4
+ # <id type="integer">#{id}</id>
5
+ # <author-id type="integer">#{author_id}</author-id>
6
+ # <author-name>#{author_name}</author-name>
7
+ # <commentable-id type="integer">#{commentable_id}</commentable-id>
8
+ # <commentable-type>#{commentable_type}</commentable-type>
9
+ # <body>#{body}</body>
10
+ # <emailed-from nil="true">#{emailed_from}</emailed-from>
11
+ # <created-at type="datetime">#{created_at}</created-at>
12
+ #
13
+ # <attachments-count type="integer">#{attachments_count}</attachments-count>
14
+ # <attachments type="array">
15
+ # <attachment>
16
+ # ...
17
+ # </attachment>
18
+ # ...
19
+ # </attachments>
20
+ # </comment>
21
+ class Comment < Base
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ module Basecamp
2
+
3
+ # Model format
4
+ # <company>
5
+ # <id type="integer">#{id}</id>
6
+ # <name>#{name}</name>
7
+ # <address-one>#{address_one}</address-one>
8
+ # <address-two>#{address_two}</address-two>
9
+ # <city>#{city}</city>
10
+ # <state>#{state}</state>
11
+ # <zip>#{zip}</zip>
12
+ # <country>#{country}</country>
13
+ # <web-address>#{web_address}</web-address>
14
+ # <phone-number-office>#{phone_number_office></phone-number-office>
15
+ # <phone-number-fax>#{phone_number_fax}</phone-number-fax>
16
+ # <time-zone-id>#{time_zone_id}</time-zone-id>
17
+ # <can-see-private type="boolean">#{can_see_private}</can-see-private>
18
+ #
19
+ # <!-- for non-client companies -->
20
+ # <url-name>#{url_name}</url-name>
21
+ # </company>
22
+ class Company < Base
23
+ def self.in_project(project_id)
24
+ find(:all, :from => "/projects/#{project_id}/companies.xml")
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ module Basecamp
2
+ class Attachment < Base
3
+
4
+ end
5
+ end
@@ -0,0 +1,56 @@
1
+ module Basecamp
2
+
3
+ # Model format
4
+ # <post>
5
+ # <id type="integer">#{id}</id>
6
+ # <title>#{title}</title>
7
+ # <body>#{body}</body>
8
+ # <display-body>#{display_body}</display-body>
9
+ # <posted-on type="datetime">#{posted_on}</posted-on>
10
+ # <commented-at type="datetime">#{commented_at}</commented-at>
11
+ # <project-id type="integer">#{project_id}</project-id>
12
+ # <category-id type="integer">#{category_id}</category-id>
13
+ # <author-id type="integer">#{author_id}</author-id>
14
+ # <author-name>#{author_name}</author-name>
15
+ # <milestone-id type="integer">#{milestone_id}</milestone-id>
16
+ # <comments-count type="integer">#{comments_count}</comments-count>
17
+ # <use-textile type="boolean">#{use_textile}</use-textile>
18
+ # <extended-body deprecated="true">#{extended_body}</extended-body>
19
+ # <display-extended-body deprecated="true">#{display_extended_body}</display-extended-body>
20
+ #
21
+ # <attachments-count type="integer">#{attachments_count}</attachments-count>
22
+ # <attachments type="array">
23
+ # <attachment>
24
+ # ...
25
+ # </attachment>
26
+ # ...
27
+ # </attachments>
28
+ #
29
+ # <!-- if user can see private posts -->
30
+ # <private type="boolean">#{private}</private>
31
+ # </post>
32
+ class Message < Base
33
+ self.element_name = "post"
34
+
35
+ # Get all messages from a project
36
+ def self.in_project(project_id)
37
+ get(:all, :from => "/projects/#{project_id}/posts.xml")
38
+ end
39
+
40
+ # Get all messages a project and a specific category
41
+ def self.in_project_by_category(project_id, category_id)
42
+ get(:all, :from => "/projects/#{project_id}/cat/#{category_id}/posts.xml")
43
+ end
44
+
45
+ # Get archived messages from a project
46
+ def self.archived(project_id)
47
+ get(:all, :from => "/projects/#{project_id}/posts/archive.xml")
48
+ end
49
+
50
+ # Get archived messages a project and a specific category
51
+ def self.in_project_by_category(project_id, category_id)
52
+ get(:all, :from => "/projects/#{project_id}/cat/#{category_id}/posts/archived.xml")
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,25 @@
1
+ module Basecamp
2
+
3
+ # <milestone>
4
+ # <id type="integer">#{id}</id>
5
+ # <title>#{title}</title>
6
+ # <deadline type="date">#{deadline}</deadline>
7
+ # <completed type="boolean">#{true|false}</completed>
8
+ # <project-id type="integer">#{project_id}</project-id>
9
+ # <created-on type="datetime">#{created_on}</created-on>
10
+ # <creator-id type="integer">#{creator_id}</creator-id>
11
+ # <creator-name>#{creator_name}</creator-name>
12
+ # <responsible-party-id type="integer">#{responsible_party_id}</responsible-party-id>
13
+ # <responsible-party-type>#{responsible_party_type}</responsible-party-type>
14
+ # <responsible-party-name>#{responsible_party_name}</responsible-party-name>
15
+ # <commented-at type="datetime">#{commented_at}</commented_at>
16
+ # <comments-count type="integer">#{comments_count}</comments-count>
17
+ #
18
+ # <!-- if the milestone has been completed -->
19
+ # <completed-on type="datetime">#{completed_on}</completed-on>
20
+ # <completer-id type="integer">#{completer_id}</completer-id>
21
+ # <completer-name>#{completer_name}</completer-name>
22
+ # </milestone>
23
+ class Milestone < Base
24
+ end
25
+ end
@@ -0,0 +1,53 @@
1
+ module Basecamp
2
+
3
+ # Model format
4
+ # <person>
5
+ # <id type="integer">#{id}</id>
6
+ # <first-name>#{first_name}</first-name>
7
+ # <last-name>#{last_name}</last-name>
8
+ # <title>#{title}</title>
9
+ # <email-address>#{email_address}</email-address}
10
+ # <im-handle>#{im_handle}</im-handle>
11
+ # <im-service>#{im_service}</im-service>
12
+ # <phone-number-office>#{phone_number_office}</phone-number-office>
13
+ # <phone-number-office-ext>#{phone_number_office_ext}</phone-number-office-ext>
14
+ # <phone-number-mobile>#{phone_number_mobile}</phone-number-mobile>
15
+ # <phone-number-home>#{phone_number_home}</phone-number-home>
16
+ # <phone-number-fax>#{phone_number_fax}</phone-number-fax>
17
+ # <last-login type="datetime">#{last_login}</last-login>
18
+ # <company-id type="integer">#{company_id}</company-id>
19
+ # <client-id type="integer">#{client_id}</client-id>
20
+ #
21
+ # <avatar-url>#{avatar_url}</avatar-url>
22
+
23
+ # <!-- if user is an administrator, or is self -->
24
+ # <user-name>#{user_name}</user-name>
25
+ #
26
+ # <!-- if user is an administrator -->
27
+ # <administrator type="boolean">#{administrator}</administrator>
28
+ # <deleted type="boolean">#{deleted}</deleted>
29
+ # <has-access-to-new-projects type="boolean">#{has_access_to_new_projects}</has-access-to-new-projects>
30
+ # </person>
31
+ class Person < Base
32
+
33
+ # Current logged in person
34
+ def self.me
35
+ get(:me)
36
+ end
37
+
38
+ # Returns all people visible to (and including) the requesting user.
39
+ def self.people
40
+ find(:all)
41
+ end
42
+
43
+ def self.in_project(project_id)
44
+ find(:all, :from => "/projects/#{project_id}/people.xml")
45
+ end
46
+
47
+ def self.in_company(company_id)
48
+ find(:all, :from => "/projects/#{company_id}/people.xml")
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,30 @@
1
+ module Basecamp
2
+
3
+ # Model format
4
+ # <project>
5
+ # <id type="integer">#{id}</id>
6
+ # <name>#{name}</name>
7
+ # <created-on type="datetime">#{created_on}</created-on>
8
+ # <status>#{status}</status>
9
+ # <last-changed-on type="datetiem">#{last_changed_on}</last-changed-on>
10
+ # <company>
11
+ # <id type="integer">#{id}</id>
12
+ # <name>#{name}</name>
13
+ # </company>
14
+ #
15
+ # <!-- if user is administrator, or show_announcement is true -->
16
+ # <announcement>#{announcement}</announcement>
17
+ #
18
+ # <!-- if user is administrator -->
19
+ # <start-page>#{start_page}</start-page>
20
+ # <show-writeboards type="boolean">#{show_writeboards}</show-writeboards>
21
+ # <show-announcement type="boolean">#{show_announcement}</show-announcement>
22
+ # </project>
23
+ class Project < Base
24
+
25
+ def self.count
26
+ get(:count)
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,15 @@
1
+ module Basecamp
2
+
3
+ # <time-entry>
4
+ # <id type="integer">#{id}</id>
5
+ # <project-id type="integer">#{project-id}</project-id>
6
+ # <person-id type="integer">#{person-id}</person-id>
7
+ # <date type="date">#{date}</date>
8
+ # <hours>#{hours}</hours>
9
+ # <description>#{description}</description>
10
+ # <todo-item-id type="integer">#{todo-item-id}</todo-item-id>
11
+ # </time-entry>
12
+ class TimeTracker < Base
13
+ self.element_name = "time-entry"
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ module Basecamp
2
+
3
+ # <todo-list>
4
+ # <id type="integer">#{id}</id>
5
+ # <name>#{name}</name>
6
+ # <description>#{description}</description>
7
+ # <project-id type="integer">#{project_id}</project-id>
8
+ # <milestone-id type="integer">#{milestone_id}</milestone-id>
9
+ # <position type="integer">#{position}</position>
10
+ #
11
+ # <!-- if user can see private lists -->
12
+ # <private type="boolean">#{private}</private>
13
+ #
14
+ # <!-- if the account supports time tracking -->
15
+ # <tracked type="boolean">#{tracked}</tracked>
16
+ #
17
+ # <!-- if todo-items are included in the response -->
18
+ # <todo-items type="array">
19
+ # <todo-item>
20
+ # ...
21
+ # </todo-item>
22
+ # <todo-item>
23
+ # ...
24
+ # </todo-item>
25
+ # ...
26
+ # </todo-items>
27
+ # </todo-list>
28
+ class TodoList < Base
29
+ self.element_name ="todo-list"
30
+ end
31
+ end
@@ -0,0 +1,29 @@
1
+ module Basecamp
2
+
3
+ # <todo-item>
4
+ # <id type="integer">#{id}</id>
5
+ # <todo-list-id type="integer">#{todo_list_id}</todo-list-id>
6
+ # <content>#{content}</content>
7
+ # <position type="integer">#{position}</position>
8
+ # <created-on type="datetime">#{created_on}</created-on>
9
+ # <creator-id type="integer">#{creator_id}</creator-id>
10
+ # <creator-name>#{creator_name}</creator-name>
11
+ # <completed type="boolean">#{completed}</completed>
12
+ # <updated-at type="datetime">#{updated_at}</updated-at>
13
+ # <commented-at type="datetime">#{commented_at}</commented-at>
14
+ # <comments-count type="integer">#{comments_count}</comments-count>
15
+ #
16
+ # <!-- if the item has a responsible party -->
17
+ # <responsible-party-type>#{responsible_party_type}</responsible-party-type>
18
+ # <responsible-party-id type="integer">#{responsible_party_id}</responsible-party-id>
19
+ # <responsible-party-name>#{responsible_party_name}</responsible-party-name>
20
+ #
21
+ # <!-- if the item has been completed -->
22
+ # <completed-on type="datetime">#{completed_on}</completed-on>
23
+ # <completer-id type="integer">#{completer_id}</completer-id>
24
+ # <completer-name>#{completer_name}</completer-name>
25
+ # </todo-item>
26
+ class TodoListItem < Base
27
+ self.element_name = "todo-item"
28
+ end
29
+ end
data/lib/basecamp.rb ADDED
@@ -0,0 +1,29 @@
1
+ require "rubygems"
2
+ require "active_resource"
3
+
4
+ module Basecamp
5
+
6
+ class Base < ActiveResource::Base
7
+
8
+ def self.establish_connection!(ssl, subdomain, user, password = 'X')
9
+ site = ssl ? "https://" : "http://"
10
+ self.site = [site, app, ".basecamphq.com/"].join
11
+ self.user = api_key
12
+ self.password = password
13
+ self
14
+ end
15
+ end
16
+
17
+ end
18
+
19
+ require "basecamp/category.rb"
20
+ require "basecamp/company.rb"
21
+ require "basecamp/comment.rb"
22
+ require "basecamp/file.rb"
23
+ require "basecamp/message.rb"
24
+ require "basecamp/milestone.rb"
25
+ require "basecamp/person.rb"
26
+ require "basecamp/project.rb"
27
+ require "basecamp/time_tracker.rb"
28
+ require "basecamp/todo_list.rb"
29
+ require "basecamp/todo_list_item.rb"
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: easy_basecamp
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
+ - "Gr\xC3\xA9gory Marcilhacy"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-27 00:00:00 +02: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: 7
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
34
+ version: 3.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description:
38
+ email: g.marcilhacy@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - easy_basecamp.gemspec
47
+ - README.textile
48
+ - lib/basecamp.rb
49
+ - lib/basecamp/category.rb
50
+ - lib/basecamp/comment.rb
51
+ - lib/basecamp/company.rb
52
+ - lib/basecamp/file.rb
53
+ - lib/basecamp/message.rb
54
+ - lib/basecamp/milestone.rb
55
+ - lib/basecamp/person.rb
56
+ - lib/basecamp/project.rb
57
+ - lib/basecamp/time_tracker.rb
58
+ - lib/basecamp/todo_list.rb
59
+ - lib/basecamp/todo_list_item.rb
60
+ has_rdoc: true
61
+ homepage: https://github.com/gregorym/easy-basecamp
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options: []
66
+
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ requirements: []
88
+
89
+ rubyforge_project:
90
+ rubygems_version: 1.6.2
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: Ruby wrapper of the Basecamp API
94
+ test_files: []
95
+