3
4
5
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
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/stackfu/helpers/providers_credentials.rb', line 3
def add_webbynode_credentials(user)
while true
puts ""
puts "Enter your Webbynode API credentials below (or type 'help' for more information or 'abort' to abort)"
login = ask("Webbynode Login:")
unless login.try(:downcase) == "abort" or login.try(:downcase) == "help"
token = ask("Webbynode Token:")
end
credentials = [login || "", token || ""].map(&:downcase)
if credentials.include?('help')
puts ""
puts "== Webbynode StackFu integration ==".foreground(:green).bright
puts ""
puts "In order to allow StackFu to integrate itself with Webbynode, you need to provide the email address you use to login into Webbynode Manager and your API token."
puts ""
puts "This can be easily done by visiting your '#{"Account".foreground(:cyan)}' area in Webbynode Manager. On the box where your summary is presented, copy the 'API Token:' field content."
puts ""
puts "If you need further information, visit #{"http://stackfu.com/faq/webbynode-api-integration".underline} for a complete walkthrough of this process."
elsif credentials.include?('abort')
puts "Aborted adding server."
return false
else
user.settings.webbynode_login = login
user.settings.webbynode_token = token
if user.save
puts ""
puts "Webbynode credentials saved."
else
puts "Error: #{user.errors.full_messages.to_s}"
end
return true
end
end
end
|