class Bio::BaseSpace::Project

Represents a BaseSpace Project object.

Public Class Methods

new() click to toggle source

Create a new Project instance.

# File lib/basespace/model/project.rb, line 25
def initialize
  @swagger_types = {
    'Name'            => 'str',
    'HrefSamples'     => 'str',
    'HrefAppResults'  => 'str',
    'HrefBaseSpaceUI' => 'str',
    'DateCreated'     => 'datetime',
    'Id'              => 'str',
    'Href'            => 'str',
    'UserOwnedBy'     => 'UserCompact',
  }
  @attributes = {
    'Name'            => nil, # str
    'HrefSamples'     => nil, # str
    'HrefAppResults'  => nil, # str
    'HrefBaseSpaceUI' => nil, # str
    'DateCreated'     => nil, # datetime
    'Id'              => nil, # str
    'Href'            => nil, # str
    'UserOwnedBy'     => nil, # UserCompact
  }
end

Public Instance Methods

create_app_result(api, name, desc, app_session_id = nil, samples = []) click to toggle source

Return a newly created AppResult object.

api

BaseSpaceAPI instance.

name

The name of the AppResult.

desc

A description of the AppResult.

app_session_id

An App session ID.

samples

A list of samples.

# File lib/basespace/model/project.rb, line 94
def create_app_result(api, name, desc, app_session_id = nil, samples = [])
  is_init
  return api.create_app_result(get_attr('Id'), name, desc, samples, app_session_id)
end
get_access_str(scope = 'write') click to toggle source

Returns the scope-string to be used for requesting BaseSpace access to the object.

scope

The scope-type that is requested (write|read).

# File lib/basespace/model/project.rb, line 63
def get_access_str(scope = 'write')
  is_init
  return scope + ' project ' + get_attr('Id').to_s
end
get_app_results(api, my_qp = {}, statuses = []) click to toggle source

Returns a list of AppResult objects.

api

BaseSpaceAPI instance.

my_qp

Query parameters for filtering the returned list.

statuses

An optional list of statuses.

# File lib/basespace/model/project.rb, line 73
def get_app_results(api, my_qp = {}, statuses = [])
  is_init
  query_pars = QueryParameters.new(my_qp)
  return api.get_app_results_by_project(get_attr('Id'), query_pars, statuses)
end
get_samples(api) click to toggle source

Returns a list of Sample objects.

api

BaseSpaceAPI instance.

# File lib/basespace/model/project.rb, line 82
def get_samples(api)
  is_init
  return api.get_samples_by_project(get_attr('Id'))
end
is_init() click to toggle source

Test if the Project instance has been initialized.

Throws ModelNotInitializedError, if the object has not been populated yet.

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

Returns the name and ID of the project.

# File lib/basespace/model/project.rb, line 49
def to_s
  return "#{get_attr('Name')} - id=#{get_attr('Id')}"
end