Class: Podio::Conversation
Instance Attribute Summary
#attributes, #error_code, #error_message, #error_parameters, #error_propagate
Class Method Summary
collapse
Instance Method Summary
collapse
#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, #initialize_attributes, list, member, #new_record?, output_attribute_as_json, #persisted?, property, #to_param
Class Method Details
.add_participant(conversation_id, user_id) ⇒ Object
66
67
68
69
70
71
72
|
# File 'lib/podio/models/conversation.rb', line 66
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
|
.create(attributes) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/podio/models/conversation.rb', line 42
def create(attributes)
response = Podio.connection.post do |req|
req.url '/conversation/'
req.body = attributes
end
response.body
end
|
.create_for_reference(ref_type, ref_id, attributes) ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/podio/models/conversation.rb', line 50
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) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/podio/models/conversation.rb', line 58
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) ⇒ Object
34
35
36
|
# File 'lib/podio/models/conversation.rb', line 34
def find(conversation_id)
member Podio.connection.get("/conversation/#{conversation_id}").body
end
|
.find_all_for_reference(ref_type, ref_id) ⇒ Object
38
39
40
|
# File 'lib/podio/models/conversation.rb', line 38
def find_all_for_reference(ref_type, ref_id)
list Podio.connection.get("/conversation/#{ref_type}/#{ref_id}/").body
end
|
Instance Method Details
#save ⇒ Object
25
26
27
28
29
|
# File 'lib/podio/models/conversation.rb', line 25
def save
self[:file_ids] ||= []
response = Conversation.create(self.attributes)
self.conversation_id = response['conversation_id']
end
|