Class: ServiceAccount
- Inherits:
-
Object
- Object
- ServiceAccount
- Defined in:
- lib/service_account.rb
Constant Summary collapse
- APP_NAME_REGEX =
/gp-(.*)/- CREDENTIALS_INDEX =
0
Instance Method Summary collapse
- #get_instance_id ⇒ Object
- #get_password ⇒ Object
- #get_url_string ⇒ Object
- #get_user_id ⇒ Object
-
#initialize(url_string = "", user_id = "", pwd = "", instance_id = "") ⇒ ServiceAccount
constructor
A new instance of ServiceAccount.
- #set_instance_id(instance_id) ⇒ Object
- #set_password(password) ⇒ Object
- #set_url_string(url) ⇒ Object
- #set_user_id(user_id) ⇒ Object
Constructor Details
#initialize(url_string = "", user_id = "", pwd = "", instance_id = "") ⇒ ServiceAccount
Returns a new instance of ServiceAccount.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/service_account.rb', line 49 def initialize(url_string = "", user_id = "", pwd = "", instance_id = "") if !url_string.empty? && !user_id.empty? && !pwd.empty? && !instance_id.empty? @url_string = url_string @user_id = user_id @pwd = pwd @instance_id = instance_id else account = get_service_account_via_env_var if account.nil? account = get_service_account_via_vcap_service if account.nil? raise "Couldn't create a service account" end end @url_string = account[0] @user_id = account[1] @pwd = account[2] @instance_id=account[3] end end |
Instance Method Details
#get_instance_id ⇒ Object
85 86 87 |
# File 'lib/service_account.rb', line 85 def get_instance_id @instance_id end |
#get_password ⇒ Object
81 82 83 |
# File 'lib/service_account.rb', line 81 def get_password @pwd end |
#get_url_string ⇒ Object
73 74 75 |
# File 'lib/service_account.rb', line 73 def get_url_string @url_string end |
#get_user_id ⇒ Object
77 78 79 |
# File 'lib/service_account.rb', line 77 def get_user_id @user_id end |
#set_instance_id(instance_id) ⇒ Object
101 102 103 |
# File 'lib/service_account.rb', line 101 def set_instance_id(instance_id) @instance_id = instance_id end |
#set_password(password) ⇒ Object
97 98 99 |
# File 'lib/service_account.rb', line 97 def set_password(password) @pwd = password end |
#set_url_string(url) ⇒ Object
89 90 91 |
# File 'lib/service_account.rb', line 89 def set_url_string(url) @url_string = url end |
#set_user_id(user_id) ⇒ Object
93 94 95 |
# File 'lib/service_account.rb', line 93 def set_user_id(user_id) @user_id = user_id end |