class Bio::BaseSpace::User

User model.

Public Class Methods

new() click to toggle source

Create a new User instance.

# File lib/basespace/model/user.rb, line 24
def initialize
  @swagger_types = {
    'Name'            => 'str',
    'Email'           => 'str',
    'DateLastActive'  => 'datetime',
    'GravatarUrl'     => 'str',
    'HrefProjects'    => 'str',
    'DateCreated'     => 'datetime',
    'Id'              => 'str',
    'Href'            => 'str',
    'HrefRuns'        => 'str',
  }
  @attributes = {
    'Name'            => nil, # str
    'Email'           => nil, # str
    'DateLastActive'  => nil, # datetime
    'GravatarUrl'     => nil, # str
    'HrefProjects'    => nil, # str
    'DateCreated'     => nil, # datetime
    'Id'              => nil, # str
    'Href'            => nil, # str
    'HrefRuns'        => nil, # str
  }
end

Public Instance Methods

get_projects(api) click to toggle source

Get a list of projects for the user.

api

BaseSpaceAPI instance.

# File lib/basespace/model/user.rb, line 64
def get_projects(api)
  is_init
  return api.get_project_by_user(get_attr('Id'))
end
get_runs(api) click to toggle source

Returns a list of accessible runs for the current user.

api

BaseSpaceAPI instance.

# File lib/basespace/model/user.rb, line 72
def get_runs(api)
  is_init
  return api.get_accessible_runs_by_user('current')
end
is_init() click to toggle source

Test if the Project instance has been initialized.

Throws ModelNotInitializedError, if the Id variable is not set.

# File lib/basespace/model/user.rb, line 57
def is_init
  raise ModelNotInitializedError.new('The user model has not been initialized yet') unless get_attr('Id')
end
to_s() click to toggle source

Return the ID and name of the user as string.

# File lib/basespace/model/user.rb, line 50
def to_s
  return "#{get_attr('Id')}: #{get_attr('Name')}"
end