Module: Cloudpassage::Pry

Defined in:
lib/cloudpassage/pry.rb

Instance Method Summary collapse

Instance Method Details

#cloudpassage(type) ⇒ Object



5
6
7
8
# File 'lib/cloudpassage/pry.rb', line 5

def cloudpassage(type)
  type_section = section(type)
  Cloudpassage::Api.new(Cloudpassage.token(type_section['id'], type_section['secret']))
end

#config_fileObject



18
19
20
# File 'lib/cloudpassage/pry.rb', line 18

def config_file
  ENV.fetch('CLOUDPASSAGE_CONFIG_FILE', "#{ENV['HOME']}/.cloudpassagerc")
end

#section(type) ⇒ Object



10
11
12
# File 'lib/cloudpassage/pry.rb', line 10

def section(type)
  yaml[type.to_s]
end

#yamlObject



14
15
16
# File 'lib/cloudpassage/pry.rb', line 14

def yaml
  @@yaml ||= YAML.load(File.read(config_file))
end