Class: Blazemeter::Common

Inherits:
Object
  • Object
show all
Defined in:
lib/blazemeter/common.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.credentials_fileObject


6
7
8
# File 'lib/blazemeter/common.rb', line 6

def self.credentials_file
    ENV['HOME'] + '/.blazemeter/credentials'
end

.get_location(location) ⇒ Object


25
26
27
28
29
30
31
32
33
# File 'lib/blazemeter/common.rb', line 25

def self.get_location(location)
  locations = locations_hash
  if locations[location]
    return locations[location]
  else
       return location
     end	  
  
end

.get_user_keyObject


9
10
11
# File 'lib/blazemeter/common.rb', line 9

def self.get_user_key
  read_credentials[0]
end

.locations_hashObject


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/blazemeter/common.rb', line 13

def self.locations_hash
  locations = Hash.new
     locations['ireland'] = 'eu-west-1'
  locations['virginia'] = 'us-east-1'
  locations['california'] = 'us-west-1'
  locations['oregon'] = 'us-west-2'
  locations['sao paulo'] = 'sa-east-1'
  locations['singapore'] = 'ap-southeast-1'
  locations['sydney'] = 'ap-southeast-2'
  locations['tokyo'] = 'ap-northeast-1'
  return locations
end

.read_credentialsObject


3
4
5
# File 'lib/blazemeter/common.rb', line 3

def self.read_credentials
    File.exists?(credentials_file) and File.read(credentials_file).split("\n")        
end