Class: DeltaCloud::Operation::POST
- Inherits:
-
Object
- Object
- DeltaCloud::Operation::POST
- Defined in:
- lib/deltacloud-cli.rb
Instance Method Summary collapse
-
#initialize(operation, resource, options) ⇒ POST
constructor
A new instance of POST.
- #parse_opts(options) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(operation, resource, options) ⇒ POST
Returns a new instance of POST.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/deltacloud-cli.rb', line 84 def initialize(operation, resource, ) @operation, @resource, @options = operation, resource, = parse_opts() puts .inspect #begin ap resource @collection=case @operation when :create then DeltaCloud::Operation::client.send(:"create_#{resource}", ) when :start, :stop, :reboot then DeltaCloud::Operation::client.send(:"#{resource}", .strip).send(:"#{@operation}!") end #rescue NoMethodError # ap "ERROR: Unknown resource #{resource}. Type 'resources' to list all resources" #end return self end |
Instance Method Details
#parse_opts(options) ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/deltacloud-cli.rb', line 100 def parse_opts() opts = {} .split(' ').collect do |opt| opts[:"#{opt.split(':').first}"] = opt.split(':').last end ap opts opts end |