Class: Deploy::Deployment
Instance Attribute Summary
Attributes inherited from Resource
#attributes, #errors, #id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Resource
class_name, #create, #destroy, find, find_all, find_single, #method_missing, #new_record?, #post, post, #save, #update
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Deploy::Resource
Class Method Details
.collection_path(params = {}) ⇒ Object
4
5
6
|
# File 'lib/deploy/resources/deployment.rb', line 4
def collection_path(params = {})
"projects/#{params[:project].permalink}/deployments"
end
|
.member_path(id, params = {}) ⇒ Object
8
9
10
|
# File 'lib/deploy/resources/deployment.rb', line 8
def member_path(id, params = {})
"projects/#{params[:project].permalink}/deployments/#{id}"
end
|
Instance Method Details
#default_params ⇒ Object
13
14
15
|
# File 'lib/deploy/resources/deployment.rb', line 13
def default_params
{:project => self.project}
end
|
#project ⇒ Object
17
18
19
20
21
22
|
# File 'lib/deploy/resources/deployment.rb', line 17
def project
if self.attributes['project'].is_a?(Hash)
self.attributes['project'] = Project.send(:create_object, self.attributes['project'])
end
self.attributes['project']
end
|
#servers ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/deploy/resources/deployment.rb', line 24
def servers
if attributes['servers'].is_a?(Array)
@servers ||= attributes['servers'].map do |server_params|
Server.new.tap do |server|
server.id = server_params['id']
server.attributes = server_params
end
end
else
[]
end
end
|
#steps ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/deploy/resources/deployment.rb', line 37
def steps
if attributes['steps'].is_a?(Array)
@steps ||= attributes['steps'].map do |step_params|
DeploymentStep.new.tap do |step|
step.id = step_params['identifier']
step.attributes = step_params
step.attributes['deployment'] = self
end
end
else
[]
end
end
|