Sha256: 0c28ec4b28b3b5d8e044a82ec7e13f4970f7b8b2f98596a9c3af3f849bde1429

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

class Executable
  include RightScale::Api::Base
  extend RightScale::Api::BaseExtend

  deny_methods :index, :create, :destroy, :update

  # executable can be EITHER a right_script or recipe
  # executable example params format:
  # can have recipes AND right_scripts
  # @params =
  #    { :recipe =>
  #      :position => 12,
  #      :apply => "operational",
  #      :right_script => { "href" => "http://blah",
  #                         "name" => "blah"
  #                         ...
  #      }

  def recipe?
    if self["recipe"] == nil # && right_script['href']
      return false
    end
    true
  end

  def right_script?
    if self["recipe"] == nil # && right_script['href']
      return true
    end
    false
  end

  def name
    if right_script?
      return right_script.name
    else
      return recipe
    end
  end

  def href
    if right_script?
      return right_script.href
    else
      #recipes do not have hrefs, only names
      return recipe
    end
  end

  def right_script
    RightScript.new(@params['right_script'])
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rest_connection-0.1.7 lib/rest_connection/rightscale/executable.rb
rest_connection-0.1.6 lib/rest_connection/rightscale/executable.rb
rest_connection-0.1.5 lib/rest_connection/rightscale/executable.rb
rest_connection-0.1.4 lib/rest_connection/rightscale/executable.rb
rest_connection-0.1.3 lib/rest_connection/rightscale/executable.rb
rest_connection-0.1.2 lib/rest_connection/rightscale/executable.rb