class OTX::Users
Search for, subscribe to, unsubscribe from, follow and unfollow users
Public Instance Methods
action(username, action)
click to toggle source
follow(username)
click to toggle source
me()
click to toggle source
Validate your API Key configuration. If valid, some basic information about the user account corresponding to the API Key supplied will be returned.
@return [OTX::User] Parsed User
# File lib/otx_ruby/users.rb, line 11 def me uri = "/api/v1/users/me" json_data = get(uri) user = OTX::User.new(json_data) return user end
search(query, limit = 10, page = 1, sort = :username)
click to toggle source
Search for Users
by username
@param query [String] Full or partial username to search @param limit [Integer] Limit results per page to this number @param page [Integer] Return results for this page @param sort [Symbol] Sort results by username or pulse_count @return [Array<OTX::User>] Parsed Users
# File lib/otx_ruby/users.rb, line 30 def search(query, limit = 10, page = 1, sort = :username) uri = '/api/v1/search/users' params = { q: query, limit: limit, page: page, sort: sort == :pulse_count ? 'pulse_count' : 'username' } results = [] json_data = get(uri, params) json_data['results'].each do |user| results << OTX::User.new(user) end return results end
subscribe_to(username)
click to toggle source
unfollow(username)
click to toggle source