Class: EY::CloudClient::Test::Scenario

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard-cloud-client/test/scenario.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Scenario

Returns a new instance of Scenario.



27
28
29
30
31
32
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 27

def initialize(options)
  @name      = options['name']
  @email     = options['email']
  @password  = options['password']
  @api_token = options['api_token']
end

Instance Attribute Details

#api_tokenObject (readonly)

Returns the value of attribute api_token.



25
26
27
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 25

def api_token
  @api_token
end

#emailObject (readonly)

Returns the value of attribute email.



25
26
27
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 25

def email
  @email
end

#passwordObject (readonly)

Returns the value of attribute password.



25
26
27
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 25

def password
  @password
end

Class Method Details

.[](name) ⇒ Object



8
9
10
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 8

def self.[](name)
  scenarios[name] or raise "Scenario #{name.inspect} not found in:\n\t#{scenarios.keys.join("\n\t")}"
end

.load_scenariosObject



16
17
18
19
20
21
22
23
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 16

def self.load_scenarios
  response = ::RestClient.get(EY::CloudClient::Test::FakeAwsm.uri.sub(/\/?$/,'/scenarios'))
  data = MultiJson.load(response)
  data['scenarios'].inject({}) do |hsh, scenario|
    hsh[scenario['name']] = new(scenario)
    hsh
  end
end

.scenariosObject



12
13
14
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 12

def self.scenarios
  @scenarios ||= load_scenarios
end

Instance Method Details

#cloud_clientObject



34
35
36
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 34

def cloud_client
  EY::CloudClient.new(:endpoint => EY::CloudClient::Test::FakeAwsm.uri, :token => @api_token)
end

#inspectObject



38
39
40
# File 'lib/engineyard-cloud-client/test/scenario.rb', line 38

def inspect
  "#<Test::Scenario name:#@name>"
end