Class: Convore::Account

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

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

api, find, from_json, get_class, #method_missing

Constructor Details

#initialize(username, password) ⇒ Account

Returns a new instance of Account.



7
8
9
10
# File 'lib/convore/account.rb', line 7

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 Attribute Details

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#usernameObject

Returns the value of attribute username.



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

def username
  @username
end

Instance Method Details

#get_members_onlineObject

Get members online now



23
24
25
# File 'lib/convore/account.rb', line 23

def get_members_online
	RestClient.get "https://#{@username}:#{@password}@convore.com/api/account/online.json"
end

#get_mentionsObject

Get the users mentions



28
29
30
# File 'lib/convore/account.rb', line 28

def get_mentions
	RestClient.get "https://#{@username}:#{@password}@convore.com/api/account/online.json"
end

#mark_all_readObject

Mark all messages as read



18
19
20
# File 'lib/convore/account.rb', line 18

def mark_all_read
	RestClient.post "https://#{@username}:#{@password}@convore.com/api/account/mark_read.json", {}
end

#verified?Boolean

Use this method to check if the user is properly logged in (also get user id)

Returns:

  • (Boolean)


13
14
15
# File 'lib/convore/account.rb', line 13

def verified?
	RestClient.get "https://#{@username}:#{@password}@convore.com/api/account/verify.json"
end