module Bio::BaseSpace
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.
Public Class Methods
load_credentials()
click to toggle source
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.
# 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