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, #respond_to_missing?, #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



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

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

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



12
13
14
# File 'lib/deploy/resources/server.rb', line 12

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

Instance Method Details

#default_paramsObject



18
19
20
# File 'lib/deploy/resources/server.rb', line 18

def default_params
  { project: project }
end

#to_sObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/deploy/resources/server.rb', line 22

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