Class: Joyent::Cloud::Pricing::Flavor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Flavor

Returns a new instance of Flavor.



4
5
6
7
8
9
10
11
# File 'lib/pricing/flavor.rb', line 4

def initialize(name, options = {})
  @name = name
  @os = options[:os]
  @cost = (options[:cost] == 'N/A') ? nil : options[:cost].to_f
  @cpus = options[:cpus].to_f
  @disk = options[:disk].to_i
  @ram = options[:ram].to_f
end

Instance Attribute Details

#costObject

Returns the value of attribute cost.



3
4
5
# File 'lib/pricing/flavor.rb', line 3

def cost
  @cost
end

#cpusObject

Returns the value of attribute cpus.



3
4
5
# File 'lib/pricing/flavor.rb', line 3

def cpus
  @cpus
end

#diskObject

Returns the value of attribute disk.



3
4
5
# File 'lib/pricing/flavor.rb', line 3

def disk
  @disk
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/pricing/flavor.rb', line 3

def name
  @name
end

#osObject

Returns the value of attribute os.



3
4
5
# File 'lib/pricing/flavor.rb', line 3

def os
  @os
end

#ramObject

Returns the value of attribute ram.



3
4
5
# File 'lib/pricing/flavor.rb', line 3

def ram
  @ram
end

Instance Method Details

#to_hObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/pricing/flavor.rb', line 13

def to_h
  {
    name: name,
    os: os,
    cost: cost,
    cpus: cpus,
    disk: disk,
    ram: ram
  }
end