Class: Basecamp::Message
- Defined in:
- lib/basecamp/message.rb
Overview
Model format <post> <id type=“integer”>#id</id> <title>#title</title> <body>#body</body> <display-body>#display_body</display-body> <posted-on type=“datetime”>#posted_on</posted-on> <commented-at type=“datetime”>#commented_at</commented-at> <project-id type=“integer”>#project_id</project-id> <category-id type=“integer”>#category_id</category-id> <author-id type=“integer”>#author_id</author-id> <author-name>#author_name</author-name> <milestone-id type=“integer”>#milestone_id</milestone-id> <comments-count type=“integer”>#comments_count</comments-count> <use-textile type=“boolean”>#use_textile</use-textile> <extended-body deprecated=“true”>#extended_body</extended-body> <display-extended-body deprecated=“true”>#display_extended_body</display-extended-body>
<attachments-count type=“integer”>#attachments_count</attachments-count> <attachments type=“array”>
<attachment>
...
</attachment>
...
</attachments>
<!– if user can see private posts –> <private type=“boolean”>#private</private> </post>
Class Method Summary collapse
-
.archived(project_id) ⇒ Object
Get archived messages from a project.
-
.in_project(project_id) ⇒ Object
Get all messages from a project.
-
.in_project_by_category(project_id, category_id) ⇒ Object
Get archived messages a project and a specific category.
Instance Method Summary collapse
Methods inherited from Base
Class Method Details
.archived(project_id) ⇒ Object
Get archived messages from a project
47 48 49 |
# File 'lib/basecamp/message.rb', line 47 def archived(project_id) find(:all, :from => "/projects/#{project_id}/posts/archive.xml") end |
.in_project(project_id) ⇒ Object
Get all messages from a project
37 38 39 |
# File 'lib/basecamp/message.rb', line 37 def in_project(project_id) find(:all, :from => "/projects/#{project_id}/posts.xml") end |
.in_project_by_category(project_id, category_id) ⇒ Object
Get archived messages a project and a specific category
42 43 44 |
# File 'lib/basecamp/message.rb', line 42 def in_project_by_category(project_id, category_id) find(:all, :from => "/projects/#{project_id}/cat/#{category_id}/posts.xml") end |
Instance Method Details
#encode(options = {}) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/basecamp/message.rb', line 57 def encode(={}) if known_attributes.include?('notify') encoded = send("to_#{self.class.format.extension}", ) notifies = notify.inject("") { |acc, n| acc += %(<notify type="integer">#{n}</notify>\n) } "<request>" + encoded + notifies + "</request>" else super end end |