class Dimma::User

Missing method calls are delegated to the underlying RestClient::Resource

Attributes

name[R]

@return [String]

Public Class Methods

new(name, resource) click to toggle source

Create a new User resource.

@param [#to_s] name @param [RestClient::Resource] resource An object conformant with the RestClient API.

# File lib/dimma.rb, line 87
def initialize(name, resource)
  __setobj__ resource["users/#{@name = name.to_s}"]
end

Public Instance Methods

logout() click to toggle source

Force-logout the user.

@return [RestClient::Response]

# File lib/dimma.rb, line 101
def logout
  delete
end
message(message) click to toggle source

Send a message to the user.

@param [#to_json] message Data to send to the user. @return [RestClient::Response] @raise [RestClient::Exception]

# File lib/dimma.rb, line 110
def message(message)
  post message.to_json
end
online?() click to toggle source

True if the user is online.

@return [Boolean]

# File lib/dimma.rb, line 94
def online?
  get.code == 200 rescue false
end