Class: CloudInteractor::Flavor

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

Overview

Constant Summary collapse

IDENTITY =
'flavors'
RESOURCE =
'compute'

Instance Method Summary collapse

Constructor Details

#initialize(main_obj, classes, options = {}) ⇒ Flavor

Returns a new instance of Flavor.



7
8
9
10
11
# File 'lib/cloud_interactor/flavor.rb', line 7

def initialize main_obj, classes, options={} 
  @main_obj  = main_obj
  @options   = options
  @classes   = classes
end

Instance Method Details

#list(args = {}, output = true) ⇒ Object



17
18
19
# File 'lib/cloud_interactor/flavor.rb', line 17

def list args={}, output=true
  @classes['helper'].generic_list_call IDENTITY, RESOURCE, output
end

#read(args, output = true, mode = 'name') ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/cloud_interactor/flavor.rb', line 21

def read args, output=true, mode='name'
  list [], false

  if @options['preferred_cloud'] =~ /digitalocean/
    mode         = 'slug'
    args['slug'] = args['name'] if args.class == Hash
  end

  @classes['helper'].generic_read_parse args, IDENTITY, output, mode
end

#run(method, args) ⇒ Object



13
14
15
# File 'lib/cloud_interactor/flavor.rb', line 13

def run method, args
  self.send(method, args)
end