Class: Deployment

Inherits:
RightResource::Base show all
Defined in:
lib/right_resource/deployment.rb

Overview

Define methods

deployment actions (start_all, stop_all, duplicate)

Parameters

Instance Attribute Summary

Attributes inherited from RightResource::Base

#attributes, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RightResource::Base

action, #clone, collection_path, connection, connection=, correct_attributes, create, #destory, destory, #dup, element_path, format, format=, headers, #initialize, #known_attributes, #loads, logger, logger=, #new?, #reload, resource_id, resource_name, #respond_to?, #respond_to_without_attributes?, #save, #schema, status_code, update, #update_attribute, #update_attributes

Constructor Details

This class inherits a constructor from RightResource::Base

Dynamic Method Handling

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

Class Method Details

.index(params = {}) ⇒ Object

Override RightResource::Base#index Hash2Object of RightScale servers



9
10
11
12
13
14
15
16
# File 'lib/right_resource/deployment.rb', line 9

def index(params = {})
  deployments = super
  deployments.each do |deployment|
    deployment.servers
  end

  deployments
end

.show(id, params = {}) ⇒ Object

Override RightResource::Base#show Hash2Object of RightScale servers



20
21
22
23
24
25
26
27
# File 'lib/right_resource/deployment.rb', line 20

def show(id, params = {})
  deployment = super
  unless deployment.nil?
    deployment.servers
  end

  deployment
end

Instance Method Details

#serversObject

Convert servers



38
39
40
41
42
43
44
45
46
# File 'lib/right_resource/deployment.rb', line 38

def servers
  unless self.attributes[:servers].nil?
    self.attributes[:servers].map! do |record|
      record.is_a?(Hash) ? Server.new(record) : record
    end
  end

  self.attributes[:servers]
end