Class: Executable

Inherits:
Object
  • Object
show all
Extended by:
RightScale::Api::BaseExtend
Includes:
RightScale::Api::Base
Defined in:
lib/rest_connection/rightscale/executable.rb

Overview

API 1.0

Instance Attribute Summary

Attributes included from RightScale::Api::Base

#params

Instance Method Summary collapse

Methods included from RightScale::Api::BaseExtend

[], create, deny_methods, filters, find, find_all, find_by, find_by_cloud_id, find_by_id, find_by_nickname, find_by_nickname_speed, find_with_filter, resource_plural_name, resource_singular_name

Methods included from RightScale::Api::BaseConnection

#connection

Methods included from RightScale::Api::Base

#[], #[]=, #destroy, #initialize, #method_missing, #reload, #resource_plural_name, #resource_singular_name, #rs_id, #save

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightScale::Api::Base

Instance Method Details

#hrefObject



67
68
69
70
71
72
73
74
# File 'lib/rest_connection/rightscale/executable.rb', line 67

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

#nameObject



59
60
61
62
63
64
65
# File 'lib/rest_connection/rightscale/executable.rb', line 59

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

#recipe?Boolean

executable can be EITHER a right_script or recipe executable example params format: can have recipes AND right_scripts

Returns:

  • (Boolean)


45
46
47
48
49
50
# File 'lib/rest_connection/rightscale/executable.rb', line 45

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

#right_scriptObject



76
77
78
# File 'lib/rest_connection/rightscale/executable.rb', line 76

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

#right_script?Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
# File 'lib/rest_connection/rightscale/executable.rb', line 52

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