Sha256: 19be9da9148bb3429fbbe307003c6c1c4eb06cc3edf5f80e7a1b39a05977f2a7

Contents?: true

Size: 685 Bytes

Versions: 12

Compression:

Stored size: 685 Bytes

Contents

module Slacks
  class User
    attr_reader :id, :username, :email, :first_name, :last_name

    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

    def name
      "#{first_name} #{last_name}"
    end

    def inspect
      "<Slacks::User id=\"#{id}\" name=\"#{name}\">"
    end

    def to_s
      "@#{username}"
    end

    def ==(other)
      self.class == other.class && self.id == other.id
    end

  private
    attr_reader :slack
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
slacks-0.6.4 lib/slacks/user.rb
slacks-0.6.3 lib/slacks/user.rb
slacks-0.6.2 lib/slacks/user.rb
slacks-0.6.1 lib/slacks/user.rb
slacks-0.6.0 lib/slacks/user.rb
slacks-0.5.0 lib/slacks/user.rb
slacks-0.5.0.pre lib/slacks/user.rb
slacks-0.4.4 lib/slacks/user.rb
slacks-0.4.3 lib/slacks/user.rb
slacks-0.4.2 lib/slacks/user.rb
slacks-0.4.1 lib/slacks/user.rb
slacks-0.4.0 lib/slacks/user.rb