6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/skytapify/skytap_api.rb', line 6
def api_call(organization, action, global_options = [], command_options = {}, &invoker)
if ['test', 'development'].include? Rails.env
env_options = {:param => global_options, :'log-level' => 'verbose', :'base-url' => 'https://test.skytap.com', :'verify-certs' => false}
else
env_options = {:param => global_options, :'log-level' => 'verbose'}
end
response = begin
Skytap::invoke(
organization.skytap_account_name,
organization.skytap_api_key,
action,
command_options,
env_options,
&invoker
)
rescue SystemExit => e
end
if response.payload.is_a?(Hash) && response.payload['errors']
raise response.payload['errors'].join(', ')
else
response.payload
end
end
|