class Gitter::API::User

Model representation of the /user/* REST endpoints in the gitter API

Attributes

display_name[R]

Name of the user

id[R]

ID (from the API)

url[R]

The relative path the the user's page in the gitter webapp

username[R]

Username (minus the '@')

Public Class Methods

new(client, data) click to toggle source

INTERNAL METHOD

Initialize a new Gitter::API::User

Gitter::API::Client#user will return on of these objects, as well as some methods on Gitter::API::Room and when instanciating a Gitter::API::Message, so favor instanciating that way.

Parameters

client (Gitter::API::Client)

Configured client object

data (Hash)

Initialization data

Options

(string keys only)

id (String)

User id

display_name (String)

Gitter/GitHub user real name

username (String)

Gitter/GitHub username (without '@')

url (String)

Path to the user on Gitter

Calls superclass method
# File lib/gitter/api/user.rb, line 42
def initialize client, data
  super

  @id           = data["id"] || data["userId"]
  @display_name = data["displayName"]
  @username     = data["username"] || data["screenName"]
  @url          = data["url"]
end

Public Instance Methods

rooms() click to toggle source

Fetch the all of the room records for a given user

Includes one on one conversations, since those are considered “rooms” as well (based on their schema)

Returns a Gitter::API::Room::Collection

# File lib/gitter/api/user.rb, line 57
def rooms
  data = client.get "#{api_prefix}/rooms"

  Room::Collection.new self, data
end