Class: Bio::BaseSpace::Project
- Defined in:
- lib/basespace/model/project.rb
Overview
Represents a BaseSpace Project object.
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
-
#create_app_result(api, name, desc, app_session_id = nil, samples = []) ⇒ Object
Return a newly created AppResult object.
-
#get_access_str(scope = 'write') ⇒ Object
Returns the scope-string to be used for requesting BaseSpace access to the object.
-
#get_app_results(api, my_qp = {}, statuses = []) ⇒ Object
Returns a list of AppResult objects.
-
#get_samples(api) ⇒ Object
Returns a list of Sample objects.
-
#initialize ⇒ Project
constructor
Create a new Project instance.
-
#is_init ⇒ Object
Test if the Project instance has been initialized.
-
#to_s ⇒ Object
Returns the name and ID of the project.
Methods inherited from Model
#get_attr, #method_missing, #set_attr
Constructor Details
#initialize ⇒ Project
Create a new Project instance.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# 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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Bio::BaseSpace::Model
Instance Method Details
#create_app_result(api, name, desc, app_session_id = nil, samples = []) ⇒ Object
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.
94 95 96 97 |
# 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') ⇒ Object
Returns the scope-string to be used for requesting BaseSpace access to the object.
scope
-
The scope-type that is requested (write|read).
63 64 65 66 |
# 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 = []) ⇒ Object
Returns a list of AppResult objects.
api
-
BaseSpaceAPI instance.
my_qp
-
Query parameters for filtering the returned list.
statuses
-
An optional list of statuses.
73 74 75 76 77 |
# 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) ⇒ Object
Returns a list of Sample objects.
api
-
BaseSpaceAPI instance.
82 83 84 85 |
# 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 ⇒ Object
Test if the Project instance has been initialized.
Throws ModelNotInitializedError, if the object has not been populated yet.
56 57 58 |
# 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 ⇒ Object
Returns the name and ID of the project.
49 50 51 |
# File 'lib/basespace/model/project.rb', line 49 def to_s return "#{get_attr('Name')} - id=#{get_attr('Id')}" end |