Class: RDSTUNE::Ec2Info

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2info.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance_type) ⇒ Ec2Info

Returns a new instance of Ec2Info.



6
7
8
9
# File 'lib/ec2info.rb', line 6

def initialize(instance_type)
  @instance_type = instance_type
  @ec2info = JSON.parse(Net::HTTP.get(URI('https://www.ec2instances.info/rds/instances.json')))
end

Instance Method Details

#get_memoryObject



15
16
17
18
# File 'lib/ec2info.rb', line 15

def get_memory()
  m = @ec2info.select {|instances| instances['instance_type'] == @instance_type}
  m.first["memory"].to_f
end

#showObject



11
12
13
# File 'lib/ec2info.rb', line 11

def show()
  puts get()
end