class Slacks::User

Attributes

email[R]
first_name[R]
id[R]
last_name[R]
slack[R]
username[R]

Public Class Methods

new(slack, attributes={}) click to toggle source
# File lib/slacks/user.rb, line 5
def initialize(slack, attributes={})
  @slack = slack

  profile = attributes["profile"]
  @id = attributes["id"]
  @username = attributes["name"]
  @email = profile["email"]
  @first_name = profile["first_name"]
  @last_name = profile["last_name"]
end

Public Instance Methods

==(other) click to toggle source
# File lib/slacks/user.rb, line 28
def ==(other)
  self.class == other.class && self.id == other.id
end
inspect() click to toggle source
# File lib/slacks/user.rb, line 20
def inspect
  "<Slacks::User id=\"#{id}\" name=\"#{name}\">"
end
name() click to toggle source
# File lib/slacks/user.rb, line 16
def name
  "#{first_name} #{last_name}"
end
to_s() click to toggle source
# File lib/slacks/user.rb, line 24
def to_s
  "@#{username}"
end