Class: Account
- Inherits:
-
Object
- Object
- Account
- Defined in:
- lib/dew/models/account.rb
Class Method Summary collapse
Instance Method Summary collapse
- #aws_access_key_id ⇒ Object
- #aws_secret_access_key ⇒ Object
- #aws_user_id ⇒ Object
- #dns_domain ⇒ Object
- #dns_key ⇒ Object
- #has_dns? ⇒ Boolean
-
#initialize(yaml) ⇒ Account
constructor
A new instance of Account.
Constructor Details
#initialize(yaml) ⇒ Account
Returns a new instance of Account.
5 6 7 |
# File 'lib/dew/models/account.rb', line 5 def initialize(yaml) @yaml = yaml end |
Class Method Details
.account_path(account_name) ⇒ Object
19 20 21 |
# File 'lib/dew/models/account.rb', line 19 def self.account_path(account_name) File.join(ENV['HOME'], '.dew', 'accounts', "#{account_name}.yaml") end |
.read(account_name) ⇒ Object
9 10 11 |
# File 'lib/dew/models/account.rb', line 9 def self.read(account_name) Account.new(YAML.load_file(account_path(account_name))) end |
.user_ids ⇒ Object
13 14 15 16 17 |
# File 'lib/dew/models/account.rb', line 13 def self.user_ids Dir[account_path('*')].map do |filename| read(File.basename(filename, '.yaml')).aws_user_id end end |
Instance Method Details
#aws_access_key_id ⇒ Object
23 24 25 |
# File 'lib/dew/models/account.rb', line 23 def aws_access_key_id @yaml['aws']['access_key_id'] end |
#aws_secret_access_key ⇒ Object
27 28 29 |
# File 'lib/dew/models/account.rb', line 27 def aws_secret_access_key @yaml['aws']['secret_access_key'] end |
#aws_user_id ⇒ Object
31 32 33 |
# File 'lib/dew/models/account.rb', line 31 def aws_user_id @yaml['aws']['user_id'].to_s.gsub('-', '') end |
#dns_domain ⇒ Object
43 44 45 |
# File 'lib/dew/models/account.rb', line 43 def dns_domain @yaml['dns']['domain'] end |
#dns_key ⇒ Object
39 40 41 |
# File 'lib/dew/models/account.rb', line 39 def dns_key @yaml['dns']['key'] end |
#has_dns? ⇒ Boolean
35 36 37 |
# File 'lib/dew/models/account.rb', line 35 def has_dns? @yaml.include?('dns') end |