Sha256: 3b8d60b78892a1cb3e9aafe09441b8e2a560c768a7ef47e86bb17ed7f12f036b

Contents?: true

Size: 813 Bytes

Versions: 15

Compression:

Stored size: 813 Bytes

Contents

class Ey::Core::Client::Slots < Ey::Core::Collection

  model Ey::Core::Client::Slot

  self.model_root         = "slot"
  self.model_request      = :get_slot
  self.collection_root    = "slots"
  self.collection_request = :get_slots

  def create!(options={})
    response = connection.create_slots(
      "url"     => self.url,
      "cluster" => options[:cluster_id] || (options[:cluster] && options[:cluster].identity),
      "slots" => {
        "names"    => options[:names],
        "quantity" => options[:quantity],
        "flavor"   => options[:flavor],
        "image"    => options[:image],
      }.reject {|key,val| val.nil? }
    )
    connection.slots.load(response.body["slots"])
  end

  def create(options={})
    create!(options)
    self
  rescue Ey::Core::Response::Error
    false
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ey-pro-cli-0.0.17 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.16 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.15 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.14 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.13 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.12 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.11 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.10 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.9 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.8 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.7 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.6 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.5 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.4 lib/vendor/core/ey-core/collections/slots.rb
ey-pro-cli-0.0.3 lib/vendor/core/ey-core/collections/slots.rb