Class: Teambox::Conversation

Inherits:
Resource show all
Defined in:
lib/teambox-client/models/conversation.rb

Instance Attribute Summary

Attributes inherited from Resource

#data, #list, #references

Instance Method Summary collapse

Methods inherited from Resource

#created_at, #destroy, #id, #initialize, #inspect, #method_missing, #next, #prev, #reload, #save, #updated_at

Methods included from ReferenceList

#generate_references, #get_or_make_reference, #get_or_make_references, #get_reference, #set_reference

Constructor Details

This class inherits a constructor from Teambox::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Teambox::Resource

Instance Method Details

#commentsObject

Gets a Teambox::ResultSet of all Teambox::Comment objects belonging to the conversation



18
19
20
# File 'lib/teambox-client/models/conversation.rb', line 18

def comments
  @list.client.get("#{url}/comments")
end

#first_commentObject

First Teambox::Comment of the conversation



13
14
15
# File 'lib/teambox-client/models/conversation.rb', line 13

def first_comment
  get_or_make_reference('Comment', @data, 'first_comment_id')
end

#recent_commentsObject

Last two Teambox::Comment of the conversation (may include first_comment)



8
9
10
# File 'lib/teambox-client/models/conversation.rb', line 8

def recent_comments
  get_or_make_references('Comment', @data, 'recent_comment_ids')
end

#urlObject

:nodoc:



22
23
24
# File 'lib/teambox-client/models/conversation.rb', line 22

def url #:nodoc:
  "/conversations/#{@data['id']}"
end

#userObject



3
4
5
# File 'lib/teambox-client/models/conversation.rb', line 3

def user
  get_or_make_reference('User', @data, 'user_id')
end