Class: RightScriptInternal

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

Overview

API 0.1

Instance Attribute Summary

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

Methods included from RightScale::Api::BaseConnection

#connection

Methods included from RightScale::Api::InternalConnection

#connection

Methods included from RightScale::Api::Base

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

Dynamic Method Handling

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

Class Method Details

.resource_plural_nameObject



43
44
45
# File 'lib/rest_connection/rightscale/right_script_internal.rb', line 43

def self.resource_plural_name
  "right_scripts"
end

.resource_singular_nameObject



47
48
49
# File 'lib/rest_connection/rightscale/right_script_internal.rb', line 47

def self.resource_singular_name
  "right_script"
end

Instance Method Details

#attachmentsObject



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

def attachments
  @params["attachments"] ||= fetch_right_script_attachments
end

#cloneObject

clones a RightScript and returns the new RightScript resource that’s been created.



61
62
63
64
# File 'lib/rest_connection/rightscale/right_script_internal.rb', line 61

def clone
  t = URI.parse(self.href)
  RightScript.new(:href => connection.post(t.path + "/clone"))
end

#commit(message) ⇒ Object

commits a rightscript



55
56
57
58
# File 'lib/rest_connection/rightscale/right_script_internal.rb', line 55

def commit(message)
  t = URI.parse(self.href)
  RightScript.new(:href => connection.post(t.path + "/commit", :commit_message => message))
end

#fetch_right_script_attachmentsObject



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

def fetch_right_script_attachments
  t = URI.parse(self.href)
  @params["attachments"] = []
  connection.get(t.path + "/right_script_attachments").each { |obj|
    obj.merge!("right_script_href" => self.href)
    @params["attachments"] << RightScriptAttachmentInternal.new(obj)
  }
  @params["attachments"]
end

#resource_plural_nameObject



35
36
37
# File 'lib/rest_connection/rightscale/right_script_internal.rb', line 35

def resource_plural_name
  "right_scripts"
end

#resource_singular_nameObject



39
40
41
# File 'lib/rest_connection/rightscale/right_script_internal.rb', line 39

def resource_singular_name
  "right_script"
end