basecamp3 0.1.3
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.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +21 -0
- data/README.md +65 -0
- data/Rakefile +6 -0
- data/basecamp3.gemspec +38 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Basecamp3.html +367 -0
- data/docs/Basecamp3/Campfire.html +901 -0
- data/docs/Basecamp3/CampfireLine.html +1025 -0
- data/docs/Basecamp3/Comment.html +1284 -0
- data/docs/Basecamp3/Concerns.html +117 -0
- data/docs/Basecamp3/Concerns/Bucketable.html +211 -0
- data/docs/Basecamp3/Concerns/Commentable.html +285 -0
- data/docs/Basecamp3/Concerns/Creatorable.html +209 -0
- data/docs/Basecamp3/Concerns/Parentable.html +211 -0
- data/docs/Basecamp3/Concerns/Recordingable.html +189 -0
- data/docs/Basecamp3/Concerns/Recordingable/ClassMethods.html +236 -0
- data/docs/Basecamp3/Document.html +1262 -0
- data/docs/Basecamp3/Forward.html +1070 -0
- data/docs/Basecamp3/Inbox.html +840 -0
- data/docs/Basecamp3/Message.html +1262 -0
- data/docs/Basecamp3/MessageBoard.html +840 -0
- data/docs/Basecamp3/MessageType.html +1160 -0
- data/docs/Basecamp3/Model.html +236 -0
- data/docs/Basecamp3/Person.html +1288 -0
- data/docs/Basecamp3/Project.html +1280 -0
- data/docs/Basecamp3/Question.html +1050 -0
- data/docs/Basecamp3/QuestionAnswer.html +887 -0
- data/docs/Basecamp3/Questionnaire.html +840 -0
- data/docs/Basecamp3/Request.html +933 -0
- data/docs/Basecamp3/ResponseParser.html +303 -0
- data/docs/Basecamp3/Schedule.html +840 -0
- data/docs/Basecamp3/ScheduleEntry.html +1560 -0
- data/docs/Basecamp3/Todo.html +1726 -0
- data/docs/Basecamp3/TodoList.html +1480 -0
- data/docs/Basecamp3/TodoSet.html +980 -0
- data/docs/Basecamp3/TypeMapper.html +329 -0
- data/docs/Basecamp3/Vault.html +1514 -0
- data/docs/_index.html +415 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +492 -0
- data/docs/file.README.html +157 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +157 -0
- data/docs/js/app.js +248 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1875 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/basecamp3.rb +61 -0
- data/lib/basecamp3/concerns/bucketable.rb +17 -0
- data/lib/basecamp3/concerns/commentable.rb +15 -0
- data/lib/basecamp3/concerns/creatorable.rb +16 -0
- data/lib/basecamp3/concerns/parentable.rb +17 -0
- data/lib/basecamp3/concerns/recordingable.rb +22 -0
- data/lib/basecamp3/model.rb +23 -0
- data/lib/basecamp3/models/campfire.rb +42 -0
- data/lib/basecamp3/models/campfire_line.rb +52 -0
- data/lib/basecamp3/models/comment.rb +65 -0
- data/lib/basecamp3/models/document.rb +71 -0
- data/lib/basecamp3/models/forward.rb +40 -0
- data/lib/basecamp3/models/inbox.rb +31 -0
- data/lib/basecamp3/models/message.rb +73 -0
- data/lib/basecamp3/models/message_board.rb +31 -0
- data/lib/basecamp3/models/message_type.rb +68 -0
- data/lib/basecamp3/models/person.rb +46 -0
- data/lib/basecamp3/models/project.rb +70 -0
- data/lib/basecamp3/models/question.rb +43 -0
- data/lib/basecamp3/models/question_answer.rb +35 -0
- data/lib/basecamp3/models/questionnaire.rb +31 -0
- data/lib/basecamp3/models/schedule.rb +31 -0
- data/lib/basecamp3/models/schedule_entry.rb +93 -0
- data/lib/basecamp3/models/todo.rb +108 -0
- data/lib/basecamp3/models/todo_list.rb +77 -0
- data/lib/basecamp3/models/todo_set.rb +33 -0
- data/lib/basecamp3/models/vault.rb +79 -0
- data/lib/basecamp3/request.rb +163 -0
- data/lib/basecamp3/response_parser.rb +44 -0
- data/lib/basecamp3/type_mapper.rb +53 -0
- data/lib/basecamp3/version.rb +3 -0
- metadata +202 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
# A model for Basecamp's Document
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/documents.md#documents For more information, see the official Basecamp3 API documentation for Documents}
|
4
|
+
class Basecamp3::Document < Basecamp3::Model
|
5
|
+
include Basecamp3::Concerns::Creatorable
|
6
|
+
include Basecamp3::Concerns::Bucketable
|
7
|
+
include Basecamp3::Concerns::Parentable
|
8
|
+
include Basecamp3::Concerns::Recordingable
|
9
|
+
include Basecamp3::Concerns::Commentable
|
10
|
+
|
11
|
+
attr_accessor :id,
|
12
|
+
:status,
|
13
|
+
:created_at,
|
14
|
+
:updated_at,
|
15
|
+
:title,
|
16
|
+
:content
|
17
|
+
|
18
|
+
REQUIRED_FIELDS = %w(title content)
|
19
|
+
|
20
|
+
# Returns a paginated list of active documents.
|
21
|
+
#
|
22
|
+
# @param [Integer] bucket_id the id of the bucket
|
23
|
+
# @param [Integer] parent_id the id of the parent
|
24
|
+
# @param [Hash] params additional parameters
|
25
|
+
# @option params [Integer] :page (optional) to paginate results
|
26
|
+
#
|
27
|
+
# @return [Array<Basecamp3::Document>]
|
28
|
+
def self.all(bucket_id, parent_id, params = {})
|
29
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/vaults/#{parent_id}/documents", params, Basecamp3::Document)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the document.
|
33
|
+
#
|
34
|
+
# @param [Integer] bucket_id the id of the bucket
|
35
|
+
# @param [Integer] id the id of the document
|
36
|
+
#
|
37
|
+
# @return [Basecamp3::Document]
|
38
|
+
def self.find(bucket_id, id)
|
39
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/documents/#{id}", {}, Basecamp3::Document)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Creates a document.
|
43
|
+
#
|
44
|
+
# @param [Integer] bucket_id the id of the bucket
|
45
|
+
# @param [Integer] parent_id the id of the parent
|
46
|
+
# @param [Hash] data the data to create a Document with
|
47
|
+
# @option params [Integer] :title (required) the title of the document
|
48
|
+
# @option params [String] :content (required) the body of the document
|
49
|
+
# @option params [String] :status (optional) set to active to publish immediately
|
50
|
+
#
|
51
|
+
# @return [Basecamp3::Document]
|
52
|
+
def self.create(bucket_id, parent_id, data)
|
53
|
+
self.validate_required(data)
|
54
|
+
Basecamp3.request.post("/buckets/#{bucket_id}/vaults/#{parent_id}/documents", data, Basecamp3::Document)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Updates the document.
|
58
|
+
#
|
59
|
+
# @param [Integer] bucket_id the id of the bucket
|
60
|
+
# @param [Integer] id the id of the document
|
61
|
+
# @param [Hash] data the data to update the document with
|
62
|
+
# @option params [Integer] :title (required) the title of the document
|
63
|
+
# @option params [String] :content (required) the body of the document
|
64
|
+
# @option params [String] :status (optional) set to active to publish immediately
|
65
|
+
#
|
66
|
+
# @return [Basecamp3::Document]
|
67
|
+
def self.update(bucket_id, id, data)
|
68
|
+
self.validate_required(data)
|
69
|
+
Basecamp3.request.put("/buckets/#{bucket_id}/documents/#{id}", data, Basecamp3::Document)
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# A model for Basecamp's Forward
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/forwards.md#forwards For more information, see the official Basecamp3 API documentation for Forwards}
|
4
|
+
class Basecamp3::Forward < Basecamp3::Model
|
5
|
+
include Basecamp3::Concerns::Creatorable
|
6
|
+
include Basecamp3::Concerns::Bucketable
|
7
|
+
include Basecamp3::Concerns::Parentable
|
8
|
+
include Basecamp3::Concerns::Recordingable
|
9
|
+
|
10
|
+
attr_accessor :id,
|
11
|
+
:status,
|
12
|
+
:created_at,
|
13
|
+
:updated_at,
|
14
|
+
:subject,
|
15
|
+
:content,
|
16
|
+
:from,
|
17
|
+
:replies_count
|
18
|
+
|
19
|
+
# Returns a paginated list of active forwards.
|
20
|
+
#
|
21
|
+
# @param [Integer] bucket_id the id of the bucket
|
22
|
+
# @param [Integer] parent_id the id of the inbox
|
23
|
+
# @param [Hash] params additional parameters
|
24
|
+
# @option params [Integer] :page (optional) to paginate results
|
25
|
+
#
|
26
|
+
# @return [Array<Basecamp3::Forward>]
|
27
|
+
def self.all(bucket_id, parent_id, params = {})
|
28
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/inboxes/#{parent_id}/forwards", params, Basecamp3::Forward)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns the forward.
|
32
|
+
#
|
33
|
+
# @param [Integer] bucket_id the id of the bucket
|
34
|
+
# @param [Integer] id the id of the forward
|
35
|
+
#
|
36
|
+
# @return [Basecamp3::Forward]
|
37
|
+
def self.find(bucket_id, id)
|
38
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/inbox_forwards/#{id}", {}, Basecamp3::Forward)
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# A model for Basecamp's Inbox
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/inboxes.md#inboxes For more information, see the official Basecamp3 API documentation for Inboxes}
|
4
|
+
class Basecamp3::Inbox < Basecamp3::Model
|
5
|
+
include Basecamp3::Concerns::Creatorable
|
6
|
+
include Basecamp3::Concerns::Bucketable
|
7
|
+
|
8
|
+
attr_accessor :id,
|
9
|
+
:status,
|
10
|
+
:created_at,
|
11
|
+
:updated_at,
|
12
|
+
:title,
|
13
|
+
:forwards_count
|
14
|
+
|
15
|
+
# Returns a list of related forwards.
|
16
|
+
#
|
17
|
+
# @return [Array<Basecamp3::Forward>]
|
18
|
+
def forwards
|
19
|
+
@mapped_forwards ||= Basecamp3::Forward.all(bucket.id, id)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns the inbox.
|
23
|
+
#
|
24
|
+
# @param [Integer] bucket_id the id of the bucket
|
25
|
+
# @param [Integer] id the id of the inbox
|
26
|
+
#
|
27
|
+
# @return [Basecamp3::Inbox]
|
28
|
+
def self.find(bucket_id, id)
|
29
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/inboxes/#{id}", {}, Basecamp3::Inbox)
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# A model for Basecamp's Message
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/messages.md#messages For more information, see the official Basecamp3 API documentation for Messages}
|
4
|
+
class Basecamp3::Message < Basecamp3::Model
|
5
|
+
include Basecamp3::Concerns::Creatorable
|
6
|
+
include Basecamp3::Concerns::Bucketable
|
7
|
+
include Basecamp3::Concerns::Parentable
|
8
|
+
include Basecamp3::Concerns::Recordingable
|
9
|
+
include Basecamp3::Concerns::Commentable
|
10
|
+
|
11
|
+
attr_accessor :id,
|
12
|
+
:status,
|
13
|
+
:created_at,
|
14
|
+
:updated_at,
|
15
|
+
:subject,
|
16
|
+
:content
|
17
|
+
|
18
|
+
REQUIRED_FIELDS = %w(subject)
|
19
|
+
|
20
|
+
# Returns a paginated list of active messages.
|
21
|
+
#
|
22
|
+
# @param [Integer] bucket_id the id of the bucket
|
23
|
+
# @param [Integer] parent_id the id of the message board
|
24
|
+
# @param [Hash] params additional parameters
|
25
|
+
# @option params [Integer] :page (optional) to paginate results
|
26
|
+
#
|
27
|
+
# @return [Array<Basecamp3::Message>]
|
28
|
+
def self.all(bucket_id, parent_id, params = {})
|
29
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/message_boards/#{parent_id}/messages", params, Basecamp3::Message)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the message.
|
33
|
+
#
|
34
|
+
# @param [Integer] bucket_id the id of the bucket
|
35
|
+
# @param [Integer] id the id of the message
|
36
|
+
#
|
37
|
+
# @return [Basecamp3::Message]
|
38
|
+
def self.find(bucket_id, id)
|
39
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/messages/#{id}", {}, Basecamp3::Message)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Creates a message.
|
43
|
+
#
|
44
|
+
# @param [Integer] bucket_id the id of the bucket
|
45
|
+
# @param [Integer] parent_id the id of the message board
|
46
|
+
# @param [Hash] data the data to create a message with
|
47
|
+
# @option params [Integer] :subject (required) the title of the message
|
48
|
+
# @option params [String] :status (required) set to active to publish immediately
|
49
|
+
# @option params [String] :content (optional) the body of the message
|
50
|
+
# @option params [Integer] :category_id (optional) to set a type for the message
|
51
|
+
#
|
52
|
+
# @return [Basecamp3::Message]
|
53
|
+
def self.create(bucket_id, parent_id, data)
|
54
|
+
self.validate_required(data)
|
55
|
+
Basecamp3.request.post("/buckets/#{bucket_id}/message_boards/#{parent_id}/messages", data, Basecamp3::Message)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Updates the message.
|
59
|
+
#
|
60
|
+
# @param [Integer] bucket_id the id of the bucket
|
61
|
+
# @param [Integer] id the id of the message
|
62
|
+
# @param [Hash] data the data to update the message with
|
63
|
+
# @option params [Integer] :subject (required) the title of the message
|
64
|
+
# @option params [String] :status (required) set to active to publish immediately
|
65
|
+
# @option params [String] :content (optional) the body of the message
|
66
|
+
# @option params [Integer] :category_id (optional) to set a type for the message
|
67
|
+
#
|
68
|
+
# @return [Basecamp3::Message]
|
69
|
+
def self.update(bucket_id, id, data)
|
70
|
+
self.validate_required(data)
|
71
|
+
Basecamp3.request.put("/buckets/#{bucket_id}/messages/#{id}", data, Basecamp3::Message)
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# A model for Basecamp's Message Board
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/message_boards.md#message-boards For more information, see the official Basecamp3 API documentation for Message boards}
|
4
|
+
class Basecamp3::MessageBoard < Basecamp3::Model
|
5
|
+
include Basecamp3::Concerns::Creatorable
|
6
|
+
include Basecamp3::Concerns::Bucketable
|
7
|
+
|
8
|
+
attr_accessor :id,
|
9
|
+
:status,
|
10
|
+
:created_at,
|
11
|
+
:updated_at,
|
12
|
+
:title,
|
13
|
+
:messages_count
|
14
|
+
|
15
|
+
# Returns a list of related messages.
|
16
|
+
#
|
17
|
+
# @return [Array<Basecamp3::Message>]
|
18
|
+
def messages
|
19
|
+
@mapped_messages ||= Basecamp3::Message.all(bucket.id, id)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns the message board.
|
23
|
+
#
|
24
|
+
# @param [Integer] bucket_id the id of the bucket
|
25
|
+
# @param [Integer] id the id of the message board
|
26
|
+
#
|
27
|
+
# @return [Basecamp3::MessageBoard]
|
28
|
+
def self.find(bucket_id, id)
|
29
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/message_boards/#{id}", {}, Basecamp3::MessageBoard)
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# A model for Basecamp's Message Board
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md#get-message-types For more information, see the official Basecamp3 API documentation for Message types}
|
4
|
+
class Basecamp3::MessageType < Basecamp3::Model
|
5
|
+
attr_accessor :id,
|
6
|
+
:created_at,
|
7
|
+
:updated_at,
|
8
|
+
:name,
|
9
|
+
:icon
|
10
|
+
|
11
|
+
REQUIRED_FIELDS = %w(name icon)
|
12
|
+
|
13
|
+
# Returns a list of all the message types.
|
14
|
+
#
|
15
|
+
# @param [Integer] bucket_id the id of the bucket
|
16
|
+
#
|
17
|
+
# @return [Array<Basecamp3::MessageType>]
|
18
|
+
def self.all(bucket_id)
|
19
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/categories", {}, Basecamp3::MessageType)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns the message type.
|
23
|
+
#
|
24
|
+
# @param [Integer] bucket_id the id of the bucket
|
25
|
+
# @param [Integer] id the id of the message type
|
26
|
+
#
|
27
|
+
# @return [Basecamp3::MessageType]
|
28
|
+
def self.find(bucket_id, id)
|
29
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/categories/#{id}", {}, Basecamp3::MessageType)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Creates a message type.
|
33
|
+
#
|
34
|
+
# @param [Integer] bucket_id the id of the bucket
|
35
|
+
# @param [Hash] data the data to create a message type with
|
36
|
+
# @option params [String] :name (required) the name of the message type
|
37
|
+
# @option params [String] :icon (required) the icon of the message type
|
38
|
+
#
|
39
|
+
# @return [Basecamp3::MessageType]
|
40
|
+
def self.create(bucket_id, data)
|
41
|
+
self.validate_required(data)
|
42
|
+
Basecamp3.request.post("/buckets/#{bucket_id}/categories", data, Basecamp3::MessageType)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Updates a message type.
|
46
|
+
#
|
47
|
+
# @param [Integer] bucket_id the id of the bucket
|
48
|
+
# @param [Integer] id the id of the message type
|
49
|
+
# @param [Hash] data the data to update the message type with
|
50
|
+
# @option params [String] :name (required) the name of the message type
|
51
|
+
# @option params [String] :icon (required) the icon of the message type
|
52
|
+
#
|
53
|
+
# @return [Basecamp3::MessageType]
|
54
|
+
def self.update(bucket_id, id, data)
|
55
|
+
self.validate_required(data)
|
56
|
+
Basecamp3.request.put("/buckets/#{bucket_id}/categories/#{id}", data, Basecamp3::MessageType)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Deletes the message type.
|
60
|
+
#
|
61
|
+
# @param [Integer] bucket_id the id of the bucket
|
62
|
+
# @param [Integer] id the id of the message type
|
63
|
+
#
|
64
|
+
# @return [Boolean]
|
65
|
+
def self.delete(bucket_id, id)
|
66
|
+
Basecamp3.request.delete("/buckets/#{bucket_id}/categories/#{id}")
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# A model for Basecamp's Message Person
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/people.md#people For more information, see the official Basecamp3 API documentation for People}
|
4
|
+
class Basecamp3::Person < Basecamp3::Model
|
5
|
+
attr_accessor :id,
|
6
|
+
:name,
|
7
|
+
:title,
|
8
|
+
:email_address,
|
9
|
+
:bio,
|
10
|
+
:avatar_url,
|
11
|
+
:admin,
|
12
|
+
:owner,
|
13
|
+
:time_zone,
|
14
|
+
:created_at,
|
15
|
+
:updated_at
|
16
|
+
|
17
|
+
# Returns a list of all people visible to the current user.
|
18
|
+
#
|
19
|
+
# @return [Array<Basecamp3::Person>]
|
20
|
+
def self.all
|
21
|
+
Basecamp3.request.get("/people", {}, Basecamp3::Person)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns a list of all people who can be pinged.
|
25
|
+
#
|
26
|
+
# @return [Array<Basecamp3::Person>]
|
27
|
+
def self.pingable
|
28
|
+
Basecamp3.request.get("/circles/people", {}, Basecamp3::Person)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns the person.
|
32
|
+
#
|
33
|
+
# @param [Integer] id the id of the person
|
34
|
+
#
|
35
|
+
# @return [Basecamp3::Person]
|
36
|
+
def self.find(id)
|
37
|
+
Basecamp3.request.get("/people/#{id}", {}, Basecamp3::Person)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns the current user's personal info..
|
41
|
+
#
|
42
|
+
# @return [Basecamp3::Person]
|
43
|
+
def self.me
|
44
|
+
Basecamp3.request.get("/my/profile", {}, Basecamp3::Person)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# A model for Basecamp's Project (Basecamp)
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/basecamps.md#basecamps For more information, see the official Basecamp3 API documentation for Basecamps}
|
4
|
+
class Basecamp3::Project < Basecamp3::Model
|
5
|
+
attr_accessor :id,
|
6
|
+
:status,
|
7
|
+
:created_at,
|
8
|
+
:updated_at,
|
9
|
+
:name,
|
10
|
+
:description,
|
11
|
+
:bookmarked
|
12
|
+
|
13
|
+
REQUIRED_FIELDS = %w(name)
|
14
|
+
|
15
|
+
# Returns a paginated list of active projects (basecamps) visible to the current user sorted by most recently
|
16
|
+
# created project (basecamp) first.
|
17
|
+
#
|
18
|
+
# @param [Hash] params additional parameters
|
19
|
+
# @option params [Integer] :page (optional) to paginate results
|
20
|
+
# @option params [String] :status (optional) when set to archived or trashed,
|
21
|
+
# will return archived or trashed projects (basecamps) visible to the current user
|
22
|
+
#
|
23
|
+
# @return [Array<Basecamp3::Project>]
|
24
|
+
def self.all(params = {})
|
25
|
+
Basecamp3.request.get("/projects", params, Basecamp3::Project)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns the project (basecamp).
|
29
|
+
#
|
30
|
+
# @param [Integer] id the id of the project
|
31
|
+
#
|
32
|
+
# @return [Basecamp3::Project]
|
33
|
+
def self.find(id)
|
34
|
+
Basecamp3.request.get("/projects/#{id}", {}, Basecamp3::Project)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Creates a project.
|
38
|
+
#
|
39
|
+
# @param [Hash] data the data to create a project with
|
40
|
+
# @option params [String] :name (required) the name of the project
|
41
|
+
# @option params [String] :description (optional) the description of the project
|
42
|
+
#
|
43
|
+
# @return [Basecamp3::Project]
|
44
|
+
def self.create(data)
|
45
|
+
self.validate_required(data)
|
46
|
+
Basecamp3.request.post("/projects", data, Basecamp3::Project)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Updates the project.
|
50
|
+
#
|
51
|
+
# @param [Integer] id the id of the project
|
52
|
+
# @param [Hash] data the data to update the project with
|
53
|
+
# @option params [String] :name (required) the name of the project
|
54
|
+
# @option params [String] :description (optional) the description of the project
|
55
|
+
#
|
56
|
+
# @return [Basecamp3::Project]
|
57
|
+
def self.update(id, data)
|
58
|
+
self.validate_required(data)
|
59
|
+
Basecamp3.request.put("/projects/#{id}", data, Basecamp3::Project)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Deletes the project.
|
63
|
+
#
|
64
|
+
# @param [Integer] id the id of the project
|
65
|
+
#
|
66
|
+
# @return [Boolean]
|
67
|
+
def self.delete(id)
|
68
|
+
Basecamp3.request.delete("/projects/#{id}")
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# A model for Basecamp's Question
|
2
|
+
#
|
3
|
+
# {https://github.com/basecamp/bc3-api/blob/master/sections/questions.md#questions For more information, see the official Basecamp3 API documentation for Questions}
|
4
|
+
class Basecamp3::Question < Basecamp3::Model
|
5
|
+
include Basecamp3::Concerns::Creatorable
|
6
|
+
include Basecamp3::Concerns::Bucketable
|
7
|
+
include Basecamp3::Concerns::Parentable
|
8
|
+
|
9
|
+
attr_accessor :id,
|
10
|
+
:status,
|
11
|
+
:created_at,
|
12
|
+
:updated_at,
|
13
|
+
:title,
|
14
|
+
:paused,
|
15
|
+
:answers_count
|
16
|
+
|
17
|
+
# Returns a list of related answers.
|
18
|
+
#
|
19
|
+
# @return [Array<Basecamp3::QuestionAnswer>]
|
20
|
+
def answers
|
21
|
+
@mapped_answers ||= Basecamp3::QuestionAnswer.all(bucket.id, id)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns a paginated list of questions.
|
25
|
+
#
|
26
|
+
# @param [Hash] params additional parameters
|
27
|
+
# @option params [Integer] :page (optional) to paginate results
|
28
|
+
#
|
29
|
+
# @return [Array<Basecamp3::Question>]
|
30
|
+
def self.all(bucket_id, parent_id, params = {})
|
31
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/questionnaires/#{parent_id}/questions", params, Basecamp3::Question)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the question.
|
35
|
+
#
|
36
|
+
# @param [Integer] bucket_id the id of the bucket
|
37
|
+
# @param [Integer] id the id of the question
|
38
|
+
#
|
39
|
+
# @return [Basecamp3::Question]
|
40
|
+
def self.find(bucket_id, id)
|
41
|
+
Basecamp3.request.get("/buckets/#{bucket_id}/questions/#{id}", {}, Basecamp3::Question)
|
42
|
+
end
|
43
|
+
end
|