Class: Convore::Message

Inherits:
Base
  • Object
show all
Defined in:
lib/convore/message.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes, #password, #username

Instance Method Summary collapse

Methods inherited from Base

api, find, from_json, get_class, #method_missing

Constructor Details

#initialize(username, password) ⇒ Message

Returns a new instance of Message.



4
5
6
7
# File 'lib/convore/message.rb', line 4

def initialize(username, password)
	@username = username
	@password = password
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Convore::Base

Instance Method Details

#delete_message(message_id) ⇒ Object

Delete a message. You must be the creator of the message or a group admin in order to delete the message.



18
19
20
21
22
# File 'lib/convore/message.rb', line 18

def delete_message(message_id)
	if message_id.integer?
		RestClient.post "https://#{@username}:#{@password}@convore.com/api/messages/#{message_id}/delete.json", {}
	end
end

#star_message(message_id) ⇒ Object

Star a message. If the message has already been starred by this user, this endpoint will then unstar the message.



11
12
13
14
15
# File 'lib/convore/message.rb', line 11

def star_message(message_id)
	if message_id.integer?
		RestClient.post "https://#{@username}:#{@password}@convore.com/api/messages/#{message_id}/star.json", {}
	end
end