Class: Account

Inherits:
Object
  • Object
show all
Defined in:
lib/dew/models/account.rb

Class Method Summary collapse

Instance Method Summary collapse

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.()
  File.join(ENV['HOME'], '.dew', 'accounts', "#{}.yaml")
end

.read(account_name) ⇒ Object



9
10
11
# File 'lib/dew/models/account.rb', line 9

def self.read()
  Account.new(YAML.load_file(()))
end

.user_idsObject



13
14
15
16
17
# File 'lib/dew/models/account.rb', line 13

def self.user_ids
  Dir[('*')].map do |filename|
    read(File.basename(filename, '.yaml')).aws_user_id
  end
end

Instance Method Details

#aws_access_key_idObject



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_keyObject



27
28
29
# File 'lib/dew/models/account.rb', line 27

def aws_secret_access_key
  @yaml['aws']['secret_access_key']
end

#aws_user_idObject



31
32
33
# File 'lib/dew/models/account.rb', line 31

def aws_user_id
  @yaml['aws']['user_id'].to_s.gsub('-', '')
end

#dns_domainObject



43
44
45
# File 'lib/dew/models/account.rb', line 43

def dns_domain
  @yaml['dns']['domain']
end

#dns_keyObject



39
40
41
# File 'lib/dew/models/account.rb', line 39

def dns_key
  @yaml['dns']['key']
end

#has_dns?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/dew/models/account.rb', line 35

def has_dns?
  @yaml.include?('dns')
end