Class: RightScript

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

Overview

API 1.0

Instance Attribute Summary collapse

Attributes included from RightScale::Api::Base

#params

Class Method Summary collapse

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, #method_missing, #reload, #resource_plural_name, #resource_singular_name, #rs_id, #save

Constructor Details

#initialize(*args, &block) ⇒ RightScript

Returns a new instance of RightScript.



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

def initialize(*args, &block)
  super(*args, &block)
  if RightScale::Api::api0_1?
    @internal = RightScriptInternal.new(*args, &block)
  end
end

Dynamic Method Handling

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

Instance Attribute Details

#internalObject

Returns the value of attribute internal.



34
35
36
# File 'lib/rest_connection/rightscale/right_script.rb', line 34

def internal
  @internal
end

Class Method Details

.from_instance_info(file = "/var/spool/ec2/rs_cache/info.yml") ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rest_connection/rightscale/right_script.rb', line 45

def self.from_instance_info(file = "/var/spool/ec2/rs_cache/info.yml")
  scripts = []
  if File.exists?(file)
    x = YAML.load(IO.read(file))
  elsif File.exists?(File.join(File.dirname(__FILE__),'info.yml'))
    x = YAML.load(IO.read(File.join(File.dirname(__FILE__),'info.yml')))
  else
    return nil
  end
  x.keys.each do |script|
    scripts << self.new('href' => "right_scripts/#{script}", 'name' => x[script].ivars['name'])
  end
  scripts
end

.from_yaml(yaml) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/rest_connection/rightscale/right_script.rb', line 36

def self.from_yaml(yaml)
  scripts = []
  x = YAML.load(yaml)
  x.keys.each do |script|
    scripts << self.new('href' => "right_scripts/#{script}", 'name' => x[script].ivars['name'])
  end
  scripts
end