class Podio::Conversation

@see developers.podio.com/doc/conversations

Public Class Methods

add_participant(conversation_id, user_id) click to toggle source
# File lib/podio/models/conversation.rb, line 121
def add_participant(conversation_id, user_id)
  response = Podio.connection.post do |req|
    req.url "/conversation/#{conversation_id}/participant/"
    req.body = { :user_id => user_id }
  end
  response.body
end
add_participants(conversation_id, participants) click to toggle source

@see developers.podio.com/doc/conversations/add-participants-384261

# File lib/podio/models/conversation.rb, line 113
def add_participants(conversation_id, participants)
  response = Podio.connection.post do |req|
    req.url "/conversation/#{conversation_id}/participant/"
    req.body = { :participants => participants }
  end
  response.body
end
create(attributes) click to toggle source

@see developers.podio.com/doc/conversations/create-conversation-v2-37301474

# File lib/podio/models/conversation.rb, line 86
def create(attributes)
  response = Podio.connection.post do |req|
    req.url '/conversation/v2/'
    req.body = attributes
  end
  member response.body
end
create_for_reference(ref_type, ref_id, attributes) click to toggle source

@see developers.podio.com/doc/conversations/create-conversation-on-object-22442

# File lib/podio/models/conversation.rb, line 95
def create_for_reference(ref_type, ref_id, attributes)
  response = Podio.connection.post do |req|
    req.url "/conversation/#{ref_type}/#{ref_id}/"
    req.body = attributes
  end
  response.body
end
create_reply(conversation_id, text, file_ids=[], embed_id=nil, embed_file_id=nil) click to toggle source

@see developers.podio.com/doc/conversations/reply-to-conversation-22444

# File lib/podio/models/conversation.rb, line 104
def create_reply(conversation_id, text, file_ids=[], embed_id=nil, embed_file_id=nil)
  response = Podio.connection.post do |req|
    req.url "/conversation/#{conversation_id}/reply"
    req.body = {:text => text, :file_ids => file_ids, :embed_id => embed_id, :embed_file_id => embed_file_id}
  end
  response.body['message_id']
end
find(conversation_id) click to toggle source

@see developers.podio.com/doc/conversations/get-conversation-22369

# File lib/podio/models/conversation.rb, line 71
def find(conversation_id)
  member Podio.connection.get("/conversation/#{conversation_id}").body
end
find_all(options={}) click to toggle source

@see developers.podio.com/doc/conversations/get-conversations-34822801

# File lib/podio/models/conversation.rb, line 50
def find_all(options={})
  list Podio.connection.get { |req|
    req.url("/conversation/", options)
  }.body
end
find_all_by_flag(flag, options={}) click to toggle source

@see developers.podio.com/doc/conversations/get-flagged-conversations-35466860

# File lib/podio/models/conversation.rb, line 57
def find_all_by_flag(flag, options={})
  list Podio.connection.get { |req|
    req.url("/conversation/#{flag}/", options)
  }.body
end
find_all_for_reference(ref_type, ref_id) click to toggle source

@see developers.podio.com/doc/conversations/get-conversations-on-object-22443

# File lib/podio/models/conversation.rb, line 76
def find_all_for_reference(ref_type, ref_id)
  list Podio.connection.get("/conversation/#{ref_type}/#{ref_id}/").body
end
find_direct_with_user(user_id) click to toggle source

@see developers.podio.com/doc/conversations/get-existing-direct-conversation-44969910

# File lib/podio/models/conversation.rb, line 81
def find_direct_with_user(user_id)
  member Podio.connection.get("/conversation/direct/#{user_id}").body
end
leave(conversation_id) click to toggle source

@see developers.podio.com/doc/conversations/leave-conversation-35483748

# File lib/podio/models/conversation.rb, line 171
def leave(conversation_id)
  Podio.connection.post("/conversation/#{conversation_id}/leave")
end
mark_all_as_read() click to toggle source

@see developers.podio.com/doc/conversations/mark-all-conversations-as-read-38080233

# File lib/podio/models/conversation.rb, line 130
def mark_all_as_read
  Podio.connection.post("/conversation/read").status
end
mark_as_read(conversation_id) click to toggle source

@see developers.podio.com/doc/conversations/mark-conversation-as-read-35441525

# File lib/podio/models/conversation.rb, line 135
def mark_as_read(conversation_id)
  response = Podio.connection.post do |req|
    req.url "/conversation/#{conversation_id}/read"
  end
  response.status
end
mark_as_unread(conversation_id) click to toggle source

@see developers.podio.com/doc/conversations/mark-conversation-as-unread-35441542

# File lib/podio/models/conversation.rb, line 143
def mark_as_unread(conversation_id)
  Podio.connection.delete("/conversation/#{conversation_id}/read").status
end
star(conversation_id) click to toggle source

@see developers.podio.com/doc/conversations/star-conversation-35106944

# File lib/podio/models/conversation.rb, line 148
def star(conversation_id)
  response = Podio.connection.post do |req|
    req.url "/conversation/#{conversation_id}/star"
  end
  response.status
end
starred_count() click to toggle source

@see developers.podio.com/doc/conversations/get-flagged-conversation-counts-35467925

# File lib/podio/models/conversation.rb, line 166
def starred_count
  Podio.connection.get("/conversation/starred/count").body['value']
end
unread_count() click to toggle source

@see developers.podio.com/doc/conversations/get-flagged-conversation-counts-35467925

# File lib/podio/models/conversation.rb, line 161
def unread_count
  Podio.connection.get("/conversation/unread/count").body['value']
end
unstar(conversation_id) click to toggle source

@see developers.podio.com/doc/conversations/unstar-conversation-35106990

# File lib/podio/models/conversation.rb, line 156
def unstar(conversation_id)
  Podio.connection.delete("/conversation/#{conversation_id}/star").status
end

Public Instance Methods

name() click to toggle source

So tasks can refer to ref.name on all types of references

# File lib/podio/models/conversation.rb, line 38
def name
  self.subject || self.excerpt
end
save() click to toggle source
# File lib/podio/models/conversation.rb, line 42
def save
  self[:file_ids] ||= []
  model = self.class.create(self.attributes)
  self.attributes = model.attributes
end