Module: Bio::BaseSpace

Defined in:
lib/bio-basespace-sdk.rb,
lib/basespace/model.rb,
lib/basespace/model/file.rb,
lib/basespace/model/user.rb,
lib/basespace/api/base_api.rb,
lib/basespace/model/sample.rb,
lib/basespace/model/product.rb,
lib/basespace/model/project.rb,
lib/basespace/model/variant.rb,
lib/basespace/api/api_client.rb,
lib/basespace/model/coverage.rb,
lib/basespace/model/purchase.rb,
lib/basespace/api/billing_api.rb,
lib/basespace/model/genome_v1.rb,
lib/basespace/model/app_result.rb,
lib/basespace/api/basespace_api.rb,
lib/basespace/model/app_session.rb,
lib/basespace/model/application.rb,
lib/basespace/model/run_compact.rb,
lib/basespace/model/user_compact.rb,
lib/basespace/model/variant_info.rb,
lib/basespace/api/basespace_error.rb,
lib/basespace/model/file_response.rb,
lib/basespace/model/list_response.rb,
lib/basespace/model/resource_list.rb,
lib/basespace/model/user_response.rb,
lib/basespace/model/variant_header.rb,
lib/basespace/model/basespace_model.rb,
lib/basespace/model/genome_response.rb,
lib/basespace/model/response_status.rb,
lib/basespace/model/sample_response.rb,
lib/basespace/model/multipart_upload.rb,
lib/basespace/model/project_response.rb,
lib/basespace/model/query_parameters.rb,
lib/basespace/model/coverage_metadata.rb,
lib/basespace/model/coverage_response.rb,
lib/basespace/model/purchase_response.rb,
lib/basespace/model/purchased_product.rb,
lib/basespace/model/app_result_response.rb,
lib/basespace/model/app_session_compact.rb,
lib/basespace/model/application_compact.rb,
lib/basespace/model/app_session_response.rb,
lib/basespace/model/coverage_meta_response.rb,
lib/basespace/model/refund_purchase_response.rb,
lib/basespace/model/variants_header_response.rb,
lib/basespace/model/app_session_launch_object.rb,
lib/basespace/model/query_parameters_purchased_product.rb

Overview

BaseSpace Ruby SDK is to be used in the development of Apps and scripts for working with Illumina’s BaseSpace cloud-computing solution for next-gen sequencing data analysis.

Defined Under Namespace

Classes: APIClient, AppResult, AppResultResponse, AppSession, AppSessionCompact, AppSessionLaunchObject, AppSessionResponse, Application, ApplicationCompact, BaseAPI, BaseSpaceAPI, BaseSpaceModel, BillingAPI, Consumer, Coverage, CoverageMetaResponse, CoverageMetadata, CoverageResponse, File, FileResponse, GenomeResponse, GenomeV1, IllegalParameterError, ListResponse, Model, ModelNotInitializedError, MultipartUpload, NoResponseError, Product, Project, ProjectResponse, Purchase, PurchaseResponse, PurchasedProduct, QueryParameters, QueryParametersPurchasedProduct, RefundPurchaseResponse, ResourceList, ResponseStatus, RunCompact, Sample, SampleResponse, UndefinedParameterError, UnknownParameterError, UploadTask, User, UserCompact, UserResponse, Variant, VariantHeader, VariantInfo, VariantsHeaderResponse, WrongFiletypeError

Class Method Summary collapse

Class Method Details

.load_credentialsObject

Loads login and authentication credentials from a JSON file.

If the environment variable “BASESPACE_CREDENTIALS” is set, then the path to the JSON files is taken from there. Otherwise, the current directory is searched for the file “credentials.json”.

On success, returns a hash with the values for

  • client_id

  • client_secret

  • access_token

  • app_session_id

  • basespace_url

  • api_version

On failure, returns nil.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/bio-basespace-sdk.rb', line 88

def self.load_credentials
  filename = "credentials.json"
  if ENV['BASESPACE_CREDENTIALS']
    jsonfile = ENV['BASESPACE_CREDENTIALS']
  else
    jsonfile = ::File.join('.', filename)
  end
  if ::File.exists?(jsonfile)
    hash = JSON.parse(::File.read(jsonfile))
    if $DEBUG
      $stderr.puts "    # ----- Bio::BaseSpace.load_credientials ----- "
      $stderr.puts "    # Loaded credentials from #{jsonfile}"
      $stderr.puts "    # "
    end
  else
    hash = nil
    $stderr.puts "    # ----- Bio::BaseSpace.load_credientials ----- "
    $stderr.puts "    # You can put your credentials for the BaseSpace in the"
    $stderr.puts "    #   #{jsonfile}"
    $stderr.puts "    # file or point to the file with an environmental variable"
    $stderr.puts "    #   export BASESPACE_CREDENTIALS=/path/to/your/#{filename}"
    $stderr.puts "    # in the following format:"
    data = {
      'client_id'       => '<your client id>',
      'client_secret'   => '<your client secret>',
      'access_token'    => '<your access token>',
      'app_session_id'  => '<app session id>',
      'basespace_url'   => 'https://api.basespace.illumina.com/',
      'api_version'     => 'v1pre3',
    }
    $stderr.puts JSON.pretty_generate(JSON.parse(data.to_json))
  end
  return hash
end