easy_basecamp 0.0.4 → 0.0.6
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/easy_basecamp.gemspec +1 -1
- data/lib/basecamp/file.rb +19 -3
- data/lib/basecamp/message.rb +5 -5
- data/lib/basecamp.rb +18 -8
- metadata +5 -5
data/easy_basecamp.gemspec
CHANGED
data/lib/basecamp/file.rb
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
module Basecamp
|
2
|
-
class Attachment
|
3
|
-
|
2
|
+
class Attachment
|
3
|
+
attr_accessor :id, :filename, :content, :content_type
|
4
|
+
|
5
|
+
def initialize(filename, content, content_type = 'application/octet-stream')
|
6
|
+
@filename, @content, @content_type = filename, content, content_type
|
7
|
+
end
|
8
|
+
|
9
|
+
def save
|
10
|
+
response = Basecamp::Connection.new.post('upload', content, {'Content-Type' => content_type})
|
11
|
+
|
12
|
+
if response.code == '200'
|
13
|
+
self.id = Hash.from_xml(response.body)['upload']['id']
|
14
|
+
true
|
15
|
+
else
|
16
|
+
raise "Could not save attachment: #{response.message} (#{response.code})"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
4
20
|
end
|
5
|
-
end
|
21
|
+
end
|
data/lib/basecamp/message.rb
CHANGED
@@ -30,26 +30,26 @@ module Basecamp
|
|
30
30
|
# <private type="boolean">#{private}</private>
|
31
31
|
# </post>
|
32
32
|
class Message < Base
|
33
|
-
self.element_name = "post"
|
33
|
+
#self.element_name = "post"
|
34
34
|
|
35
35
|
# Get all messages from a project
|
36
36
|
def self.in_project(project_id)
|
37
|
-
|
37
|
+
find(:all, :from => "/projects/#{project_id}/posts.xml")
|
38
38
|
end
|
39
39
|
|
40
40
|
# Get all messages a project and a specific category
|
41
41
|
def self.in_project_by_category(project_id, category_id)
|
42
|
-
|
42
|
+
find(:all, :from => "/projects/#{project_id}/cat/#{category_id}/posts.xml")
|
43
43
|
end
|
44
44
|
|
45
45
|
# Get archived messages from a project
|
46
46
|
def self.archived(project_id)
|
47
|
-
|
47
|
+
find(:all, :from => "/projects/#{project_id}/posts/archive.xml")
|
48
48
|
end
|
49
49
|
|
50
50
|
# Get archived messages a project and a specific category
|
51
51
|
def self.in_project_by_category(project_id, category_id)
|
52
|
-
|
52
|
+
find(:all, :from => "/projects/#{project_id}/cat/#{category_id}/posts/archived.xml")
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
data/lib/basecamp.rb
CHANGED
@@ -2,23 +2,30 @@ require "rubygems"
|
|
2
2
|
require "active_resource"
|
3
3
|
|
4
4
|
module Basecamp
|
5
|
-
|
6
5
|
class Base < ActiveResource::Base
|
7
|
-
|
8
|
-
|
9
|
-
site
|
10
|
-
self.
|
11
|
-
self.user = user
|
6
|
+
def self.establish_connection!(ssl, subdomain, user, password = 'X')
|
7
|
+
self.use_ssl = ssl
|
8
|
+
self.site = [ssl ? "https://" : "http://", subdomain, ".basecamphq.com"].join
|
9
|
+
self.user = user
|
12
10
|
self.password = password
|
13
|
-
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.use_ssl?
|
15
|
+
@use_ssl
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.use_ssl=(ssl)
|
19
|
+
@use_ssl = ssl
|
14
20
|
end
|
21
|
+
|
15
22
|
end
|
16
|
-
|
17
23
|
end
|
18
24
|
|
19
25
|
require "basecamp/category.rb"
|
20
26
|
require "basecamp/company.rb"
|
21
27
|
require "basecamp/comment.rb"
|
28
|
+
require "basecamp/connection"
|
22
29
|
require "basecamp/file.rb"
|
23
30
|
require "basecamp/message.rb"
|
24
31
|
require "basecamp/milestone.rb"
|
@@ -27,3 +34,6 @@ require "basecamp/project.rb"
|
|
27
34
|
require "basecamp/time_tracker.rb"
|
28
35
|
require "basecamp/todo_list.rb"
|
29
36
|
require "basecamp/todo_list_item.rb"
|
37
|
+
|
38
|
+
Basecamp::Base.establish_connection!(true, "ciblonet", "gregorym", "gregochou")
|
39
|
+
print Basecamp::Message.in_project(7119860)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_basecamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Gr\xC3\xA9gory Marcilhacy"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-25 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements: []
|
88
88
|
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 1.4.1
|
91
91
|
signing_key:
|
92
92
|
specification_version: 3
|
93
93
|
summary: Ruby wrapper of the Basecamp API
|