Sha256: 9d2675b48111bfae75b1b251fab3d2f80a116837df569fca2b1c83bf15080b15

Contents?: true

Size: 485 Bytes

Versions: 2

Compression:

Stored size: 485 Bytes

Contents

class YouTrack::Client::User < YouTrack::Client::Model
  identity :id, aliases: ["email"]

  attribute :name, alias: "fullName"
  attribute :last_created_project, aliases: ["lastCreatedProject"]

  def admin? # just try to make a request to the admin api and see what happens
    return @admin if defined?(@admin) # i love how ||= doesn't work when a variable is false
    @admin = !!service.get_admin_user(self.id).body
  rescue Faraday::ResourceNotFound
    @admin = false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
you_track-0.4.2 lib/you_track/client/models/user.rb
you_track-0.4.1 lib/you_track/client/models/user.rb