Class: Deploy::Server

Inherits:
Resource show all
Defined in:
lib/deploy/resources/server.rb

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



5
6
7
# File 'lib/deploy/resources/server.rb', line 5

def collection_path(params = {})
  "projects/#{params[:project].permalink}/servers"
end

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



9
10
11
# File 'lib/deploy/resources/server.rb', line 9

def member_path(id, params = {})
  "projects/#{params[:project].permalink}/servers/#{identifier}"
end

Instance Method Details

#default_paramsObject



14
15
16
# File 'lib/deploy/resources/server.rb', line 14

def default_params
  {:project => self.project}
end

#to_sObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/deploy/resources/server.rb', line 18

def to_s
  Array.new.tap do |a|
    a << self.name
    a << "(branch: #{self.preferred_branch})" if self.preferred_branch
    if self.last_revision
      a << "(currently: #{self.last_revision})"
    else
      a << "(currently undeployed)"
    end
  end.join(' ')
end